Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-Android
Commits
6f2f9491
Commit
6f2f9491
authored
Jan 05, 2015
by
Edward Wang
Browse files
Save video pause status with a flag
Close #10015
parent
3d17a284
Changes
2
Hide whitespace changes
Inline
Side-by-side
vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
View file @
6f2f9491
...
...
@@ -63,6 +63,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
public
final
static
String
NAME
=
"VlcSharedPreferences"
;
public
final
static
String
VIDEO_RESUME_TIME
=
"VideoResumeTime"
;
public
final
static
String
VIDEO_PAUSED
=
"VideoPaused"
;
public
final
static
String
VIDEO_SUBTITLE_FILES
=
"VideoSubtitleFiles"
;
public
final
static
int
RESULT_RESCAN
=
RESULT_FIRST_USER
+
1
;
public
final
static
int
RESULT_RESTART
=
RESULT_FIRST_USER
+
2
;
...
...
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
View file @
6f2f9491
...
...
@@ -412,6 +412,8 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
// only (like desktop VLC). We don't want the custom subtitle files
// to persist forever with this video.
editor
.
putString
(
PreferencesActivity
.
VIDEO_SUBTITLE_FILES
,
null
);
// Paused flag - per session too, like the subs list.
editor
.
remove
(
PreferencesActivity
.
VIDEO_PAUSED
);
editor
.
commit
();
IntentFilter
filter
=
new
IntentFilter
();
...
...
@@ -495,6 +497,8 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
return
;
}
Boolean
isPaused
=
!
mLibVLC
.
isPlaying
();
long
time
=
mLibVLC
.
getTime
();
long
length
=
mLibVLC
.
getLength
();
//remove saved position if in the last 5 seconds
...
...
@@ -527,6 +531,10 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
editor
.
putLong
(
PreferencesActivity
.
VIDEO_RESUME_TIME
,
time
);
}
}
if
(
isPaused
)
Log
.
d
(
TAG
,
"Video paused - saving flag"
);
editor
.
putBoolean
(
PreferencesActivity
.
VIDEO_PAUSED
,
isPaused
);
// Save selected subtitles
String
subtitleList_serialized
=
null
;
if
(
mSubtitleSelectedFiles
.
size
()
>
0
)
{
...
...
@@ -2391,6 +2399,17 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
mLibVLC
.
setTime
(
intentPosition
);
}
// Paused flag
boolean
wasPaused
=
mSettings
.
getBoolean
(
PreferencesActivity
.
VIDEO_PAUSED
,
false
);
if
(
wasPaused
)
{
Log
.
d
(
TAG
,
"Video was previously paused, resuming in paused mode"
);
mHandler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
mLibVLC
.
pause
();
}},
500
);
}
// Get possible subtitles
String
subtitleList_serialized
=
mSettings
.
getString
(
PreferencesActivity
.
VIDEO_SUBTITLE_FILES
,
null
);
ArrayList
<
String
>
prefsList
=
new
ArrayList
<
String
>();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment