-
Notifications
You must be signed in to change notification settings - Fork 868
Voice Broadcast - Start record #7363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0154ead to
82bd02c
Compare
| roomId: String, | ||
| attachment: ContentAttachmentData, | ||
| rootThreadEventId: String? | ||
| rootThreadEventId: String?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking but I am wondering if we should remove the rootThreadEventId param and build the relatesTo param in case of threads at an upper level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started considering this point but I am not sure it would make sense to build the relatesTo related to a thread in an upper level, IMO it makes sense to do it in the factory 😕
| return createMessageEvent(roomId, content) | ||
| } | ||
|
|
||
| private fun generateThreadRelationContent(rootThreadEventId: String) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for mutualizing this code!
82bd02c to
3a951f2
Compare
bmarty
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, a few remarks. Did not try to run the code.
| voiceRecorder.stopRecord() | ||
| stopRecordingAmplitudes() | ||
| voiceRecorder.pauseRecord() | ||
| pauseRecordingAmplitudes() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am OK with this change, but can it have a side effect on the voice message feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not observe any problem during my few tests with voice messages but I miss some bg about it, I revert the change for the moment and added a comment about it def9fc0
| fun setNextOutputFile(roomId: String) { | ||
| val mediaRecorder = mediaRecorder ?: return | ||
| nextOutputFile = createOutputFile(roomId) | ||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are always >= Q here, no? So this test will be always true. Do you agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| private fun setOutputFile(roomId: String) { | ||
| val mediaRecorder = mediaRecorder ?: return | ||
| outputFile = outputFile ?: createOutputFile(roomId) | ||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| override fun resumeRecord() { | ||
| Toast.makeText(context, "Not implemented for this Android version", Toast.LENGTH_SHORT).show() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could add a fun canPauseAndResume(): Boolean in the interface to adapt the UI pro-actively. Or a more extensive fun getRecorderCapability(): RecorderCapability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to consider this point in another PR
| "Voice message.${voiceMessageFile.extension}" | ||
| ) | ||
| val audioType = outputFileUri.toMultiPickerAudioType(context) ?: return | ||
| if (audioType.duration > 1000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep this check on the duration? It was for voice message IIRC.
If we keep it, the else block should delete the file, maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was hesitating on that point, I think it makes sense to remove it, let's see what happens 🤞🏻 92bd8cd
| } | ||
|
|
||
| private fun stopRecording() { | ||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check could be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const val STATE_ROOM_VOICE_BROADCAST_INFO = "io.element.voice_broadcast_info" | ||
|
|
||
| /** Default voice broadcast chunk duration, in seconds. */ | ||
| const val DEFAULT_CHUNK_LENGTH = 30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be nice for clarity where it's used to have the unit in the name
| const val DEFAULT_CHUNK_LENGTH = 30 | |
| const val DEFAULT_CHUNK_LENGTH_IN_SECONDS = 30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
SonarCloud Quality Gate failed. |
bmarty
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's all good to me, thanks for the update!








Type of change
Content
Handle the recording side of the voice broadcast with play/pause/resume/stop actions
Voice messages are recorded in
mp4for technical reasons (the Android MediaRecorder does not allow to record in multiple files in other formats).For the moment, voice messages are sent to the room as separate events in relation to the voice broadcast state event.
The aggregation of the events and the conversion to
oggwill be done in dedicated PRs.Note: common voice messages are still recorded in
oggMotivation and context
Continue #7127
Screenshots / GIFs
(there is transparency because of gif compression)
Tests
Tested devices
Checklist