VOD Play and Resume
This commit is contained in:
parent
31632f7872
commit
6ddb4ab39b
|
@ -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)
|
||||
|
|
|
@ -25,7 +25,8 @@ SPDX-License-Identifier: MIT
|
|||
|
||||
<children>
|
||||
<Rectangle
|
||||
id="backgroundColor"/>
|
||||
id="backgroundColor"
|
||||
color="0xffffff"/>
|
||||
<Poster
|
||||
id="oldBackground"/>
|
||||
<Poster
|
||||
|
|
|
@ -13,6 +13,8 @@ sub init()
|
|||
m.thumbnail = m.top.FindNode("thumbnail")
|
||||
m.title = m.top.FindNode("title")
|
||||
m.owner = m.top.FindNode("owner")
|
||||
m.progressBackground= m.top.FindNode("progressBackground")
|
||||
m.progress = m.top.FindNode("progress")
|
||||
|
||||
m.contentStack = []
|
||||
m.currentContent = invalid
|
||||
|
@ -87,6 +89,14 @@ sub setContent(item)
|
|||
m.title.text = ""
|
||||
end if
|
||||
|
||||
' ensure we are not rendering progress bar from other detail screens until we have new updates to render
|
||||
m.progressBackground.visible = false
|
||||
timestamp = val(get_setting(item.uuid + "-timestamp", "0"))
|
||||
if timestamp <> 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
|
||||
'
|
||||
|
|
|
@ -39,7 +39,12 @@ SPDX-License-Identifier: MIT
|
|||
width="500"
|
||||
height="280"
|
||||
translation="[160,200]"
|
||||
/>
|
||||
>
|
||||
|
||||
<Rectangle id="progressBackground" visible="false" color="0x00000098" width="500" height="8" translation="[1,273]">
|
||||
<Rectangle id="progress" color="#00a4dcFF" width="0" height="8" />
|
||||
</Rectangle>
|
||||
</Poster>
|
||||
|
||||
<Label
|
||||
id="duration"
|
||||
|
|
|
@ -12,6 +12,7 @@ SPDX-License-Identifier: MIT
|
|||
<field id = "error" type = "string" />
|
||||
</interface>
|
||||
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/tasks/load_url_task/load_url_task.brs"/>
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/get_feed.brs" />
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ SPDX-License-Identifier: MIT
|
|||
<field id = "error" type = "string" />
|
||||
</interface>
|
||||
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/tasks/load_video_info_task/load_video_info_task.brs"/>
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/get_feed.brs" />
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
' "Registry" is where Roku stores config
|
||||
|
||||
' Generic registry accessors
|
||||
function registry_read(key, section=invalid)
|
||||
if section = invalid then
|
||||
function registry_read(key as String, section="" as String)
|
||||
if section = "" then
|
||||
return invalid
|
||||
end if
|
||||
reg = CreateObject("roRegistrySection", section)
|
||||
|
@ -16,8 +16,8 @@ function registry_read(key, section=invalid)
|
|||
return invalid
|
||||
end function
|
||||
|
||||
function registry_write(key, value, section=invalid)
|
||||
if section = invalid then
|
||||
function registry_write(key as String, value as String, section="" as String)
|
||||
if section = "" then
|
||||
return invalid
|
||||
end if
|
||||
reg = CreateObject("roRegistrySection", section)
|
||||
|
@ -25,8 +25,8 @@ function registry_write(key, value, section=invalid)
|
|||
reg.flush()
|
||||
end function
|
||||
|
||||
function registry_delete(key, section=invalid)
|
||||
if section = invalid then
|
||||
function registry_delete(key as String, section="" as String)
|
||||
if section = "" then
|
||||
return invalid
|
||||
end if
|
||||
reg = CreateObject("roRegistrySection", section)
|
||||
|
@ -35,21 +35,21 @@ function registry_delete(key, section=invalid)
|
|||
end function
|
||||
|
||||
|
||||
' "PeerVue" registry accessors for the default global settings
|
||||
function get_setting(key, default=invalid)
|
||||
value = registry_read(key, "PeerVue")
|
||||
' "NewEllijayTV" registry accessors for the default global settings
|
||||
function get_setting(key as String, default=invalid as Dynamic)
|
||||
value = registry_read(key, "NewEllijayTV")
|
||||
if value = invalid then
|
||||
return default
|
||||
end if
|
||||
return value
|
||||
end function
|
||||
|
||||
function set_setting(key, value)
|
||||
registry_write(key, value, "PeerVue")
|
||||
function set_setting(key as String, value as String)
|
||||
registry_write(key, value, "NewEllijayTV")
|
||||
end function
|
||||
|
||||
function unset_setting(key)
|
||||
registry_delete(key, "PeerVue")
|
||||
function unset_setting(key as String)
|
||||
registry_delete(key, "NewEllijayTV")
|
||||
end function
|
||||
|
||||
function get_language()
|
||||
|
|
Loading…
Reference in New Issue
Block a user