"kooljay68" wrote:
OK .. I changed that like you say ... but I must still be off the mark ... because it will not kick out of the video ? Here is all of the code for the page ... maybe that will help
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()
m.timer=createobject("roTimeSpan")
m.timer.mark()
'Uncomment his line to dump the contents of the episode to be played
'PrintAA(episode)
while true
msg = wait(1000, port)
if m.timer.totalseconds > 60 then
print "End Preview: "; msg.GetIndex(); " " msg.GetData()
end if
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
You don't have code in there to exit the video. Right now, it will likely crash after 60 seconds, because you're not checking the validity of msg. That aside, at best it should print the message "End Preview..." to the console (every second) after it reaches 60 seconds, but it won't exit the video, because you're not closing the screen.
BTW, if your goal is to just show a portion of the video as a preview, you should be able to use the PlayDuration content metadata attribute, instead of timing it in code. Alternatively, you could kill the video based on the playback position notification.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)