evan
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2009
04:50 PM
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).
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).
2 REPLIES 2

RokuAaron
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2009
11:25 AM
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:
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

RokuAaron
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2009
01:23 PM
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.
See the component reference for more details.
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.