mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 19:31:12 +00:00
Fix restoration of playing state after orientation change
This commit is contained in:
parent
af9437ff7d
commit
76c883fb8b
1 changed files with 3 additions and 3 deletions
|
@ -131,16 +131,16 @@ public class Tutorial1 extends Activity implements SurfaceHolder.Callback, OnSee
|
||||||
if (mediaUri.startsWith("file://")) is_local_media = true;
|
if (mediaUri.startsWith("file://")) is_local_media = true;
|
||||||
|
|
||||||
if (initialization_data != null) {
|
if (initialization_data != null) {
|
||||||
boolean should_play = initialization_data.getBoolean("playing");
|
is_playing_desired = initialization_data.getBoolean("playing");
|
||||||
int milliseconds = initialization_data.getInt("position");
|
int milliseconds = initialization_data.getInt("position");
|
||||||
Log.i ("GStreamer", "Restoring state, playing:" + should_play + " position:" + milliseconds + " ms.");
|
Log.i ("GStreamer", "Restoring state, playing:" + is_playing_desired + " position:" + milliseconds + " ms.");
|
||||||
/* Actually, move to one millisecond in the future. Otherwise, due to rounding errors between the
|
/* Actually, move to one millisecond in the future. Otherwise, due to rounding errors between the
|
||||||
* milliseconds used here and the nanoseconds used by GStreamer, we would be jumping a bit behind
|
* milliseconds used here and the nanoseconds used by GStreamer, we would be jumping a bit behind
|
||||||
* where we were before. This, combined with seeking to keyframe positions, would skip one keyframe
|
* where we were before. This, combined with seeking to keyframe positions, would skip one keyframe
|
||||||
* backwards on each iteration.
|
* backwards on each iteration.
|
||||||
*/
|
*/
|
||||||
nativeSetPosition(milliseconds + 1);
|
nativeSetPosition(milliseconds + 1);
|
||||||
if (should_play) {
|
if (is_playing_desired) {
|
||||||
nativePlay();
|
nativePlay();
|
||||||
} else {
|
} else {
|
||||||
nativePause();
|
nativePause();
|
||||||
|
|
Loading…
Reference in a new issue