Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Komag
Roku Guru

Re: Install error

Getting info from the debugger is absolutely essential, I didn't even think to ask :shock:
0 Kudos
Blackhawk
Roku Guru

Re: Install error

I tried that but it said telnet is not recognized as a internal or external command
0 Kudos
renojim
Community Streaming Expert

Re: Install error

I assume you're using Windows. You need to enable telnet as one of the Windows features under "Programs and Features". However, I strongly suggest you just use belltown's fabulous PurpleBug: viewtopic.php?f=34&t=92128&start=15#p523741

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
belltown
Roku Guru

Re: Install error

What type of computer are you using to debug your Roku, a Windows PC? If so, Telnet is not enabled by default on many Windows versions. To enable Telnet, go to the Control Panel, then Programs (and Features), select 'Turn Windows features on or off', click Yes if prompted by User Account Control, then check the box marked Telnet Client. Restart your command prompt, and Telnet should now work.

If you are using Windows, a better debugging alternative for the Roku is PurpleBug (http://belltown-roku.tk/PurpleBug).

EDIT: Jim beat me to it!
0 Kudos
Blackhawk
Roku Guru

Re: Install error

I redid the code to the menu of my Roku series.

' *********************************************************
' ** Simple Poster Screen Demonstration App
' ** Nov 2009
' ** Copyright (c) 2009 Roku Inc. All Rights Reserved.
' *********************************************************

'************************************************************
'** Application startup
'************************************************************
Function CreateShowdownMenu() as integer

screen = CreateObject("roGridScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.SetBreadcrumbText("Showdown", "Full Menu")
screen.SetupLists(1)
screen.SetListNames(["2016"])

screen.SetContentList(0, GetLunchMenuOptions_Healthy())

screen.show()


'prepare the screen for display and get ready to begin
screen=preShowPosterScreen("", "")
if screen=invalid then
print "unexpected error in preShowPosterScreen"
return
end if

'set to go, time to get started
showPosterScreen(screen)


End Function


'******************************************************
'** Perform any startup/initialization stuff prior to
'** initially showing the screen.
'******************************************************
Function preShowPosterScreen(breadA=invalid, breadB=invalid) As Object

port=CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
if breadA<>invalid and breadB<>invalid then
screen.SetBreadcrumbText(breadA, breadB)
end if

screen.SetListStyle("arced-landscape")
return screen

End Function


'******************************************************
'** Display the poster screen and wait for events from
'** the screen. The screen will show retreiving while
'** we fetch and parse the feeds for the show posters
'******************************************************
Function showPosterScreen(screen As Object) As Integer

categoryList = getCategoryList()
screen.SetListNames(categoryList)
screen.SetContentList(getShowsForCategoryItem(categoryList[0]))
screen.Show()

while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent" then
print "showPosterScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.isListFocused() then
'get the list of shows for the currently selected item
screen.SetContentList(getShowsForCategoryItem(categoryList[msg.GetIndex()]))
print "list focused | current category = "; msg.GetIndex()
else if msg.isListItemFocused() then
print"list item focused | current show = "; msg.GetIndex()
else if msg.isListItemSelected() then
print "list item selected | current show = "; msg.GetIndex()
'if you had a list of shows, the index of the current item
'is probably the right show, so you'd do something like this
'm.curShow = displayShowDetailScreen(showList[msg.GetIndex()])
displayBase64()
else if msg.isScreenClosed() then
return -1
end if
end If
end while


End Function

Function displayBase64()
ba = CreateObject("roByteArray")
str = "Aladdin:open sesame"
ba.FromAsciiString(str)
result = ba.ToBase64String()
print result

ba2 = CreateObject("roByteArray")
ba2.FromBase64String(result)
result2 = ba2.ToAsciiString()
print result2
End Function

'*************************************************************
'** showSpringboardScreen()
'*************************************************************

Function showSpringboardScreen(item as object) As Boolean
port = CreateObject("roMessagePort")
screen = CreateObject("roSpringboardScreen")

print "showSpringboardScreen"

screen.SetMessagePort(port)
screen.AllowUpdates(false)
if item <> invalid and type(item) = "roAssociativeArray"
screen.SetContent(item)
endif

screen.SetDescriptionStyle("generic") 'audio, movie, video, generic
' generic+episode=4x3,
screen.ClearButtons()
screen.AddButton(1,"Play")
screen.AddButton(2,"Go Back")
screen.SetStaticRatingEnabled(false)
screen.AllowUpdates(true)
screen.Show()

downKey=3
selectKey=6
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
displayVideo("")
else if msg.GetIndex() = 2
return true
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


'*************************************************************
'** 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]

'Swap the commented values below to play different video clips...
' 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



'**************************************************************
'** Return the list of categories to display in the filter
'** banner. The result is an roArray containing the names of
'** all of the categories. All just static data for the example.
'***************************************************************
Function getCategoryList() As Object

categoryList = CreateObject("roArray", 10, true)

categoryList = [ "2016" ]
return categoryList

End Function


'********************************************************************
'** Given the category from the filter banner, return an array
'** of ContentMetaData objects (roAssociativeArray's) representing
'** the shows for the category. For this example, we just cheat and
'** create and return a static array with just the minimal items
'** set, but ideally, you'd go to a feed service, fetch and parse
'** this data dynamically, so content for each category is dynamic
'********************************************************************
Function getShowsForCategoryItem(category As Object) As Object

print "getting shows for category "; category

showList = [

{
ShortDescriptionLine1:"Show #2",
ShortDescriptionLine2:"Short Description for Show #2",
HDPosterUrl:"pkg:/media/bogusFileName_hd.jpg",
SDPosterUrl:"pkg:/media/bogusFileName_hd.jpg"
}
]

return showList

End Function



I ran it and the command prompt said return needs to return a value
0 Kudos
Komag
Roku Guru

Re: Install error

Return has to return whatever type of value you have declared the Function to be, unless you declare it to be VOID
0 Kudos
Blackhawk
Roku Guru

Re: Install error

How do I declare it to be VOID?
0 Kudos
Komag
Roku Guru

Re: Install error

Example:

FUNCTION initBook(bk, y, x, rm) AS VOID
0 Kudos
Blackhawk
Roku Guru

Re: Install error

I fixed the problem and got the menu working


' *********************************************************
' ** Simple Poster Screen Demonstration App
' ** Nov 2009
' ** Copyright (c) 2009 Roku Inc. All Rights Reserved.
' *********************************************************

'************************************************************
'** Application startup
'************************************************************
Function CreateShowdownMenu() as integer

screen = CreateObject("roGridScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.SetBreadcrumbText("Showdown", "Full Menu")
screen.SetupLists(1)
screen.SetListNames(["2016"])

screen.SetContentList(0, GetShowdownMenuOptions_2016())

screen.show()


while (true)
msg = wait(0, port)
if type(msg) = "roGridScreenEvent"
else if (msg.isListItemSelected())
showSpringboardScreen(itemVenter)
'showSpringboardScreen(itemMpeg4) 'uncomment this line and comment out the next to see the old mpeg4 example
'showSpringboardScreen(item) 'uncomment this line to see the BigBuckBunny example

endif

end while



End Function






'*************************************************************
'** showSpringboardScreen()
'*************************************************************

Function showSpringboardScreen(item as object) As Boolean
port = CreateObject("roMessagePort")
screen = CreateObject("roSpringboardScreen")

print "showSpringboardScreen"

screen.SetMessagePort(port)
screen.AllowUpdates(false)
if item <> invalid and type(item) = "roAssociativeArray"
screen.SetContent(item)
endif

screen.SetDescriptionStyle("generic") 'audio, movie, video, generic
' generic+episode=4x3,
screen.ClearButtons()
screen.AddButton(1,"Play")
screen.AddButton(2,"Go Back")
screen.SetStaticRatingEnabled(false)
screen.AllowUpdates(true)
screen.Show()

downKey=3
selectKey=6
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
displayVideo("")
else if msg.GetIndex() = 2
return true
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


'*************************************************************
'** 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]

'Swap the commented values below to play different video clips...
' 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


Function PlayVideoContent(content as Object) as Object
' roVideoScreen just closes if you try to resume or seek after ad playback,
' so just create a new instance of the screen...
videoScreen = CreateObject("roVideoScreen")
videoScreen.SetContent(content)
' need a reasonable notification period set if midroll/postroll ads are to be
' rendered at an appropriate time
videoScreen.SetPositionNotificationPeriod(1)
videoScreen.SetMessagePort(CreateObject("roMessagePort"))
videoScreen.Show()

return videoScreen
End Function

Sub PlayContentWithAds(videoContent as Object)
canvas = CreateObject("roImageCanvas")
canvas.SetLayer(1, {color: "#000000"})
canvas.SetLayer(2, {text: "Loading..."})
canvas.Show()

adIface = Roku_Ads()
print "Roku_Ads library version: " + adIface.getLibVersion()
' Normally, would set publisher's ad URL here. Otherwise uses default Roku ad server (with single preroll placeholder ad)
'adIface.setAdUrl()

adPods = adIface.getAds()
playContent = adIface.showAds(adPods) ' show preroll ad pod (if any)

curPos = 0
if playContent
videoScreen = PlayVideoContent(videoContent)
end if

closingContentScreen = false
contentDone = false
while playContent
videoMsg = wait(0, videoScreen.GetMessagePort())
if type(videoMsg) = "roVideoScreenEvent"
if videoMsg.isStreamStarted()
canvas.ClearLayer(2)
end if
if videoMsg.isPlaybackPosition()
' cache current playback position for resume after midroll ads
curPos = videoMsg.GetIndex()
end if

if not closingContentScreen ' don't check for any more ads while waiting for screen close
if videoMsg.isScreenClosed() ' roVideoScreen sends this message last for all exit conditions
playContent = false
else if videoMsg.isFullResult()
contentDone = true ' don't want to resume playback after postroll ads
end if

' check for midroll/postroll ad pods
adPods = adIface.getAds(videoMsg)
if adPods <> invalid and adPods.Count() > 0
' must completely close content screen before showing ads
' for some Roku platforms (e.g., RokuTV), calling Close() will not synchronously
' close the media player and may prevent a new media player from being created
' until the screen is fully closed (app has received the isScreenClosed() event)
videoScreen.Close()
closingContentScreen = true
end if
else if videoMsg.isScreenClosed()
closingContentScreen = false ' now safe to render ads
end if ' closingContentScreen

if not closingContentScreen and adPods <> invalid and adPods.Count() > 0
' now safe to render midroll/postroll ads
playContent = adIface.showAds(adPods)
playContent = playContent and not contentDone
if playContent
' resume video playback after midroll ads
videoContent.PlayStart = curPos
videoScreen = PlayVideoContent(videoContent)
end if
end if ' !closingContentScreen
end if ' roVideoScreenEvent
end while
if type(videoScreen) = "roVideoScreen" then videoScreen.Close()
End Sub



'********************************************************************
'** Given the category from the filter banner, return an array
'** of ContentMetaData objects (roAssociativeArray's) representing
'** the shows for the category. For this example, we just cheat and
'** create and return a static array with just the minimal items
'** set, but ideally, you'd go to a feed service, fetch and parse
'** this data dynamically, so content for each category is dynamic
'********************************************************************
Function GetShowdownMenuOptions_2016() as object
options = [


{
ShortDescriptionLine1:"Show #2",
ShortDescriptionLine2:"Short Description for Show #2",
HDPosterUrl:"pkg:/media/bogusFileName_hd.jpg",
SDPosterUrl:"pkg:/media/bogusFileName_hd.jpg"
}
]

return options
End Function


But I cant get the menu to show the springboard screen


while (true)
msg = wait(0, port)
if type(msg) = "roGridScreenEvent"
else if (msg.isListItemSelected())
showSpringboardScreen(itemVenter)
'showSpringboardScreen(itemMpeg4) 'uncomment this line and comment out the next to see the old mpeg4 example
'showSpringboardScreen(item) 'uncomment this line to see the BigBuckBunny example

endif

end while
0 Kudos
RokuMarkn
Visitor

Re: Install error

I don't think you want that "else" in the isListItemSelected test.

--Mark
0 Kudos