[Android] Stop playback service when not used
Geoffrey Métais
git at videolan.org
Thu Nov 19 16:55:36 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 19 11:22:00 2015 +0100| [f51a2017e415c28d81eb540f148672c01d951b42] | committer: Geoffrey Métais
Stop playback service when not used
Happens when user leaves app and vlc is not playing
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=f51a2017e415c28d81eb540f148672c01d951b42
---
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();
}
More information about the Android
mailing list