[Android] VideoPlayerActivity: fix resume after vout transition
Edward Wang
git at videolan.org
Thu Aug 29 19:12:52 CEST 2013
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Aug 29 19:12:36 2013 +0200| [42dac2d70336ecd3efa3e86b80d1d7797aea8bf1] | committer: Edward Wang
VideoPlayerActivity: fix resume after vout transition
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=42dac2d70336ecd3efa3e86b80d1d7797aea8bf1
---
vlc-android/src/org/videolan/vlc/AudioService.java | 1 +
vlc-android/src/org/videolan/vlc/MediaDatabase.java | 7 ++++++-
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 5 +++++
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 9f66ebf..f145fb9 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -465,6 +465,7 @@ public class AudioService extends Service {
int index = mCurrentIndex;
mMetadataCache.clear();
mCurrentIndex = -1;
+ mEventHandler.removeHandler(mVlcEventHandler);
// Preserve playback when switching to video
hideNotification(false);
diff --git a/vlc-android/src/org/videolan/vlc/MediaDatabase.java b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
index 0bc505e..8b98954 100644
--- a/vlc-android/src/org/videolan/vlc/MediaDatabase.java
+++ b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
@@ -438,7 +438,8 @@ public class MediaDatabase {
Cursor cursor;
Media media = null;
- cursor = mDb.query(
+ try {
+ cursor = mDb.query(
MEDIA_TABLE_NAME,
new String[] {
MEDIA_TIME, //0 long
@@ -457,6 +458,10 @@ public class MediaDatabase {
MEDIA_LOCATION + "=?",
new String[] { location },
null, null, null);
+ } catch(IllegalArgumentException e) {
+ // java.lang.IllegalArgumentException: the bind value at index 1 is null
+ return null;
+ }
if (cursor.moveToFirst()) {
media = new Media(context, location,
cursor.getLong(0),
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 d3b3d86..209428e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1492,6 +1492,11 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
// Provided externally from AudioService
Log.d(TAG, "Continuing playback from AudioService at index " + itemPosition);
savedIndexPosition = itemPosition;
+ if(!mLibVLC.isPlaying()) {
+ // AudioService-transitioned playback for item after sleep and resme
+ mLibVLC.playIndex(savedIndexPosition);
+ dontParse = false;
+ }
} else if (savedIndexPosition > -1) {
mLibVLC.setMediaList();
mLibVLC.playIndex(savedIndexPosition);
More information about the Android
mailing list