Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix queue not advancing #4030

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions playback/core/src/main/kotlin/queue/QueueService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import org.jellyfin.playback.core.PlaybackManager
import org.jellyfin.playback.core.backend.PlayerBackendEventListener
import org.jellyfin.playback.core.mediastream.PlayableMediaStream
import org.jellyfin.playback.core.model.PlayState
import org.jellyfin.playback.core.model.PlaybackOrder
import org.jellyfin.playback.core.model.RepeatMode
import org.jellyfin.playback.core.plugin.PlayerService
Expand Down Expand Up @@ -44,6 +47,17 @@ class QueueService internal constructor() : PlayerService(), Queue {
PlaybackOrder.SHUFFLE -> ShuffleOrderIndexProvider()
}
}.launchIn(coroutineScope)

// Automatically advance when current stream ends
manager.backendService.addListener(object : PlayerBackendEventListener {
override fun onPlayStateChange(state: PlayState) = Unit
override fun onVideoSizeChange(width: Int, height: Int) = Unit
override fun onMediaStreamEnd(mediaStream: PlayableMediaStream) {
coroutineScope.launch {
next(usePlaybackOrder = true, useRepeatMode = true)
}
}
})
}

// Entry management
Expand Down
Loading