[Android] Show notification while casting

Geoffrey Métais git at videolan.org
Mon Jan 29 16:47:44 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jan 29 16:44:49 2018 +0100| [661fee01af8c4caa186ca8d128438b12fab72b24] | committer: Geoffrey Métais

Show notification while casting

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

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

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index d961967d4..e808e7084 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -497,10 +497,13 @@ public class PlaybackService extends MediaBrowserServiceCompat{
                     mHandler.sendEmptyMessage(SHOW_PROGRESS);
                     changeAudioFocus(true);
                     if (!mWakeLock.isHeld()) mWakeLock.acquire();
-                    if (!mKeyguardManager.inKeyguardRestrictedInputMode() && !playlistManager.getVideoBackground() && playlistManager.switchToVideo()) {
+                    if (!mKeyguardManager.inKeyguardRestrictedInputMode()
+                            && !playlistManager.getVideoBackground()
+                            && !hasRenderer()
+                            && playlistManager.switchToVideo()) {
                         hideNotification();
                     } else {
-                        showPlayer();
+                        if (!hasRenderer()) showPlayer();
                         showNotification();
                     }
                     break;
diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index d7ee8d4b9..496c2745c 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -292,8 +292,9 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
         val media = getCurrentMedia()
         if (media === null || media.hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO) || !player.canSwitchToVideo())
             return false
+        val hasRenderer = RendererDelegate.selectedRenderer !== null
         videoBackground = false
-        if (player.isVideoPlaying()) {//Player is already running, just send it an intent
+        if (player.isVideoPlaying() && !hasRenderer) {//Player is already running, just send it an intent
             player.setVideoTrackEnabled(true)
             LocalBroadcastManager.getInstance(service).sendBroadcast(
                     VideoPlayerActivity.getIntent(Constants.PLAY_FROM_SERVICE,
@@ -301,7 +302,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
         } else if (!player.switchToVideo) {//Start the video player
             VideoPlayerActivity.startOpened(VLCApplication.getAppContext(),
                     media.uri, currentIndex)
-            player.switchToVideo = true
+            if (!hasRenderer) player.switchToVideo = true
         }
         return true
     }



More information about the Android mailing list