[Android] Better transitions & start of first video in a list

Geoffrey Métais git at videolan.org
Fri Nov 27 17:07:28 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 26 18:03:22 2015 +0100| [10073cb01cd3a64f76af90c30818b4e37bf8e163] | committer: Geoffrey Métais

Better transitions & start of first video in a list

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java          |    8 +++++++-
 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java    |    7 +++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 455f6e9..e96253a 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1559,7 +1559,13 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
         // Add handler after loading the list
         mMediaList.addEventListener(mListEventListener);
 
-        playIndex(mCurrentIndex, 0);
+        MediaWrapper mw = mMediaList.getMedia(mCurrentIndex);
+        if (mw .getType() != MediaWrapper.TYPE_VIDEO || mw.hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO) || isVideoPlaying())
+            playIndex(mCurrentIndex, 0);
+        else {//Start VideoPlayer for first video, it will trigger playIndex when ready.
+            VideoPlayerActivity.startOpened(VLCApplication.getAppContext(),
+                    getCurrentMediaWrapper().getUri(), mCurrentIndex);
+        }
         saveMediaList();
         onMediaChanged();
     }
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 63728eb..6be66f8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -527,6 +527,9 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             if (uri == null || uri.equals(mUri))
                 return;
             initUI();
+            setOverlayProgress();
+            updateSeekable(mService.isSeekable());
+            updatePausable(mService.isPausable());
             mTitle.setText(mService.getCurrentMediaWrapper().getTitle());
         }
     }
@@ -678,7 +681,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mPlaybackStarted = true;
 
         final IVLCVout vlcVout = mService.getVLCVout();
-//        vlcVout.detachViews();
         if (mPresentation == null) {
             vlcVout.setVideoView(mSurfaceView);
             if (mSubtitlesSurfaceView.getVisibility() != View.GONE)
@@ -915,7 +917,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     @NonNull
     public static Intent getIntent(String action, Context context, Uri uri, String title, boolean fromStart, int openedPosition) {
         Intent intent = new Intent(context, VideoPlayerActivity.class);
-        intent.setAction(PLAY_FROM_VIDEOGRID);
+        intent.setAction(action);
         intent.putExtra(PLAY_EXTRA_ITEM_LOCATION, uri);
         intent.putExtra(PLAY_EXTRA_ITEM_TITLE, title);
         intent.putExtra(PLAY_EXTRA_FROM_START, fromStart);
@@ -2821,6 +2823,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 if (intentPosition > 0 && mediaLength >= 0l)
                     seek(intentPosition, mediaLength);
             } else {
+                mService.getCurrentMediaWrapper().addFlags(MediaWrapper.MEDIA_VIDEO);
                 mService.addCallback(this);
                 // AudioService-transitioned playback for item after sleep and resume
                 if(!mService.isPlaying())



More information about the Android mailing list