[Android] PlayerController: add hasRenderer variable

Geoffrey Métais git at videolan.org
Wed Jan 31 15:36:51 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan 31 15:25:20 2018 +0100| [efbe789d49a20f34a2edcade40f6cd1b76341c9f] | committer: Geoffrey Métais

PlayerController: add hasRenderer variable

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java      | 4 ++--
 vlc-android/src/org/videolan/vlc/media/PlayerController.kt | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index aa2b37a7d..bc8d990a2 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1764,12 +1764,12 @@ public class PlaybackService extends MediaBrowserServiceCompat{
     }
 
     @MainThread
-    public int setRenderer(RendererItem item) {
+    public void setRenderer(RendererItem item) {
         final boolean wasOnRenderer = mOnRenderer;
         mOnRenderer = item != null;
         if (wasOnRenderer && !mOnRenderer && canSwitchToVideo()) VideoPlayerActivity.startOpened(VLCApplication.getAppContext(),
                 playlistManager.getCurrentMedia().getUri(), playlistManager.getCurrentIndex());
-        return playlistManager.getPlayer().setRenderer(item);
+        playlistManager.getPlayer().setRenderer(item);
     }
 
     @MainThread
diff --git a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
index c24bd931b..623f5aead 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -33,6 +33,8 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
         private set
     @Volatile var playbackState = PlaybackStateCompat.STATE_STOPPED
         private set
+    @Volatile var hasRenderer = false
+        private set
 
     fun getVout() = mediaplayer.vlcVout
 
@@ -153,7 +155,10 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
         mediaplayer.aspectRatio = aspect
     }
 
-    fun setRenderer(renderer: RendererItem?) = mediaplayer.setRenderer(renderer)
+    fun setRenderer(renderer: RendererItem?) {
+        mediaplayer.setRenderer(renderer)
+        hasRenderer = renderer !== null
+    }
 
     fun release(player: MediaPlayer = mediaplayer) {
         player.setEventListener(null)



More information about the Android mailing list