[Android] [PATCH] Stop playback service when not used
Geoffrey Métais
geoffrey.metais at gmail.com
Thu Nov 19 11:24:15 CET 2015
Happens when user leaves app and vlc is not playing
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index d0f2127..2a5dce1 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -309,12 +309,18 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
}
}
-
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
+ @Override
+ public boolean onUnbind(Intent intent) {
+ if (!isPlaying())
+ stopSelf();
+ return true;
+ }
+
public IVLCVout getVLCVout() {
return mMediaPlayer.getVLCVout();
}
--
2.5.0
More information about the Android
mailing list