[Android] NEXT/PREV don't stop for singleton playlist
Geoffrey Métais
git at videolan.org
Wed Sep 2 14:45:26 CEST 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Sep 2 11:37:42 2015 +0200| [f5fac2028eb5242d3e071e93a7526abc73a1933f] | 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=f5fac2028eb5242d3e071e93a7526abc73a1933f
---
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