mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Fix voice record not playable if displayed before download terminated
This commit is contained in:
parent
31d92abcdf
commit
f6d4f56bbc
1 changed files with 26 additions and 10 deletions
|
|
@ -209,6 +209,14 @@ class MessageModel @WorkerThread constructor(
|
|||
if (!allFilesDownloaded) {
|
||||
computeContentsList()
|
||||
}
|
||||
|
||||
for (content in message.contents) {
|
||||
if (content.isVoiceRecording) {
|
||||
Log.i("$TAG File transfer done, updating voice record info")
|
||||
computeVoiceRecordContent(content)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -390,16 +398,7 @@ class MessageModel @WorkerThread constructor(
|
|||
} else if (content.isVoiceRecording) {
|
||||
Log.d("$TAG Found voice recording content")
|
||||
isVoiceRecord.postValue(true)
|
||||
voiceRecordPath = content.filePath ?: ""
|
||||
|
||||
val duration = content.fileDuration
|
||||
voiceRecordingDuration.postValue(duration)
|
||||
|
||||
val formattedDuration = SimpleDateFormat(
|
||||
"mm:ss",
|
||||
Locale.getDefault()
|
||||
).format(duration) // duration is in ms
|
||||
formattedVoiceRecordingDuration.postValue(formattedDuration)
|
||||
computeVoiceRecordContent(content)
|
||||
displayableContentFound = true
|
||||
} else {
|
||||
if (content.isFile) {
|
||||
|
|
@ -952,4 +951,21 @@ class MessageModel @WorkerThread constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun computeVoiceRecordContent(content: Content) {
|
||||
voiceRecordPath = content.filePath ?: ""
|
||||
|
||||
val duration = content.fileDuration
|
||||
voiceRecordingDuration.postValue(duration)
|
||||
|
||||
val formattedDuration = SimpleDateFormat(
|
||||
"mm:ss",
|
||||
Locale.getDefault()
|
||||
).format(duration) // duration is in ms
|
||||
formattedVoiceRecordingDuration.postValue(formattedDuration)
|
||||
Log.i(
|
||||
"$TAG Found voice record with path [$voiceRecordPath] and duration [$formattedDuration]"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue