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 { ...@@ -180,7 +180,7 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
setPlaybackStopped() setPlaybackStopped()
} }
suspend fun setSlaves(media: Media, mw: MediaWrapper) { fun setSlaves(media: Media, mw: MediaWrapper) = launch(UI, CoroutineStart.UNDISPATCHED) {
val list = withContext(CommonPool) { val list = withContext(CommonPool) {
mw.slaves?.let { mw.slaves?.let {
for (slave in it) media.addSlave(slave) for (slave in it) media.addSlave(slave)
...@@ -188,6 +188,7 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener { ...@@ -188,6 +188,7 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
} }
MediaDatabase.getInstance().getSlaves(mw.location) MediaDatabase.getInstance().getSlaves(mw.location)
} }
media.release()
for (slave in list) mediaplayer.addSlave(slave.type, Uri.parse(slave.uri), false) for (slave in list) mediaplayer.addSlave(slave.type, Uri.parse(slave.uri), false)
} }
......
...@@ -271,9 +271,8 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList ...@@ -271,9 +271,8 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
} }
} }
media.setEventListener(this@PlaylistManager) media.setEventListener(this@PlaylistManager)
player.setSlaves(media, mw)
player.startPlayback(media, mediaplayerEventListener) player.startPlayback(media, mediaplayerEventListener)
media.release() player.setSlaves(media, mw)
if (savedTime <= 0L && mw.time >= 0L && mw.isPodcast) savedTime = mw.time if (savedTime <= 0L && mw.time >= 0L && mw.isPodcast) savedTime = mw.time
determinePrevAndNextIndices() determinePrevAndNextIndices()
service.onNewPlayback(mw) 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