OSDN Git Service

Make play() call next() if we are at end of track (and not REPEAT_CURRENT).
authorThomas Tuttle <thinkinginbinary@gmail.com>
Thu, 29 Jan 2009 02:06:46 +0000 (21:06 -0500)
committerMike Lockwood <lockwood@android.com>
Wed, 3 Jun 2009 18:43:55 +0000 (11:43 -0700)
Signed-off-by: Mike Lockwood <lockwood@android.com>
src/com/android/music/MediaPlaybackService.java

index 053e611..6edb4dc 100644 (file)
@@ -984,6 +984,12 @@ public class MediaPlaybackService extends Service {
      */
     public void play() {
         if (mPlayer.isInitialized()) {
+            // if we are at the end of the song, go to the next song first
+            if (mRepeatMode != REPEAT_CURRENT &&
+                mPlayer.position() >= mPlayer.duration() - 2000) {
+                next(true);
+            }
+
             mPlayer.start();
             setForeground(true);