Make the video player prettier and automark movies as played

This commit is contained in:
Nick Bisby 2019-03-18 19:33:44 -05:00
parent 7195d59c95
commit e6062661dd
No known key found for this signature in database
GPG Key ID: F6E0C4E6D0B5EB36
3 changed files with 26 additions and 7 deletions

View File

@ -23,8 +23,6 @@
end if
end for
m.top.title = m.top.base_title + ": " + m.top.value
print m.top.value_index
end sub
sub cycle()

View File

@ -100,7 +100,7 @@ sub ShowLibrarySelect()
while(true)
msg = wait(0, port)
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
exit while
return
else if nodeEventQ(msg, "escape") and msg.getNode() = "search"
library.setFocus(true)
else if nodeEventQ(msg, "search_value")
@ -404,7 +404,7 @@ sub ShowSearchOptions(query)
end while
end sub
sub showVideoPlayer(id)
sub showVideoPlayer(video_id)
port = CreateObject("roMessagePort")
screen = CreateObject("roSGScreen")
screen.setMessagePort(port)
@ -414,12 +414,27 @@ sub showVideoPlayer(id)
themeScene(scene)
VideoPlayer(scene, id)
video = VideoPlayer(video_id)
scene.appendChild(video)
video.setFocus(true)
video.observeField("state", port)
while true
msg = wait(0, port)
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
progress = int( video.position / video.duration * 100)
if progress > 95 ' TODO - max resume percentage
MarkItemWatched(video_id)
end if
' TODO - report progress here
return
else if nodeEventQ(msg, "state")
state = msg.getData()
if state = "stopped" or state = "finished"
screen.close()
end if
end if
end while

View File

@ -1,5 +1,5 @@
function VideoPlayer(scene, id)
video = scene.createChild("Video")
function VideoPlayer(id)
video = CreateObject("roSGNode", "Video")
content = VideoContent(id)
video.content = content
@ -7,6 +7,12 @@ function VideoPlayer(scene, id)
video.setFocus(true)
video.control = "play"
jellyfin_blue = "#00a4dcFF"
video.retrievingBar.filledBarBlendColor = jellyfin_blue
video.bufferingBar.filledBarBlendColor = jellyfin_blue
video.trickPlayBar.filledBarBlendColor = jellyfin_blue
return video
end function