[Android] Don't start audio player for background video

Geoffrey Métais git at videolan.org
Thu Jul 16 18:26:42 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jul 16 17:57:51 2015 +0200| [d24828b845fe07d7f91b8991a354418cb45eceb9] | committer: Geoffrey Métais

Don't start audio player for background video

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d24828b845fe07d7f91b8991a354418cb45eceb9
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java          |    2 +-
 vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 391dd95..ae3713f 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -767,7 +767,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
     }
 
 
-    private boolean canSwitchToVideo() {
+    public boolean canSwitchToVideo() {
         return hasCurrentMedia() && mMediaPlayer.getVideoTracksCount() > 0;
     }
 
diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index b3791bf..4defe35 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -140,8 +140,9 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
         /*
          * skip browser and show directly Audio Player if a song is playing
          */
-        if (mService.isPlaying()) {
-            startActivity(new Intent(this, AudioPlayerActivity.class));
+        if (service.isPlaying()) {
+            if (!service.canSwitchToVideo())
+                startActivity(new Intent(this, AudioPlayerActivity.class));
             finish();
         }
     }



More information about the Android mailing list