[Android] NEXT/PREV don't stop for singleton playlist
Geoffrey Métais
git at videolan.org
Wed Sep 2 17:11:15 CEST 2015
vlc-ports/android | branch: data-binding | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Sep 2 11:37:42 2015 +0200| [fdb7e771439faacb500a1996ac8cb713d1d04e2b] | committer: Geoffrey Métais
NEXT/PREV don't stop for singleton playlist
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=fdb7e771439faacb500a1996ac8cb713d1d04e2b
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index cc77e5c..16f4f8f 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1133,10 +1133,14 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
@MainThread
public void next() {
+ int size = mMediaList.size();
+ if (size == 1){
+ setPosition(0f);
+ return;
+ }
+
mPrevious.push(mCurrentIndex);
mCurrentIndex = mNextIndex;
-
- int size = mMediaList.size();
if (size == 0 || mCurrentIndex < 0 || mCurrentIndex >= size) {
if (mCurrentIndex < 0)
saveCurrentMedia();
@@ -1151,11 +1155,14 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
@MainThread
public void previous() {
+ int size = mMediaList.size();
+ if (size == 1){
+ setPosition(0f);
+ return;
+ }
mCurrentIndex = mPrevIndex;
if (mPrevious.size() > 0)
mPrevious.pop();
-
- int size = mMediaList.size();
if (size == 0 || mPrevIndex < 0 || mCurrentIndex >= size) {
Log.w(TAG, "Warning: invalid previous index, aborted !");
stop();
More information about the Android
mailing list