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

End of PlayDuration throws VideoRequestError

Hi there,

I'm working on an app that has a large video that I break up into smaller clips. You can select to play just certain clips which are separate objects in my video array, with the playduration set to the length of the clip. However, I noticed that when the Roku gets to the end of that duration, it does stop the video, but it also triggers the isRequestFailed() message. For instance, here is my event loop that tracks the messages and events during the video playback:
 while true
msg = wait(0, port)
if type(msg) = "roVideoScreenEvent" then
print "showHomeScreen | msg = "; msg.getMessage() " | index = "; msg.GetIndex()
if msg.isScreenClosed()
print "Screen closed"
exit while
elseif msg.isRequestFailed()
print "Video request failure: "; msg.GetIndex(); " " msg.GetData()
showVideoFailureMessage()
analytics("videofail", videoId)
elseif msg.isStatusMessage()
print "Video status: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isPlaybackPosition() then
nowpos = msg.GetIndex()
'RegWrite(episode.ContentId, nowpos.toStr())
print "now position"
print nowpos

else
print "Unexpected event type: "; msg.GetType()
end if
else
print "Unexpected message class: "; type(msg)
end if
end while


the isRequestFailed message evaluates as True when the video stops playing (at the correctly determined clip end). This is annoying because I display a dialog box to the user if there is an issue with the video, and right now the dialog box always shows up when the clips stop playing. Is this a known issue or am I doing something wrong?

Thanks in advance,
-Kaitlin
0 Kudos
9 REPLIES 9
TheEndless
Channel Surfer

Re: End of PlayDuration throws VideoRequestError

What's the GetMessage() of the request failed message? You're reporting the index and data, but not the message, which may give a clearer indication of the actual error.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
katycorp
Visitor

Re: End of PlayDuration throws VideoRequestError

Sorry for the delayed response on this. I put the project down for a while and came back to it. The message I get is the generic "An unexpected problem (but not server timeout or HTTP error) has been detected." message. I can also confirm that if the playduration on the object is invalid, it ends normally. I don't understand why this throws an error at all?

-Kaitlin
0 Kudos
RokuMarkn
Visitor

Re: End of PlayDuration throws VideoRequestError

Are you testing this on 3.0? I think there was a bug in this area in 2.9 that was fixed in 3.0, but I'm not positive about that.

--Mark
0 Kudos
katycorp
Visitor

Re: End of PlayDuration throws VideoRequestError

I just upgraded yesterday and am still seeing the same behavior. (version 3, build 2191)
0 Kudos
katycorp
Visitor

Re: End of PlayDuration throws VideoRequestError

is there a lot of overhead with a small position notification interval? I'm thinking of hacking around this by checking the position more frequently (calling screen.setPositionNotificationPeriod(5) ) and then comparing it to the end of the playstart + playduration to see if they are within a certain amount and using that to decide whether or not to show the error message.
Thanks!
Kaitlin
0 Kudos
RokuKevin
Visitor

Re: End of PlayDuration throws VideoRequestError

There is some overhead, but we've tested with notification periods of 1 second just fine.... The problem is that you probably don't want to be updating the bookmark to your server or the registry every second.

--Kevin
0 Kudos
MattBates
Visitor

Re: End of PlayDuration throws VideoRequestError

Is this bug still affecting anyone else?
I seem to get "An unexpected problem (but not server timeout or HTTP error) has been detected." (index -3) when video screen reaches my set playback index, no matter what.

I am on version 4.3 build 1057

Is there a workaround besides comparing playbackPosition and playstart?
0 Kudos
MattBates
Visitor

Re: End of PlayDuration throws VideoRequestError

Is anyone from Roku going to chime in?
0 Kudos
bosborne
Visitor

Re: End of PlayDuration throws VideoRequestError

I'd like to use this feature as well but the fact that it throws an error when the time is up makes it unusable =/

It would be nice to have a separate message type for when the video ends due to this behavior.

Instead I will have to just track the time myself and end the video myself.
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.