Commit 279192c6 authored by Geoffrey Métais's avatar Geoffrey Métais

Set slaves after playback start

parent c77c3823
......@@ -180,7 +180,7 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
setPlaybackStopped()
}
suspend fun setSlaves(media: Media, mw: MediaWrapper) {
fun setSlaves(media: Media, mw: MediaWrapper) = launch(UI, CoroutineStart.UNDISPATCHED) {
val list = withContext(CommonPool) {
mw.slaves?.let {
for (slave in it) media.addSlave(slave)
......@@ -188,6 +188,7 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
}
MediaDatabase.getInstance().getSlaves(mw.location)
}
media.release()
for (slave in list) mediaplayer.addSlave(slave.type, Uri.parse(slave.uri), false)
}
......
......@@ -271,9 +271,8 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
}
}
media.setEventListener(this@PlaylistManager)
player.setSlaves(media, mw)
player.startPlayback(media, mediaplayerEventListener)
media.release()
player.setSlaves(media, mw)
if (savedTime <= 0L && mw.time >= 0L && mw.isPodcast) savedTime = mw.time
determinePrevAndNextIndices()
service.onNewPlayback(mw)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment