Fix wrong sequence number in stopped state event content

This commit is contained in:
Florian Renaud 2022-11-24 17:49:16 +01:00
parent a2dee2193a
commit d092c83774
2 changed files with 6 additions and 4 deletions

View File

@ -54,7 +54,8 @@ class PauseVoiceBroadcastUseCase @Inject constructor(
private suspend fun pauseVoiceBroadcast(room: Room, reference: RelationDefaultContent?) {
Timber.d("## PauseVoiceBroadcastUseCase: Send new voice broadcast info state event")
// immediately pause the recording
// save the last sequence number and immediately pause the recording
val lastSequence = voiceBroadcastRecorder?.currentSequence
pauseRecording()
room.stateService().sendStateEvent(
@ -63,7 +64,7 @@ class PauseVoiceBroadcastUseCase @Inject constructor(
body = MessageVoiceBroadcastInfoContent(
relatesTo = reference,
voiceBroadcastStateStr = VoiceBroadcastState.PAUSED.value,
lastChunkSequence = voiceBroadcastRecorder?.currentSequence,
lastChunkSequence = lastSequence,
).toContent(),
)
}

View File

@ -55,7 +55,8 @@ class StopVoiceBroadcastUseCase @Inject constructor(
private suspend fun stopVoiceBroadcast(room: Room, reference: RelationDefaultContent?) {
Timber.d("## StopVoiceBroadcastUseCase: Send new voice broadcast info state event")
// Immediately stop the recording
// save the last sequence number and immediately stop the recording
val lastSequence = voiceBroadcastRecorder?.currentSequence
stopRecording()
room.stateService().sendStateEvent(
@ -64,7 +65,7 @@ class StopVoiceBroadcastUseCase @Inject constructor(
body = MessageVoiceBroadcastInfoContent(
relatesTo = reference,
voiceBroadcastStateStr = VoiceBroadcastState.STOPPED.value,
lastChunkSequence = voiceBroadcastRecorder?.currentSequence,
lastChunkSequence = lastSequence,
).toContent(),
)
}