Function CreateHomeworkHelperzMenu() as integer
screen = CreateObject("roGridScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.SetBreadcrumbText("Lunch", "Full Menu")
screen.SetupLists(2)
screen.SetListNames(["2016"])
screen.SetContentList(0, GetHomeworkHelperzMenuOptions_2016())
screen.show()
while (true)
msg = wait(0, port)
if type(msg) = "roGridScreenEvent"
if (msg.isScreenClosed())
return -1
else if (msg.isListItemSelected())
showSpringboardScreen( msg.GetIndex() )
showSpringboardScreen(videoContent)
endif
endif
end while
End Function
'*************************************************************
'** displayVideo()
'*************************************************************
Function displayVideo(args As Dynamic)
print "Displaying video: "
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
video.setMessagePort(p)
'bitrates = [0] ' 0 = no dots, adaptive bitrate
'bitrates = [348] ' <500 Kbps = 1 dot
'bitrates = [664] ' <800 Kbps = 2 dots
'bitrates = [996] ' <1.1Mbps = 3 dots
'bitrates = [2048] ' >=1.1Mbps = 4 dots
bitrates = [0]
' lengthy (20+ min.) TED talk to allow time for testing multiple ad pods
videoContent = { streamFormat : "mp4" }
videoContent.stream = { url: "http://video.ted.com/talks/podcast/DavidKelley_2002_480.mp4",
bitrate: 800,
quality: false
}
PlayContentWithAds(videoContent)
if type(args) = "roAssociativeArray"
if type(args.url) = "roString" and args.url <> "" then
urls[0] = args.url
end if
if type(args.StreamFormat) = "roString" and args.StreamFormat <> "" then
StreamFormat = args.StreamFormat
end if
if type(args.title) = "roString" and args.title <> "" then
title = args.title
else
title = ""
end if
if type(args.srt) = "roString" and args.srt <> "" then
srt = args.StreamFormat
else
srt = ""
end if
end if
videoclip = CreateObject("roAssociativeArray")
videoclip.StreamBitrates = bitrates
videoclip.StreamUrls = urls
videoclip.StreamQualities = qualities
videoclip.StreamFormat = StreamFormat
videoclip.Title = title
print "srt = ";srt
if srt <> invalid and srt <> "" then
videoclip.SubtitleUrl = srt
end if
video.SetContent(videoclip)
video.show()
lastSavedPos = 0
statusInterval = 10 'position must change by more than this number of seconds before saving
while true
msg = wait(0, video.GetMessagePort())
if type(msg) = "roVideoScreenEvent"
if msg.isScreenClosed() then 'ScreenClosed event
print "Closing video screen"
exit while
else if msg.isPlaybackPosition() then
nowpos = msg.GetIndex()
if nowpos > 10000
end if
if nowpos > 0
if abs(nowpos - lastSavedPos) > statusInterval
lastSavedPos = nowpos
end if
end if
else if msg.isRequestFailed()
print "play failed: "; msg.GetMessage()
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
endif
end if
end while
End Function
"squirreltown" wrote:
Function displayVideo(args As Dynamic)
Shouldn't "as dynamic" be outside the parentheses ?
"RokuKC" wrote:"squirreltown" wrote:
Function displayVideo(args As Dynamic)
Shouldn't "as dynamic" be outside the parentheses ?
That definition is perfectly valid. If you don't declare the return type for a function, it is implicitly "As Dynamic".
Though the actual function implementation above doesn't seem to be returning anything, so declaring it "As Void" might make it more clear.
We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.
Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality.
In the meantime, for additional assistance, visit our Support Site.
We're sorry for this disruption — we’re excited to share what’s next!
For support, visit support.roku.com.