Merge pull request #330 from jackrvan/add-watched-button-to-continue-watching

This commit is contained in:
Neil Burrows 2021-01-16 16:00:57 +00:00 committed by GitHub
commit 593a017c78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,7 +26,7 @@ function VideoContent(video, audio_stream_idx = 1) as object
' If there is a last playback positon, ask user if they want to resume
position = meta.json.UserData.PlaybackPositionTicks
if position > 0 then
dialogResult = startPlaybackOver(position)
dialogResult = startPlayBackOver(position)
'Dialog returns -1 when back pressed, 0 for resume, and 1 for start over
if dialogResult = -1 then
'User pressed back, return invalid and don't load video
@ -34,6 +34,14 @@ function VideoContent(video, audio_stream_idx = 1) as object
else if dialogResult = 1 then
'Start Over selected, change position to 0
position = 0
else if dialogResult = 2 then
'Mark this item as watched, refresh the page, and return invalid so we don't load the video
MarkItemWatched(video.id)
video.content.watched = not video.content.watched
group = m.scene.focusedChild
group.timeLastRefresh = CreateObject("roDateTime").AsSeconds()
group.callFunc("refresh")
return invalid
end if
end if
video.content.PlayStart = int(position/10000000)
@ -223,7 +231,11 @@ end function
'Opens dialog asking user if they want to resume video or start playback over
function startPlayBackOver(time as LongInteger) as integer
return option_dialog([ "Resume playing at " + ticksToHuman(time) + ".", "Start over from the beginning." ])
if m.scene.focusedChild.overhangTitle = "Home" then
return option_dialog([ "Resume playing at " + ticksToHuman(time) + ".", "Start over from the beginning.", "Watched"])
else
return option_dialog([ "Resume playing at " + ticksToHuman(time) + ".", "Start over from the beginning."])
endif
end function
function directPlaySupported(meta as object) as boolean