[Android] Save and restore user video playback speed
Alexandre Perraud
git at videolan.org
Wed Mar 18 18:35:36 CET 2015
vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Wed Mar 18 18:12:11 2015 +0100| [5af8cc79795c8b5694b2be525310c25ef2e5889a] | committer: Alexandre Perraud
Save and restore user video playback speed
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=5af8cc79795c8b5694b2be525310c25ef2e5889a
---
vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java | 1 +
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
index a99689c..992d3fa 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
@@ -72,6 +72,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
public final static String VIDEO_PAUSED = "VideoPaused";
public final static String VIDEO_SUBTITLE_FILES = "VideoSubtitleFiles";
public final static String VIDEO_LAST = "VideoLastPlayed";
+ public final static String VIDEO_SPEED = "VideoSpeed";
public final static int RESULT_RESCAN = RESULT_FIRST_USER + 1;
public final static int RESULT_RESTART = RESULT_FIRST_USER + 2;
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 f5f4645..8b15891 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -673,6 +673,9 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
}
}
+ // Set user playback speed
+ mLibVLC.setRate(mSettings.getFloat(PreferencesActivity.VIDEO_SPEED, 1));
+
}
private void stopPlayback() {
@@ -711,7 +714,6 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
time = 0;
else
time -= 5000; // go back 5 seconds, to compensate loading time
-
mLibVLC.stop();
SharedPreferences.Editor editor = mSettings.edit();
@@ -746,6 +748,10 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
editor.putString(PreferencesActivity.VIDEO_LAST, Uri.encode(mLocation));
+ // Save user playback speed and restore normal speed
+ editor.putFloat(PreferencesActivity.VIDEO_SPEED, mLibVLC.getRate());
+ mLibVLC.setRate(1);
+
Util.commitPreferences(editor);
// MediaCodec opaque direct rendering should not be used anymore since there is no surface to attach.
More information about the Android
mailing list