roVideoPlayer questions

I am writing a fairly simple custom script. Here's what it should do:
1. Set the videoPlayer to loop.
2. Setup a video timecode event at 2 seconds.
3. Start video playing.
4. go into event loop watching for timecode event
5. 2 seconds in the video is paused.
6. Wait forever in event loop for a button to be pressed via the gpioport
7. Once a button press is seen unpause the video
8. goto the event loop in #4 to wait for the video to loop back and retrigger the timecode event

The problems I am having are:
1. Resume() seems to cause the video to start over at the beginning not resume from the 2 second mark.
2. The video event is not ever recognized after the first time it is triggered (ie on the second and subsequent loops of the video)

Code is below (lots of print statements in there)

v = CreateObject("roVideoPlayer")
print "video player object created"
p = CreateObject("roMessagePort")
print "messagePort object created"
gpio = CreateObject("roGpioControlPort")
print "io port object created"

ok = v.SetPort(p)
print "messagePort object connected to video object"
ok = gpio.SetPort(p)
print "messagPort object connected to io port object"

ok = v.AddEvent(1, 2000) ' Add timed events to video
print "created timed event for video"
ok = v.SetLoopMode(1)
print "video loop mode set to 1"
ok = v.PlayFile("/video.mpg")
print " started video"
print "waiting for video event"
msg = wait(0,p) ' Wait for all events
if msg.GetInt() <> 12 goto eventloop ' Only care about timed video events
print msg.GetData() ' Print out index when the time event happens
if msg.GetData() = 1 goto pausevideo ' we saw the time event so pause the video
goto eventloop
print "pausing video"
ok = v.Pause()
print "waiting for button"
msg = wait(0,p) ' Wait for all events
if type(msg)<>"roGpioButton" goto eventloop2
REM button was pressed so lets watch the video
print "resuming video"
ok = v.Resume()
goto eventloop


1 comment

  • 0


    Let me test this and get back to you.
Please sign in to leave a comment.