[Android] Fix 'load as audio' feature

Geoffrey Métais git at videolan.org
Thu Dec 3 17:50:44 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec  3 17:39:56 2015 +0100| [45e2f6812008c639659cb1fc1cb5168bd9398698] | committer: Geoffrey Métais

Fix 'load as audio' feature

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java       |    3 ++-
 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java |    1 +
 2 files 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 f6e3c19..830bd11 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -485,6 +485,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
             } else if (action.equalsIgnoreCase(ACTION_REMOTE_LAST_VIDEO_PLAYLIST)) {
                 loadLastPlaylist(TYPE_VIDEO);
             } else if (action.equalsIgnoreCase(ACTION_REMOTE_SWITCH_VIDEO)) {
+                getCurrentMediaWrapper().removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
                 switchToVideo();
             } else if (action.equalsIgnoreCase(VLCAppWidgetProvider.ACTION_WIDGET_INIT)) {
                 updateWidget();
@@ -733,7 +734,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
 
     @MainThread
     public boolean switchToVideo() {
-        if (!canSwitchToVideo())
+        if (mMediaList.getMedia(mCurrentIndex).hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO) || !canSwitchToVideo())
             return false;
         if (isVideoPlaying()) {//Player is already running, just send it an intent
             mMediaPlayer.setVideoTrackEnabled(true);
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index cae4046..8bb9d3e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -174,6 +174,7 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
             @Override
             public void onClick(View v) {
                 if (mService != null) {
+                    mService.getCurrentMediaWrapper().removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
                     mService.switchToVideo();
                 }
             }



More information about the Android mailing list