Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
531
Issue boards
Milestones
Wiki
Code
Merge requests
14
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
52645b5c
Commit
52645b5c
authored
5 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
TV: Fix resume card generation
(cherry picked from commit
4f3173b0
)
parent
f42c51e7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+20
-20
20 additions, 20 deletions
vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
with
20 additions
and
20 deletions
vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+
20
−
20
View file @
52645b5c
...
...
@@ -208,9 +208,11 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
videoBackground
=
false
getCurrentMedia
()
?.
let
{
savePosition
()
saveMediaMeta
()
if
(
AndroidDevices
.
isAndroidTv
&&
AndroidUtil
.
isOOrLater
&&
!
isAudioList
())
setResumeProgram
(
service
.
applicationContext
,
it
)
val
audio
=
isAudioList
()
// check before dispatching in saveMediaMeta()
launch
(
start
=
CoroutineStart
.
UNDISPATCHED
)
{
saveMediaMeta
().
join
()
if
(
AndroidDevices
.
isAndroidTv
&&
AndroidUtil
.
isOOrLater
&&
!
audio
)
setResumeProgram
(
service
.
applicationContext
,
it
)
}
}
mediaList
.
removeEventListener
(
this
)
previous
.
clear
()
...
...
@@ -407,30 +409,28 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
service
.
executeUpdate
()
}
fun
saveMediaMeta
()
{
val
currentMedia
=
getCurrentMedia
()
?:
return
if
(
currentMedia
.
uri
.
scheme
==
"fd"
)
return
fun
saveMediaMeta
()
=
launch
(
start
=
CoroutineStart
.
UNDISPATCHED
)
{
val
currentMedia
=
getCurrentMedia
()
?:
return
@launch
if
(
currentMedia
.
uri
.
scheme
==
"fd"
)
return
@launch
//Save progress
val
time
=
player
.
getCurrentTime
()
val
length
=
player
.
getLength
()
val
canSwitchToVideo
=
player
.
canSwitchToVideo
()
val
rate
=
player
.
getRate
()
launch
{
val
media
=
withContext
(
Dispatchers
.
IO
)
{
medialibrary
.
findMedia
(
currentMedia
)
}
if
(
media
===
null
||
media
.
id
==
0L
)
return
@launch
if
(
media
.
type
==
MediaWrapper
.
TYPE_VIDEO
||
canSwitchToVideo
||
media
.
isPodcast
)
{
var
progress
=
time
/
length
.
toFloat
()
if
(
progress
>
0.95f
||
length
-
time
<
10000
)
{
//increase seen counter if more than 95% of the media have been seen
//and reset progress to 0
launch
(
Dispatchers
.
IO
)
{
media
.
setLongMeta
(
MediaWrapper
.
META_SEEN
,
media
.
seen
+
1
)
}
progress
=
0f
}
media
.
time
=
if
(
progress
==
0f
)
0L
else
time
launch
(
Dispatchers
.
IO
)
{
media
.
setLongMeta
(
MediaWrapper
.
META_PROGRESS
,
media
.
time
)
}
val
media
=
withContext
(
Dispatchers
.
IO
)
{
medialibrary
.
findMedia
(
currentMedia
)
}
if
(
media
===
null
||
media
.
id
==
0L
)
return
@launch
if
(
media
.
type
==
MediaWrapper
.
TYPE_VIDEO
||
canSwitchToVideo
||
media
.
isPodcast
)
{
var
progress
=
time
/
length
.
toFloat
()
if
(
progress
>
0.95f
||
length
-
time
<
10000
)
{
//increase seen counter if more than 95% of the media have been seen
//and reset progress to 0
launch
(
Dispatchers
.
IO
)
{
media
.
setLongMeta
(
MediaWrapper
.
META_SEEN
,
media
.
seen
+
1
)
}
progress
=
0f
}
launch
(
Dispatchers
.
IO
)
{
media
.
setStringMeta
(
MediaWrapper
.
META_SPEED
,
rate
.
toString
())
}
media
.
time
=
if
(
progress
==
0f
)
0L
else
time
launch
(
Dispatchers
.
IO
)
{
media
.
setLongMeta
(
MediaWrapper
.
META_PROGRESS
,
media
.
time
)
}
}
launch
(
Dispatchers
.
IO
)
{
media
.
setStringMeta
(
MediaWrapper
.
META_SPEED
,
rate
.
toString
())
}
}
fun
setSpuTrack
(
index
:
Int
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment