Create an RoURLTransfer object, and set it's port to the same port as your videoscreen. Give your wait statement a time like 100 milliseconds instead of 0. Add a check for the returned value, for example:
Function showVideoScreen(episode As Object)
if type(episode) <> "roAssociativeArray" then
print "invalid data passed to showVideoScreen"
return -1
endif
port = CreateObject("roMessagePort")
screen = CreateObject("roVideoScreen")
screen.SetMessagePort(port)
screen.SetPositionNotificationPeriod(30)
screen.SetContent(episode)
here is the URL Transfer setup:
xfer=createobject("roURLTransfer")
xfer.seturl("http://myserver.com/check.php")
xfer.setport(port)
xfer.asyncgettostring()
screen.Show()
'Uncomment his line to dump the contents of the episode to be played
'PrintAA(episode)
then the while loop with a non-zero wait time (here, i've set it to 100 milliseconds), and I've made it the first message-type check:
while true
msg = wait(100, port)
if type(msg)="roUrlEvent" then
str=msg.getstring()
print "************returned url data************"
print str
else if type(msg) = "roVideoScreenEvent" then
?"******************************************MESSAGE**********************************"
?"message:";msg.getmessage();" Type:";msg.gettype();" Index:"; msg.getindex();" data:";msg.getdata();" playback pos? ";msg.isplaybackposition()
?"******************************************MESSAGE**********************************"
'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()
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())
else if msg.isStatusMessage() then
?"status message"
?"message:";msg.getmessage();" Type:";msg.gettype();" Index:"; msg.getindex();" data:";msg.getdata()
else if msg.isstreamstarted() then
?"StreamStarted"
?"message:";msg.getmessage();" Type:";msg.gettype();" Index:"; msg.getindex();" data:";msg.getdata()
else
print "Unexpected event type: "; msg.GetType()
end if
end if
end while
End Function
This way, you can have multiple things going on - video is playing and, you are also checking for a URL Event.
- Joel