Forum Discussion

katycorp's avatar
katycorp
Visitor
15 years ago

Inconsistent HLS playing behavior

Hello all,

I'm streaming a live video using HLS on the roku. Most of the time, it plays fine. But sometimes I get the generic "An unexpected problem (but not server timeout or HTTP error) has been detected. | index = -3" error. If I try to play it a couple more times right away, it plays fine. I'm puzzled. Any suggestions on how to debug this? The bitrate is 816kb/s with 10 second segments, but I'm using 0 for the bitrate setting.

Thanks!
Kaitlin

7 Replies

  • Try using 816 for the bitrate setting. We could provide more assistance if you shared the stream url.

    --Kevin
  • A couple more details.

    * This bug exists in the 2.x firmware as well.
    * We are only seeing this behavior when resuming from a playback position. Video will exit with a -3, but if you try it several times it will play at the correct position.
    * A sleep statement just before playing seems to help. However, it requires a sleep(3000) before the it will play back without fail.
  • So I think I figured out what my problem was. I was using example code from the example app (videoplayer) that is in the SDK (2.8 ). From the appVideo.brs file from that example:

    Function showVideoScreen(episode As Object)

    if type(episode) <> "roAssociativeArray" then
    print "invalid data passed to showVideoScreen"
    return -1
    endif

    port = CreateObject("roMessagePort")
    screen = CreateObject("roVideoScreen")
    screen.SetMessagePort(port)

    screen.Show()
    screen.SetPositionNotificationPeriod(30)
    screen.SetContent(episode)
    screen.Show()

    'Uncomment his line to dump the contents of the episode to be played
    'PrintAA(episode)


    I used most of this code for my app. Taking out the first screen.Show() helped my issue. I think there is some kind of asynchronous behavior that may cause a race condition. So far I haven't need the sleep(3000) to keep it from erroring out again. For some reason, I only experienced this issue with the hls streamformat. It seems like it is possible to click play before the screen.SetContent() function has returned and this causes it to error out because there's no content set. Is this just an oversight in the example code or is it in there for a reason?

    -Kaitlin
  • This is just an oversight in the example code.... There is no reason for that first .Show() method.

    Thanks for pointing it out.

    --Kevin
  • Kaitlin, you are a lifesaver! The additional screen.Show() is still in the video player example, and I too was using that as the base for my channel. It worked fine for me on Roku2, but apparently it was causing this intermittent behavior on a Roku1.

    Thanks!

    Nick