[Android] AudioService: fix video stream playback
Edward Wang
git at videolan.org
Tue Aug 13 15:16:09 CEST 2013
vlc-ports/android | branch: 0.1.x-bugfix | Edward Wang <edward.c.wang at compdigitec.com> | Mon Aug 12 16:23:25 2013 -0400| [3a2b2935aa555ae70095f2bf91c040ca223ca377] | committer: Edward Wang
AudioService: fix video stream playback
Fix regression from 02ee423e8b11263f90f11a47bba3ebb46cee3457 where hiding the notification kills the stream.
(cherry picked from commit e16fa987db85bfec6d0226ad5d9d384ea7c27b65)
Signed-off-by: Edward Wang <edward.c.wang at compdigitec.com>
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=3a2b2935aa555ae70095f2bf91c040ca223ca377
---
vlc-android/src/org/videolan/vlc/AudioService.java | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 72b117a..42e03f9 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -470,7 +470,8 @@ public class AudioService extends Service {
private void handleVout() {
Log.i(TAG, "Obtained video track");
mMediaList.clear();
- hideNotification();
+ // Preserve playback when switching to video
+ hideNotification(false);
// Don't crash if user stopped the media
if(mCurrentMedia == null) return;
@@ -605,8 +606,18 @@ public class AudioService extends Service {
}
private void hideNotification() {
+ hideNotification(true);
+ }
+
+ /**
+ * Hides the VLC notification and stops the service.
+ *
+ * @param stopPlayback True to also stop playback at the same time. Set to false to preserve playback (e.g. for vout events)
+ */
+ private void hideNotification(boolean stopPlayback) {
stopForeground(true);
- stopSelf();
+ if(stopPlayback)
+ stopSelf();
}
private void pause() {
More information about the Android
mailing list