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: 
clonemaster
Visitor

Resume Playback Issues

I have an issue with the "Resume playback" button being displayed with every video in my channel; It doesn't matter if I've watched it or not. Even after I add a new video, it shows "Resume Playback" and "Play from Beginning." Anybody else have this problem when developing their channel?
0 Kudos
8 REPLIES 8
renojim
Community Streaming Expert

Re: Resume Playback Issues

You have to handle that yourself. Don't add the "Resume" button if it's a new video or the video has already been viewed.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
clonemaster
Visitor

Re: Resume Playback Issues

"renojim" wrote:
You have to handle that yourself. Don't add the "Resume" button if it's a new video or the video has already been viewed.

-JT



Function refreshShowDetail(screen As Object, showList As Object, showIndex as Integer) As Integer

if validateParam(screen, "roSpringboardScreen", "refreshShowDetail") = false return -1
if validateParam(showList, "roArray", "refreshShowDetail") = false return -1

show = showList[showIndex]

'Uncomment this statement to dump the details for each show
'PrintAA(show)

screen.ClearButtons()
screen.AddButton(1, "resume playing")
screen.AddButton(2, "play from beginning")
screen.SetContent(show)
screen.Show()

End Function


So if i remove screen.AddButton(1, "resume playing") and screen.AddButton(2, "play from beginning"), how do I make them present if the show has been partially viewed?
0 Kudos
destruk
Binge Watcher

Re: Resume Playback Issues

How are you storing the playback position value if it has already played some of the video? Check that - if it exists, then add/modify the buttons. With the code you posted you aren't saving the playback position, or loading the playback position in that section of your script.
0 Kudos
clonemaster
Visitor

Re: Resume Playback Issues


Function refreshShowDetail(screen As Object, showList As Object, showIndex as Integer) As Integer

if validateParam(screen, "roSpringboardScreen", "refreshShowDetail") = false return -1
if validateParam(showList, "roArray", "refreshShowDetail") = false return -1

show = showList[showIndex]

'Uncomment this statement to dump the details for each show
'PrintAA(show)

screen.ClearButtons()

if isPaused(screen)
screen.AddButton(1, "resume playing")
screen.AddButton(2, "play from beginning")
else
screen.AddButton(1, "Play")
end if

screen.SetContent(show)
screen.Show()

End Function


I haven't tested this code yet because I'm pretty sure it's incorrect. I just want to know if I'm headed in the right direction?
0 Kudos
RokuMarkn
Visitor

Re: Resume Playback Issues

I'm not sure you're yet understanding the mechanism by which resume works. Your code must save the playback position when the video stops. Normally you would save this in the registry so that you can resume even if you exit the channel and reenter it. You will need to use a name for the registry key that is associated with the file being played so that you don't resume a file based on a previous play of a different file. Then on resume, you would read that registry key for the file and set the initial playback position to the content of that registry key.

(Another option other than using the registry is to save the playback position on your server. This requires more work as you need to build a mechanism on your server to store everyone's playback position in some kind of database. The advantage is you can pause on one Roku player and resume on another. Usually only the major channels like Netflix do it this way.)

Once you have this mechanism in place, your springboard screen can check whether you have a saved playback position for the show (that is, whether the file's registry key exists), and create the resume button if there is one.

--Mark
0 Kudos
koshermetal
Visitor

Re: Resume Playback Issues

Do any of you guys have example code for the appDetailScreen.brs (that has been tested) for this whole "resume playback" thing? I removed it completely because it was showing up even if the content wasn't viewed yet. However, it would be nice to have it in there if the content was only partially watched. Any help is always appreciated!

Thanks & happy holidays!

P.S. I got this un-tested string of code below, but not sure exactly where in function refreshShowDetailScreen to place it...or if it will even work. I tried messing with it a bit but was unsuccessful.

if regread(episode.contentID)<> invalid then
screen.addbutton("Resume Playing")
end if
if regread(episode.contentID)<> invalid then
screen.addbutton("Play from Beginning")
else
screen.addbutton ("Play")
end if
Free 24/7 Metal radio via web or smartphone
www.koshermetal.com
0 Kudos
RokuJoel
Binge Watcher

Re: Resume Playback Issues

Hi, here is a link to an updated version of appDetailScreen.brs that should fix the Resume issue:

Download appDetailScreen.brs
0 Kudos
koshermetal
Visitor

Re: Resume Playback Issues

"RokuJoel" wrote:
Hi, here is a link to an updated version of appDetailScreen.brs that should fix the Resume issue:

Download appDetailScreen.brs


Thanks, Joel! This definitely did the trick and I rolled out a package update with the fix.

Gobble Gobble!!
Free 24/7 Metal radio via web or smartphone
www.koshermetal.com
0 Kudos