Forum Discussion

clonemaster's avatar
15 years ago

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?

8 Replies

  • renojim's avatar
    renojim
    Community Streaming Expert
    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
  • "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?
  • destruk's avatar
    destruk
    Streaming Star
    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.

  • 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?
  • 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
  • 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
  • "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!!