Function ShowSpringboardScreen(episode)
screen = CreateObject("roSpringboardScreen")
screen.SetMessagePort(CreateObject("roMessagePort"))
'screen.SetBreadcrumbText(leftBread, rightBread)
screen.SetDescriptionStyle("movie")
print RegRead(episode.id)
screen.ClearButtons()
if RegRead(episode.id) <> invalid and RegRead(episode.id).toint() >=10 then
screen.AddButton(1, "Watch Now")
screen.AddButton(2, "Resume")
else
screen.addbutton(1, "Watch Now")
end if
screen.SetContent(episode)
screen.SetStaticRatingEnabled(false)
screen.AllowUpdates(true)
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roSpringboardScreenEvent"
if msg.isScreenClosed()
print "Screen closed"
exit while
else if msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
if msg.GetIndex() = 1
PlayVideo(episode)
endif
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
endif
else
print "wrong type.... type=";msg.GetType(); " msg: "; msg.GetMessage()
endif
end while
return true
End Function
sub ShowVideoScreen(episode as object) as integer
screen = CreateObject("roVideoScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort( port )
metaData = {
ContentType: episode.contentType,
VideoId: episode.id,
Title: episode.title,
Description: episode.description,
length: episode.length,
Stream: {
Url: episode.url
}
StreamFormat: episode.streamformat
}
screen.SetPositionNotificationPeriod(1)
screen.SetContent(metaData)
screen.show()
while true
msg = wait(0, port)
if type(msg) = "roVideoScreenEvent" then
print "showVideoScreen | msg = "; msg.getMessage() " | index = "; msg.GetIndex()
if msg.isScreenClosed()
print "Screen closed"
exit while
else if msg.isfullresult()
RegDelete(episode.id)
else if msg.isPartialResult()
'RegWrite(episode.id, nowpos.toStr())
else if msg.isRequestFailed() then
showVideoFailureMessage()
'print "Video request failure: "; msg.GetIndex(); " " msg.GetData()
else if msg.isStatusMessage()
print "Video status: "; msg.GetIndex(); " " msg.GetData()
else if msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
else if msg.isPlaybackPosition() then
nowpos = msg.GetIndex()
RegWrite(episode.id, nowpos.toStr())
else if msg.isPaused() then
else if msg.isResumed() then
end if
else
print "Unexpected message class: "; type(msg)
end if
end while
end sub
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roSpringboardScreenEvent"
if msg.isScreenClosed()
print "Screen closed"
exit while
else if msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
if msg.GetIndex() = 1
PlayVideo(episode)
endif
if msg.GetIndex() = 2
PlayStart = RegRead(episode.id)
if PlayStart <> invalid then
episode.PlayStart = PlayStart.ToInt()
ShowVideoScreen(episode)
endif
endif
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
endif
else
print "wrong type.... type=";msg.GetType(); " msg: "; msg.GetMessage()
endif
end while
while true
msg = wait(0, port)
if type(msg) = "roVideoScreenEvent" then
print "showVideoScreen | msg = "; msg.getMessage() " | index = "; msg.GetIndex()
if msg.isScreenClosed()
print "Screen closed"
ShowSpringboardScreen(episode)
exit while