[Android] Set slaves after playback start

Geoffrey Métais git at videolan.org
Mon Jun 11 11:38:22 CEST 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jun 11 11:37:57 2018 +0200| [279192c6352c64357830d057a2cf9ad5d6d92410] | committer: Geoffrey Métais

Set slaves after playback start

> https://code.videolan.org/videolan/vlc-android/commit/279192c6352c64357830d057a2cf9ad5d6d92410
---

 vlc-android/src/org/videolan/vlc/media/PlayerController.kt | 3 ++-
 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt  | 3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
index c347f439b..2f079b3f3 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -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)
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index d87f0af44..708672a01 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -271,9 +271,8 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                     }
                 }
                 media.setEventListener(this at 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)



More information about the Android mailing list