mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-18 04:08:44 +03:00
VoiceBroadcastRecorder - Send last sequence number on pause and stop
This commit is contained in:
parent
99a2afa5ee
commit
bafa2f8bde
5 changed files with 6 additions and 1 deletions
|
@ -23,6 +23,7 @@ import java.io.File
|
|||
interface VoiceBroadcastRecorder : VoiceRecorder {
|
||||
|
||||
var listener: Listener?
|
||||
var currentSequence: Int
|
||||
|
||||
fun startRecord(roomId: String, chunkLength: Int)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -59,6 +59,7 @@ class PauseVoiceBroadcastUseCase @Inject constructor(
|
|||
body = MessageVoiceBroadcastInfoContent(
|
||||
relatesTo = reference,
|
||||
voiceBroadcastStateStr = VoiceBroadcastState.PAUSED.value,
|
||||
lastChunkSequence = voiceBroadcastRecorder?.currentSequence,
|
||||
).toContent(),
|
||||
)
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ class StopVoiceBroadcastUseCase @Inject constructor(
|
|||
body = MessageVoiceBroadcastInfoContent(
|
||||
relatesTo = reference,
|
||||
voiceBroadcastStateStr = VoiceBroadcastState.STOPPED.value,
|
||||
lastChunkSequence = voiceBroadcastRecorder?.currentSequence,
|
||||
).toContent(),
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue