HMS

Home Media Server for Roku Players
git clone https://www.brianlane.com/git/HMS
Log | Files | Refs | README | LICENSE

commit a9aa36a1e847deea125a029eb659f0fb99526f63
parent 645c03cf6d44f471d1c8863bdc173b0fc8d3c166
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Fri, 18 Nov 2022 06:51:33 -0800

Fix handling of end of playback

Diffstat:
MHMS/components/MainScene.brs | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/HMS/components/MainScene.brs b/HMS/components/MainScene.brs @@ -270,9 +270,9 @@ end sub sub SetupVideoPlayer() ' Setup the video player m.video = m.top.FindNode("player") - m.Video.observeField("state", "OnVideoStateChange") - m.Video.observeField("position", "OnVideoPositionChange") - m.Video.notificationInterval = 5 + m.video.observeField("state", "OnVideoStateChange") + m.video.observeField("position", "OnVideoPositionChange") + m.video.notificationInterval = 5 ' map of events that should be handled on state change m.statesToHandle = { finished: "" @@ -280,9 +280,13 @@ sub SetupVideoPlayer() } end sub -sub OnVideoStateChanged() - print "MainScene->OnVideoStateChanged()" +sub OnVideoStateChange() + print "MainScene->OnVideoStateChange()" ? "video state: " + m.Video.state + if m.video.state = "finished" + ' Set the playback position back to 0 if it played all the way + SetKeystoreValue(m.video.content.Title, "0", "ResetKeystoreTask") + end if if m.Video.content <> invalid AND m.statesToHandle[m.Video.state] <> invalid m.timer = CreateObject("roSgnode", "Timer") m.timer.observeField("fire", "CloseVideoPlayer")