From 6ddb4ab39bb4a909d0a2b6161ab43d50810dff1d Mon Sep 17 00:00:00 2001 From: Dustin Taylor Date: Fri, 1 Sep 2023 13:43:40 -0400 Subject: [PATCH] VOD Play and Resume --- components/home_scene.brs | 20 ++++++++++++-- components/screens/background/background.xml | 3 ++- .../screens/details_screen/details_screen.brs | 10 +++++++ .../screens/details_screen/details_screen.xml | 7 ++++- .../tasks/load_url_task/load_url_task.xml | 1 + .../load_video_info_task.xml | 1 + source/utils/config.brs | 26 +++++++++---------- 7 files changed, 51 insertions(+), 17 deletions(-) diff --git a/components/home_scene.brs b/components/home_scene.brs index 9779c7b..28f9592 100644 --- a/components/home_scene.brs +++ b/components/home_scene.brs @@ -359,6 +359,7 @@ sub preBufferVideo(item) ' should just be able to make it visible and tell it to play. ' content = createObject("roSGNode","ContentNode") + content.id = item.uuid if item.name <> Invalid then content.title = item.name else @@ -382,7 +383,10 @@ sub preBufferVideo(item) thisStream.quality = true end if - thisStream.url = f.fileUrl + ' Roku wants to direct download mp4 files rather than the static files Peertube seems to supply with fileUrl + ' See: https://developer.roku.com/docs/developer-program/core-concepts/playing-videos.md + + thisStream.url = f.fileDownloadUrl thisStream.stickyredirects = false ' @@ -454,6 +458,11 @@ sub preBufferVideo(item) end if m.videoplayer.content = content m.videoplayer.control = "prebuffer" + + timestamp = val(get_setting(m.videoplayer.content.id + "-timestamp", "0")) + if timestamp <> 0 + m.videoplayer.seek = timestamp + end if end sub sub initializeVideoPlayer() @@ -467,7 +476,14 @@ sub initializeVideoPlayer() end sub sub onPlayerPositionChanged(obj) - '? "Player Position: ", obj.getData() + timestamp = obj.getData() + ' ? "Player Position: ", timestamp + + ' Every X secs record viewer's position in video in local cache + interval = 15 + if timestamp MOD interval = 0 + set_setting(m.videoplayer.content.id + "-timestamp", str(timestamp)) + end if end sub sub onPlayerStateChanged(obj) diff --git a/components/screens/background/background.xml b/components/screens/background/background.xml index 8d3af89..011f451 100644 --- a/components/screens/background/background.xml +++ b/components/screens/background/background.xml @@ -25,7 +25,8 @@ SPDX-License-Identifier: MIT + id="backgroundColor" + color="0xffffff"/> 0 and item.duration <> 0 + m.progressBackground.visible = true + m.progress.width = m.progressBackground.width * (timestamp / item.duration) + end if + ' ' remove markdown hyperlinks of the form ' diff --git a/components/screens/details_screen/details_screen.xml b/components/screens/details_screen/details_screen.xml index 51a0990..78124cc 100644 --- a/components/screens/details_screen/details_screen.xml +++ b/components/screens/details_screen/details_screen.xml @@ -39,7 +39,12 @@ SPDX-License-Identifier: MIT width="500" height="280" translation="[160,200]" - /> + > + + + + +