You didn't include your showvideoscreen, but essentially, you need to look for an isscreenclosed() event and return a -1 if the screen is closed, and something else like -2 if isfullresult()
Hello, new user and also want the same functionality. Very green, around 2 hours now, but I have my first edits of the videoplayer sample working already with content and ratings. Unfortunately, either I still don't completely understand the language (and I assure you, I do not! all trial and error so far), or the above does not apply directly to the videoplayer sample.
Here is the whole of showVideoScreen():
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.Show()
screen.SetPositionNotificationPeriod(30)
screen.SetContent(episode)
screen.Show()
'Uncomment his line to dump the contents of the episode to be played
'PrintAA(episode)
while true
msg = wait(0, port)
if type(msg) = "roVideoScreenEvent" then
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
print "Unexpected event type: "; msg.GetType()
end if
else
print "Unexpected message class: "; type(msg)
end if
end while
End Function
In the videoplayer example, -1 return value is already used. I'm still green so any corrections would be great, but I believe that I should test on returnvalue=-2 in if msg.getindex()=3 in the sample detail screen you show above..does the following look correct?
-----showVideoScreen()-----
if msg.isFullResult()
print "Video ended correctly"
return -3
elseif msg.isScreenClosed()
print "Screen closed"
return -2
elseif msg.isRequestFailed()
print "Video request failure: "; msg.GetIndex(); " " msg.GetData()
-----showDetailScreen()-----
if msg.GetIndex() = 3
for each video in showList
showList[showIndex].PlayStart = 0
returnvalue=showVideoScreen(video)
if returnvalue=-2 then
exit for
end if
next
endif
Thanks in advance.
-- DJ Lucas