VoiceBroadcastRecorder - Send last sequence number on pause and stop

This commit is contained in:
Florian Renaud 2022-10-20 13:43:50 +02:00
parent 99a2afa5ee
commit bafa2f8bde
5 changed files with 6 additions and 1 deletions

View file

@ -23,6 +23,7 @@ import java.io.File
interface VoiceBroadcastRecorder : VoiceRecorder {
var listener: Listener?
var currentSequence: Int
fun startRecord(roomId: String, chunkLength: Int)

View file

@ -30,8 +30,8 @@ class VoiceBroadcastRecorderQ(
) : AbstractVoiceRecorderQ(context), VoiceBroadcastRecorder {
private var maxFileSize = 0L // zero or negative for no limit
private var currentSequence = 0
private var currentRoomId: String? = null
override var currentSequence = 0
override var listener: VoiceBroadcastRecorder.Listener? = null

View file

@ -44,6 +44,8 @@ data class MessageVoiceBroadcastInfoContent(
@Json(name = "state") val voiceBroadcastStateStr: String = "",
/** The length of the voice chunks in seconds. **/
@Json(name = "chunk_length") val chunkLength: Int? = null,
/** The sequence of the last sent chunk. **/
@Json(name = "last_chunk_sequence") val lastChunkSequence: Int? = null,
) : MessageContent {
val voiceBroadcastState: VoiceBroadcastState? = VoiceBroadcastState.values()

View file

@ -59,6 +59,7 @@ class PauseVoiceBroadcastUseCase @Inject constructor(
body = MessageVoiceBroadcastInfoContent(
relatesTo = reference,
voiceBroadcastStateStr = VoiceBroadcastState.PAUSED.value,
lastChunkSequence = voiceBroadcastRecorder?.currentSequence,
).toContent(),
)

View file

@ -60,6 +60,7 @@ class StopVoiceBroadcastUseCase @Inject constructor(
body = MessageVoiceBroadcastInfoContent(
relatesTo = reference,
voiceBroadcastStateStr = VoiceBroadcastState.STOPPED.value,
lastChunkSequence = voiceBroadcastRecorder?.currentSequence,
).toContent(),
)