[Android] PlaybackService: update Metas when they change

Thomas Guillem git at videolan.org
Mon Nov 2 11:38:07 CET 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Nov  2 11:37:40 2015 +0100| [3c0cc2e375f4242a6a13db379908d800ab6af530] | committer: Thomas Guillem

PlaybackService: update Metas when they change

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index e54d56a..050c3c5 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -123,6 +123,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
     private final IBinder mBinder = new LocalBinder();
     private MediaWrapperList mMediaList = new MediaWrapperList();
     private MediaPlayer mMediaPlayer;
+    private boolean mParsed = false;
     private boolean mSeekable = false;
     private boolean mPausable = false;
     private boolean mIsAudioTrack = false;
@@ -571,15 +572,21 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
         @Override
         public void onEvent(Media.Event event) {
             switch (event.type) {
+                case Media.Event.MetaChanged:
+                    /* Update Meta if file is already parsed */
+                    if (!mParsed)
+                        break;
+                    Log.i(TAG, "Media.Event.MetaChanged: " + event.getMetaId());
+
                 case Media.Event.ParsedChanged:
                     Log.i(TAG, "Media.Event.ParsedChanged");
                     final MediaWrapper mw = getCurrentMedia();
                     if (mw != null)
                         mw.updateMeta(mMediaPlayer);
                     executeUpdate();
+                    mParsed = true;
                     break;
-                case Media.Event.MetaChanged:
-                    break;
+
             }
             for (Callback callback : mCallbacks)
                 callback.onMediaEvent(event);
@@ -1628,6 +1635,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
             return;
 
         /* Pausable and seekable are true by default */
+        mParsed = false;
         mPausable = mSeekable = true;
         final Media media = new Media(VLCInstance.get(), mw.getUri());
         VLCOptions.setMediaOptions(media, this, flags | mw.getFlags());



More information about the Android mailing list