mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 18:35:40 +03:00
only converting the voice messages when we're sending them
- stops us from eagerly converting to .ogg on android L and below devices whilst the draft phase/playback phase is ongoing, fixes unexpected .ogg when playing drafts
This commit is contained in:
parent
2e52f429fb
commit
81ee141330
2 changed files with 8 additions and 4 deletions
|
@ -718,7 +718,7 @@ class MessageComposerViewModel @AssistedInject constructor(
|
|||
if (isCancelled) {
|
||||
voiceMessageHelper.deleteRecording()
|
||||
} else {
|
||||
voiceMessageHelper.stopRecording()?.let { audioType ->
|
||||
voiceMessageHelper.stopRecording(convertForSending = true)?.let { audioType ->
|
||||
if (audioType.duration > 1000) {
|
||||
room.sendMedia(audioType.toContentAttachmentData(isVoiceMessage = true), false, emptySet())
|
||||
} else {
|
||||
|
|
|
@ -76,13 +76,17 @@ class VoiceMessageHelper @Inject constructor(
|
|||
startRecordingAmplitudes()
|
||||
}
|
||||
|
||||
fun stopRecording(): MultiPickerAudioType? {
|
||||
fun stopRecording(convertForSending: Boolean): MultiPickerAudioType? {
|
||||
tryOrNull("Cannot stop media recording amplitude") {
|
||||
stopRecordingAmplitudes()
|
||||
}
|
||||
val voiceMessageFile = tryOrNull("Cannot stop media recorder!") {
|
||||
voiceRecorder.stopRecord()
|
||||
if (convertForSending) {
|
||||
voiceRecorder.getVoiceMessageFile()
|
||||
} else {
|
||||
voiceRecorder.getCurrentRecord()
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -234,7 +238,7 @@ class VoiceMessageHelper @Inject constructor(
|
|||
}
|
||||
|
||||
fun stopAllVoiceActions(deleteRecord: Boolean = true): MultiPickerAudioType? {
|
||||
val audioType = stopRecording()
|
||||
val audioType = stopRecording(convertForSending = false)
|
||||
stopPlayback()
|
||||
if (deleteRecord) {
|
||||
deleteRecording()
|
||||
|
|
Loading…
Reference in a new issue