[Android] Skip background playback if media has no audio

Geoffrey Métais git at videolan.org
Wed Sep 27 12:13:21 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Sep 27 12:06:40 2017 +0200| [19cc8771a5c362d2a634486895f861a27e5e3777] | committer: Geoffrey Métais

Skip background playback if media has no audio

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 841ddcfa9..14a01e2ca 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1991,7 +1991,9 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
         mMediaPlayer.setMedia(media);
         media.release();
 
-        if (mw .getType() != MediaWrapper.TYPE_VIDEO || isVideoPlaying || mw.hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO)) {
+        if (mw.hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO) && mMediaPlayer.getAudioTracksCount() == 0)
+            next();
+        else if (mw .getType() != MediaWrapper.TYPE_VIDEO || isVideoPlaying || mw.hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO)) {
             mMediaPlayer.setEqualizer(VLCOptions.getEqualizerSetFromSettings(this));
             mMediaPlayer.setVideoTitleDisplay(MediaPlayer.Position.Disable, 0);
             changeAudioFocus(true);



More information about the Android mailing list