'********************************************************************
'** Video Player Example Application - Main
'** November 2009
'** Copyright (c) 2009 Roku Inc. All Rights Reserved.
'********************************************************************
Function ShowPreRoll(video)
' a true result indicates that playback finished without user intervention
' a false result indicates that the user pressed UP or BACK to terminate playback
CanvasPreroll=CreateObject("roImageCanvas")
Port=CreateObject("roMessagePort")
CanvasPreroll.SetMessagePort(Port)
' build a very simple buffer screen for our preroll video
CanvasPreroll.SetLayer()
CanvasPreroll.Close()
' be sure to use the same message port for both the canvas and the player
' so we can receive events from both
End Function
Sub Main()
'initialize theme attributes like titles, logos and overhang color
initTheme()
preroll = {
streamFormat: "mp4"
stream: {
url: "http://www.archive.org/download/kelloggs_variety_pak/kelloggs_variety_pak_512kb.mp4"
}
}
ShowVideoScreen(preroll)
'prepare the screen for display and get ready to begin
screen=preShowHomeScreen("", "")
'set to go, time to get started
if screen=invalid then
print "unexpected error in preShowHomeScreen"
return
end if
showHomeScreen(screen)
End Sub
'*************************************************************
'** Set the configurable theme attributes for the application
'**
'** Configure the custom overhang and Logo attributes
'** Theme attributes affect the branding of the application
'** and are artwork, colors and offsets specific to the app
'*************************************************************
Sub initTheme()
app = CreateObject("roAppManager")
theme = CreateObject("roAssociativeArray")
theme.OverhangOffsetSD_X = "72"
theme.OverhangOffsetSD_Y = "31"
theme.OverhangSliceSD = "pkg:/images/Overhang_Background_SD.png"
theme.OverhangLogoSD = "pkg:/images/Overhang_Logo_SD.png"
theme.OverhangOffsetHD_X = "125"
theme.OverhangOffsetHD_Y = "35"
theme.OverhangSliceHD = "pkg:/images/Overhang_Background_HD.png"
theme.OverhangLogoHD = "pkg:/images/Overhang_Logo_HD.png"
theme.BackgroundColor = "#FFFFFF"
app.SetTheme(theme)
End Sub
'********************************************************************
'** Video Player Example Application - Main
'** November 2009
'** Copyright (c) 2009 Roku Inc. All Rights Reserved.
'********************************************************************
Function ShowPreRoll(video)
' a true result indicates that playback finished without user intervention
' a false result indicates that the user pressed UP or BACK to terminate playback
CanvasPreroll=CreateObject("roImageCanvas")
Port=CreateObject("roMessagePort")
CanvasPreroll.SetMessagePort(Port)
' build a very simple buffer screen for our preroll video
CanvasPreroll.SetLayer()
canvas.Close()
End Function
Sub Main()
'initialize theme attributes like titles, logos and overhang color
initTheme()
preroll = {
streamFormat: "mp4"
stream: {
url: "http://www.archive.org/download/kelloggs_variety_pak/kelloggs_variety_pak_512kb.mp4"
}
}
screenFacade = CreateObject("roPosterScreen")
screenFacade.show()
ShowVideoScreen(preroll)
screen=preShowHomeScreen("", "")
'set to go, time to get started
if screen=invalid then
print "unexpected error in preShowHomeScreen"
return
end if
screenFacade.showMessage("")
showHomeScreen(screen)
sleep(3500)
End Sub
'*************************************************************
'** Set the configurable theme attributes for the application
'**
'** Configure the custom overhang and Logo attributes
'** Theme attributes affect the branding of the application
'** and are artwork, colors and offsets specific to the app
'*************************************************************
Sub initTheme()
app = CreateObject("roAppManager")
theme = CreateObject("roAssociativeArray")
theme.OverhangOffsetSD_X = "72"
theme.OverhangOffsetSD_Y = "31"
theme.OverhangSliceSD = "pkg:/images/Overhang_Background_SD.png"
theme.OverhangLogoSD = "pkg:/images/Overhang_Logo_SD.png"
theme.OverhangOffsetHD_X = "125"
theme.OverhangOffsetHD_Y = "35"
theme.OverhangSliceHD = "pkg:/images/Overhang_Background_HD.png"
theme.OverhangLogoHD = "pkg:/images/Overhang_Logo_HD.png"
theme.BackgroundColor = "#FFFFFF"
app.SetTheme(theme)
End Sub
'********************************************************************
'** Video Player Example Application - Main
'** November 2009
'** Copyright (c) 2009 Roku Inc. All Rights Reserved.
'********************************************************************
Sub RunUserInterface()
screenFacade = CreateObject("roPosterScreen")
canvas = CreateObject("roVideoScreen")
canvas.SetContent({
Title: "My Video"
StreamFormat: "mp4"
Stream: { URL: "http://www.archive.org/download/kelloggs_variety_pak/kelloggs_variety_pak_512kb.mp4"}
})
canvas.Show()
while true
msg = Wait(0, port) ' where port is a roMessagePort
if type(msg) = "roVideoScreenEvent"
if msg.isScreenClosed()
end if
end if
end while
deviceInfo = CreateObject( "roDeviceInfo" )
displaySize = deviceInfo.GetDisplaySize()
background = {
Color: "#000000"
}
loadingImage = {
Url: "pkg:/images/Logo.png"
TargetRect: {
x: Int( displaySize.w / 2 ) - Int( 336 / 2 ),
y: Int( displaySize.h / 2 ) - Int( 209 / 2 ),
w: 365,
h: 110
}
}
loadingText = {
Text: "Loading...",
TextAttrs: {
Font: "Large",
VAlign: "Bottom"
},
TargetRect: {
x: loadingImage.TargetRect.x,
y: loadingImage.TargetRect.y + 225,
w: loadingImage.TargetRect.w,
h: 30
}
}
canvas = CreateObject( "roImageCanvas" )
canvas.SetLayer( 0, [ background, loadingImage, loadingText ] )
canvas.Show()
Main()
End Sub
Sub Main()
'initialize theme attributes like titles, logos and overhang color
initTheme()
screen=preShowHomeScreen("", "")
'set to go, time to get started
if screen=invalid then
print "unexpected error in preShowHomeScreen"
return
end if
showHomeScreen(screen)
End Sub
'*************************************************************
'** Set the configurable theme attributes for the application
'**
'** Configure the custom overhang and Logo attributes
'** Theme attributes affect the branding of the application
'** and are artwork, colors and offsets specific to the app
'*************************************************************
Sub initTheme()
app = CreateObject("roAppManager")
theme = CreateObject("roAssociativeArray")
theme.OverhangOffsetSD_X = "72"
theme.OverhangOffsetSD_Y = "31"
theme.OverhangSliceSD = "pkg:/images/Overhang_Background_SD.png"
theme.OverhangLogoSD = "pkg:/images/Overhang_Logo_SD.png"
theme.OverhangOffsetHD_X = "125"
theme.OverhangOffsetHD_Y = "35"
theme.OverhangSliceHD = "pkg:/images/Overhang_Background_HD.png"
theme.OverhangLogoHD = "pkg:/images/Overhang_Logo_HD.png"
theme.BackgroundColor = "#FFFFFF"
app.SetTheme(theme)
End Sub