Developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
evan
Visitor

bookmarking video content

When video content is being played, it would be useful to know about the last position played in a given video file. The roVideoScreenEvent supports a method, isPlaybackPosition() to "indicate the current position in the video stream". However, in testing, this method always seems to return false when the user exits from the video, and events do not seem to be generated while video is being viewed.

Could you provide some example that illustrates how to effectively use this method to determine the last viewed position in a video? We would like to implement bookmarking (i.e. allow the user to pick-up where viewing last left off).
Tags (1)
0 Kudos
2 REPLIES 2
RokuAaron
Visitor

Re: bookmarking video content

Position events should happen periodically while video is playing. I believe they currently happen at the rate of once per second. There are published apps that rely on this functionality and no problems have been reported.

You say you're not getting any events while video is playing? This indicates a more fundamental problem. Here's a sample loop to wait for events while video is playing:

while true
msg = wait(0, videoscreen.GetMessagePort())
if type(msg) = "roVideoScreenEvent"
if msg.isPlaybackPosition() then
position = msg.GetIndex()
print "got position event"
elseif msg.isScreenClosed() then
exit while
endif
endif
end while

Tags (1)
0 Kudos
RokuAaron
Visitor

Re: bookmarking video content

Sorry...I omitted the most important detail. There is a roVideoScreen method called SetPositionNotificationPeriod which tells the player how often (in seconds) to notify you of position events. If you're not getting any position events, it's most likely because you did not call this method. However, you should still be getting other events.


videoscreen.SetPositionNotificationPeriod(1)
while true
msg = wait(0, videoscreen.GetMessagePort())
if type(msg) = "roVideoScreenEvent"
if msg.isPlaybackPosition() then
position = msg.GetIndex()
print "got position event"
elseif msg.isScreenClosed() then
exit while
endif
endif
end while



See the component reference for more details.
Tags (1)
0 Kudos
Community is Being Upgraded!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

We're sorry for this disruption — we’re excited to share what’s next!