Hey guys,
I am in the process of building a Free Preview Channel that will upgrade to my current published Pay Channel. I want to use the SetPreviewMode in order to have the Free Preview channel play the first 2 minutes of each video, but I can't seem to get it to work, I read where others had the same issue. Below is my videoscreen.brs Any help would be appreciated. Hoping that I am just missing something simple. Thanks!
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.SetPreviewMode(true)
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.isfullresult()
print "Video Completed Playback Normally"
RegDelete(episode.ContentId)
print "deleted bookmark for playback position"
elseif 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