Forum Discussion

evan's avatar
evan
Visitor
16 years ago

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).

2 Replies

  • 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

  • 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.