Skip to content

Commit

Permalink
VB - Stop listening if we reach the last received chunk and there is …
Browse files Browse the repository at this point in the history
…no last sequence number
  • Loading branch information
Florian Renaud committed Jan 5, 2023
1 parent e396f6c commit 682bb8b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
// Next media player is already attached to this player and will start playing automatically
if (nextMediaPlayer != null) return

val hasEnded = !isLiveListening && mostRecentVoiceBroadcastEvent?.content?.lastChunkSequence == playlist.currentSequence
val currentSequence = playlist.currentSequence ?: 0
val lastChunkSequence = mostRecentVoiceBroadcastEvent?.content?.lastChunkSequence ?: 0
val hasEnded = !isLiveListening && currentSequence >= lastChunkSequence
if (hasEnded) {
// We'll not receive new chunks anymore so we can stop the live listening
stop()
Expand Down

0 comments on commit 682bb8b

Please sign in to comment.