Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
greubel
Visitor

New seek() function

I just tried the new seek() function.
1. If you try it before or after the show() the Roku box will crash !!!!
2. Need to wait until you get back the first position status. ?????
3. The minimum time position reported is 1 second and the seek() requires milliseconds.
4. If I seek to 50 seconds * 1000, it starts early at say 45 seconds. ????

It works but not precise.
0 Kudos
3 REPLIES 3
RokuKevin
Visitor

Re: New seek() function

Do you have an example code snippet that makes the box crash?

--Kevin
0 Kudos
greubel
Visitor

Re: New seek() function

Function Play_Movies( url as string, movs as string, HD as integer, live as integer ) as void
? "* Play_Movies " url "/" movs

pm = CreateObject("roAssociativeArray")
pm.ContentType = "movie"
pm.HDBranded = false
pm.IsHD = false
pm.StreamFormat = Get_Movie_Type( movs )
pm.StreamBitrates = [0] ' was 1500

if HD
pm.StreamQualities = ["HD"]
else
pm.StreamQualities = ["SD"]
end if

if live then
pm.Live = true
pm.StreamURLs = [Encode(url)]
else
if movs = " "
pm.StreamURLs = [Encode(url+"dummy.mp4")]
else
pm.StreamURLs = [Encode(url+movs)]
end if
end if
? "URL = " pm.StreamURLs

resume = 0
for i=0 to m.resume.Count()-1
if pm.StreamURLs[0] = m.resume.Lookup( "url" )
if Resume_Check(pm.StreamURLs[0]) > 0
resume = m.resume.Lookup( "time" ).toint()
? "resume time " resume
end if
m.resume.Delete( i )
exit for
end if
end for

? pm
? pm.streamurls
? pm.streamqualities
? pm.streambitrates

port = CreateObject("roMessagePort")
scr = CreateObject("roVideoScreen")
scr.SetContent(pm)
scr.SetPositionNotificationPeriod( 1 )
scr.SetMessagePort(port)

scr.Seek(resume*1000) <------------------ Crashes

scr.Show()

scr.Seek(resume*1000) <------------------ Crashes

------------------------------------------

* Ended up with this.

while true
msg = wait(1000, port)
if msg <> invalid
? "msg = " msg.GetMessage() " index = " msg.GetIndex()
? "info = " msg.GetInfo()
end if
if msg = invalid
if timer = 1 and resume > 0 ' wait 2 seconds before seek !
scr.Seek(resume*1000) <------------------
resume = 0
end if
timer = timer + 1
0 Kudos
RokuKevin
Visitor

Re: New seek() function

I've confirmed this crash. We will have a fix in an upcoming release.

--Kevin
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.