[Android] Fix updates of audio players during playback

Sébastien Toque git at videolan.org
Sat Sep 28 22:46:28 CEST 2013


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sat Sep 28 22:23:06 2013 +0200| [8d537ba90af410eaa9722735097a6f6bab239cde] | committer: Sébastien Toque

Fix updates of audio players during playback

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=8d537ba90af410eaa9722735097a6f6bab239cde
---

 vlc-android/src/org/videolan/vlc/AudioService.java           |    5 ++++-
 vlc-android/src/org/videolan/vlc/AudioServiceController.java |    6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 5645913..dd6e9ca 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -888,7 +888,8 @@ public class AudioService extends Service {
             if (count == null)
                 count = 0;
             mCallback.put(cb, count + 1);
-            mHandler.sendEmptyMessage(SHOW_PROGRESS);
+            if (hasCurrentMedia())
+                mHandler.sendEmptyMessage(SHOW_PROGRESS);
         }
 
         @Override
@@ -965,6 +966,7 @@ public class AudioService extends Service {
             mLibVLC.getMediaList().getEventHandler().addHandler(mListEventHandler);
 
             mLibVLC.playIndex(mCurrentIndex);
+            mHandler.sendEmptyMessage(SHOW_PROGRESS);
             setUpRemoteControlClient();
             showNotification();
             updateWidget(AudioService.this);
@@ -990,6 +992,7 @@ public class AudioService extends Service {
 
             mEventHandler.addHandler(mVlcEventHandler);
             mLibVLC.playIndex(mCurrentIndex);
+            mHandler.sendEmptyMessage(SHOW_PROGRESS);
             setUpRemoteControlClient();
             showNotification();
             updateWidget(AudioService.this);
diff --git a/vlc-android/src/org/videolan/vlc/AudioServiceController.java b/vlc-android/src/org/videolan/vlc/AudioServiceController.java
index 2e0779a..5b499f9 100644
--- a/vlc-android/src/org/videolan/vlc/AudioServiceController.java
+++ b/vlc-android/src/org/videolan/vlc/AudioServiceController.java
@@ -148,7 +148,8 @@ public class AudioServiceController implements IAudioPlayerControl {
      * @param ap
      */
     public void addAudioPlayer(IAudioPlayer ap) {
-        mAudioPlayer.add(ap);
+        if (!mAudioPlayer.contains(ap))
+            mAudioPlayer.add(ap);
     }
 
     /**
@@ -156,9 +157,8 @@ public class AudioServiceController implements IAudioPlayerControl {
      * @param ap
      */
     public void removeAudioPlayer(IAudioPlayer ap) {
-        if (mAudioPlayer.contains(ap)) {
+        if (mAudioPlayer.contains(ap))
             mAudioPlayer.remove(ap);
-        }
     }
 
     /**



More information about the Android mailing list