[Android] Go back to playlist start when end is reached
Geoffrey Métais
git at videolan.org
Mon Feb 16 12:18:31 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb 16 12:16:41 2015 +0100| [f351b1b54c8888864d3fa11bc15020f0d6e6dc98] | committer: Geoffrey Métais
Go back to playlist start when end is reached
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=f351b1b54c8888864d3fa11bc15020f0d6e6dc98
---
vlc-android/src/org/videolan/vlc/audio/AudioService.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
index d39b345..a015768 100644
--- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
@@ -895,6 +895,8 @@ public class AudioService extends Service {
int size = mMediaListPlayer.getMediaList().size();
if (size == 0 || mCurrentIndex < 0 || mCurrentIndex >= size) {
+ if (mCurrentIndex < 0)
+ saveCurrentMedia();
Log.w(TAG, "Warning: invalid next index, aborted !");
stop();
return;
@@ -1481,7 +1483,7 @@ public class AudioService extends Service {
private synchronized void saveCurrentMedia() {
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
- editor.putString("current_media", mMediaListPlayer.getMediaList().getMRL(mCurrentIndex));
+ editor.putString("current_media", mMediaListPlayer.getMediaList().getMRL(Math.max(mCurrentIndex, 0)));
editor.putBoolean("shuffling", mShuffling);
editor.putInt("repeating", mRepeating.ordinal());
Util.commitPreferences(editor);
More information about the Android
mailing list