[Android] Avoid unnecessary pause() calls
Geoffrey Métais
git at videolan.org
Wed Mar 9 14:44:32 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 9 14:42:58 2016 +0100| [b51996386bffcd07a05473a9beda6689e68b4d3e] | committer: Geoffrey Métais
Avoid unnecessary pause() calls
> https://code.videolan.org/videolan/vlc-android/commit/b51996386bffcd07a05473a9beda6689e68b4d3e
---
libvlc/src/org/videolan/libvlc/media/MediaPlayer.java | 4 ++--
vlc-android/src/org/videolan/vlc/PlaybackService.java | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libvlc/src/org/videolan/libvlc/media/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/media/MediaPlayer.java
index a5ca1c5..9cc527b 100644
--- a/libvlc/src/org/videolan/libvlc/media/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/media/MediaPlayer.java
@@ -157,8 +157,8 @@ public class MediaPlayer
}
public void pause() throws IllegalStateException {
- // FIXME, this is toggling for now.
- mMediaPlayer.pause();
+ if (mMediaPlayer.isPlaying())
+ mMediaPlayer.pause(); // FIXME, this is toggling for now.
}
public void setWakeMode(Context context, int mode) {
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 308a1a2..09bb3fe 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -361,7 +361,8 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
Log.i(TAG, "AUDIOFOCUS_LOSS");
// Pause playback
changeAudioFocus(false);
- pause();
+ if (isPlaying())
+ pause();
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
Log.i(TAG, "AUDIOFOCUS_LOSS_TRANSIENT");
More information about the Android
mailing list