Parts of a code I cannot Understand.It works though

here is my appMain.brs file

1 bitrates = [0]
2
3 'Swap the commented values below to play different video clips…
4 'srt = “file://pkg:/source/craigventer.srt” 'doNot Work
5 srt =“”
6 ’ Big Buck Bunny test stream from Wowza
7 'urls = [“http://ec2-174-129-153-104.compute-1.amazonaws.com:1935/vod/smil:BigBuckBunny.smil/playlist.m3u8”] 'No Work
8 'urls = [“http://184.xxx.xxx.xx9/vod/smil:BigBuckBunny.smil/playlist.m3u8”] 'This External works
9 urls = [“http://myserver:1935/vod/mp4:sample.mp4/playlist.m3u8”] 'My Server Works
10 qualities = [“SD”]
11 streamformat = “hls”
12 'streamformat = “mp4” 'this doesnot work
13 title = “Big Buck Bunny”

Here are the Questions

line 4 srt=“file…” donot work and so I had to use srt=“” (see line 5).I would like to fix this since it puts a caption on the bottom of the movie (see my debug log also) ?

line 7 the original url of the amazon bucket that comes with the examples do not work,I found the url in line 8 which works and enable me me to better debug my problem.Should the examples be updated for these url?

line 9,11 & 12 I found that I had to use “hls” as the stream format yet this is a vod(video on demand stream) of an mp4 file which is place in the content directory.What impact will this have on a live stream? is it that for all streams format from third party servers to the Roku DVP have to be “hls”?

Now for the stupid question of the day “what does the “smil” stands for in {urls = [“http://184.xxx.xxx.xx9/vod/smil:BigBuckBunny.smil/playlist.m3u8”]} and is it used for streaming live?”

Here is my debuglog
onevoisses@onevoisses:~$ telnet xxx.xxx.xxx.xxx 8085
Trying xxx.xxx.xxx.xxx…
Connected to xxx.xxx.xxx.xxx.
Escape character is ‘^]’.
0 [homescreen]
roAssociativeArray refcnt= 1 addr=0x5c1b6ad0
roString refcnt= 1 addr=0x5c1dfdb8 [homescreen]
------ Running ------
Type args = roAssociativeArray
Type args.url = Invalid
showSpringboardScreen
Button pressed: 1 0
Displaying video:
srt = file://pkg:/source/craigventer.srt
Unknown event: 20 msg: Stream started.
Unknown event: 16 msg: Playback completed.
Closing video screen
Button pressed: 1 0
Displaying video:
srt = file://pkg:/source/craigventer.srt
Unknown event: 20 msg: Stream started.
Unknown event: 16 msg: Playback completed.
Closing video screen
Screen closed
Leaked bsc instances:
roAssociativeArray refcnt= 1 addr=0x5ccfa668
roString refcnt= 1 addr=0x547901d0 [auto-run-dev]
------ Running ------
Type args = roAssociativeArray
Type args.url = Invalid
showSpringboardScreen
Button pressed: 1 0
Displaying video:
srt = file://pkg:/source/craigventer.srt
Unknown event: 20 msg: Stream started.
Unknown event: 15 msg: Playback interrupted by user.
Closing video screen
Screen closed
Leaked bsc instances:
roAssociativeArray refcnt= 1 addr=0x5cc79b60
roString refcnt= 1 addr=0x5474c060 [auto-run-dev]
------ Running ------
Type args = roAssociativeArray
Type args.url = Invalid
showSpringboardScreen
Button pressed: 1 0
Displaying video:
srt = file://pkg:/source/craigventer.srt
play failed: An unexpected problem (but not server timeout or HTTP error) has been detected.
Closing video screen
Button pressed: 1 0
Displaying video:
srt = file://pkg:/source/craigventer.srt
play failed: An unexpected problem (but not server timeout or HTTP error) has been detected.
Closing video screen
*** ERROR compiling /pkg:/source/appMain.brs:
Syntax Error. (compile error &h02) in …M8IdZ/pkg:/source/appMain.brs(176)
Screen closed
*** ERROR compiling /pkg:/source/appMain.brs:
Syntax Error. (compile error &h02) in …qcLFB/pkg:/source/appMain.brs(176)
Leaked bsc instances:
roAssociativeArray refcnt= 1 addr=0x5d0e1d18
roString refcnt= 1 addr=0x547245d0 [auto-run-dev]
------ Running ------
Type args = roAssociativeArray
Type args.url = Invalid
showSpringboardScreen
Button pressed: 1 0
Displaying video:
srt = file://pkg:/source/craigventer.srt
Unknown event: 20 msg: Stream started.
Unknown event: 11 msg: Content contains no playable tracks.
play failed:
Closing video screen
Button pressed: 1 0
Displaying video:
srt = file://pkg:/source/craigventer.srt
Unknown event: 20 msg: Stream started.
Unknown event: 11 msg: Content contains no playable tracks.
play failed:
Closing video screen
Button pressed: 1 0
Displaying video:
srt = file://pkg:/source/craigventer.srt
Unknown event: 20 msg: Stream started.
Unknown event: 11 msg: Content contains no playable tracks.
play failed:
Closing video screen
Screen closed
Leaked bsc instances:
roAssociativeArray refcnt= 1 addr=0x5ccf9dd0
roString refcnt= 1 addr=0x5c2a63d0 [auto-run-dev]
------ Running ------
Type args = roAssociativeArray
Type args.url = Invalid
showSpringboardScreen
Button pressed: 1 0
Displaying video:
srt =
Unknown event: 20 msg: Stream started.
Unknown event: 11 msg: Content contains no playable tracks.
play failed:
Closing video screen
Screen closed
Leaked bsc instances:
roAssociativeArray refcnt= 1 addr=0x5c21adb8
roString refcnt= 1 addr=0x54727c80 [auto-run-dev]
------ Running ------
Type args = roAssociativeArray
Type args.url = Invalid
showSpringboardScreen
Button pressed: 1 0
Displaying video:
srt =
Unknown event: 20 msg: Stream started.
Unknown event: 16 msg: Playback completed.
Closing video screen
Screen closed
Leaked bsc instances:
roAssociativeArray refcnt= 1 addr=0x5c274db0
roString refcnt= 1 addr=0x5472b110 [auto-run-dev]
------ Running ------
Type args = roAssociativeArray
Type args.url = Invalid
showSpringboardScreen
Button pressed: 1 0
Displaying video:
srt =
Unknown event: 20 msg: Stream started.
Unknown event: 16 msg: Playback completed.
Closing video screen

my server console logs is attached
Please note that with the parameters above this works but is it the correct way.?

No more coffee Let me go shuteye country for a Vacation of 5hrs.

  1. Make sure you have the file, craigventer.srt, in the same source directory as your appmain.brs file.
  2. Yes, the url, http://ec2-174-129-153-104.compute-1.am … ylist.m3u8, no longer works and the examples should be updated with a correct url such as, http://en.wikipedia.org/wiki/Synchronized_Multimedia_Integration_Language

Ok so Here is my Problem

I tried this
viewtopic.php?f=34&t=35019&start=0
viewtopic.php?f=34&t=41927&p=284442&hilit=video+player#p284442

And I read this
viewtopic.php?f=34&t=39143

and I know there are people who get the Videoplayer to work with hls but here is what i get when I tried the video player on a live stream

telnet 1st

created feed connection for http://xxx.xxx.xxx.xxx/live.xml
url: http://xxx.xxx.xxx.xxx/live.xml
Request Time: 16
Can’t parse feed
list focused | current category = 0

then my xml is

xml file

NASA 10001 Talk SD hls SD 1500 [http://iphoned5.akamai.com.edgesuite.net/mhbarron/nasatv/nasatv_all.m3u8](http://iphoned5.akamai.com.edgesuite.net/mhbarron/nasatv/nasatv_all.m3u8) 1260

when I validate the xml it has no errors
the feed works with both the simplevideoplayer and the customplayer
I have a wowza server and it works to with the simplevideoplayer and the customplayer even with my local live stream

I am using Roku 2 XD with developers version 2.9 and it side loads okay

I also change the StreamBirate to 0 and it still didnot work and my streamFormat is hls so can you tel me why its not parsing on the videoplayer?

and this URL also works http://www.nasa.gov/multimedia/nasatv/N … c-IPS.m3u8 with the customplayer and simplevideoplayer

Can’t parse XML means there is an issue getting the data from your xml file. Although it passes the xml validator, you might try adding a declaration that it is an XML file at the top. The declaration is optional, but perhaps Roku needs it.

http://www.ibm.com/developerworks/xml/l … index.html

An example declaration is

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

Just a thought…I’ve never tried sending roku an xml file without it, and don’t see issues by including it.

If that’s not the problem, then look at your parsing code and see where the message “Can’t parse feed” shows up. Then backtrack to determine the issue. Maybe your code is looking for a ‘category’ tag, and if that is missing it tosses up the message.

Here is the backtrace

CBrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.

Current Function:
034: Function showPosterScreen(screen As Object, category As Object) As Integer
035:
036: if validateParam(screen, “roPosterScreen”, “showPosterScreen”) = false return -1
037: if validateParam(category, “roAssociativeArray”, “showPosterScreen”) = false return -1
038:
039: m.curCategory = 0
040: m.curShow = 0
041:
042: screen.SetListNames(getCategoryList(category))
043: screen.SetContentList(getShowsForCategoryItem(category, m.curCategory))
044: screen.Show()
045:
046: while true
047: msg = wait(0, screen.GetMessagePort())
048: if type(msg) = “roPosterScreenEvent” then
049: print "showPosterScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
050: if msg.isListFocused() then
051: m.curCategory = msg.GetIndex()
052: m.curShow = 0
053: screen.SetFocusedListItem(m.curShow)
054: screen.SetContentList(getShowsForCategoryItem(category, m.curCategory))
055: print "list focused | current category = "; m.curCategory
056: else if msg.isListItemSelected() then
057: m.curShow = msg.GetIndex()
058: print "list item selected | current show = "; m.curShow
059: m.curShow = displayShowDetailScreen(category, m.curShow)
060: screen.SetFocusedListItem(m.curShow)
061: print "list item updated | new show = "; m.curShow
062: else if msg.isScreenClosed() then
063: return -1
064: end if
065: end If
066: end while
067:
068:
069: End Function
Break in 47
047: msg = wait(0, screen.GetMessagePort())
Backtrace:
Function showposterscreen(screen As , category As ) As Integer
file/line: /tmp/plugin/GBAAAALtEatE/pkg:/source/appPosterScreen.brs(47)
Function displaycategoryposterscreen(category As ) As
file/line: /tmp/plugin/GBAAAALtEatE/pkg:/source/appHomeScreen.brs(79)
Function showhomescreen(screen As ) As Integer
file/line: /tmp/plugin/GBAAAALtEatE/pkg:/source/appHomeScreen.brs(56)
Function main() As
file/line: /tmp/plugin/GBAAAALtEatE/pkg:/source/appMain.brs(20)

Local Variables:
screen &h0010 bsc:roPosterScreen, refcnt=2
category &h4010 bsc:roAssociativeArray, refcnt=6
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=5
msg &h0000 val:Uninitialized
BrightScript Debugger>

I notice that its say that I have unitialized variable (screen and category) but that was done in line 034 as a function so isn’t it supposed to be available globally.

Should I change this to a sub instead of a function?
Should they be declared in the homescreen rather than the posterscreen?

I hope we get this I have been working on this none stop for the past three days.Passionate about it being solved

This is ironic,the program runs on every leaf of the category except the live.xml and the syntax are all the same.I even put the hls in another category leaf and it breaks it too.

Where it says “Can’t parse feed”
replace that line of code with STOP
Then you can be right in the parse routine in the debugger and you can print xml to see what it shows you there, and run through the lines manually to figure out what the real issue is.

The real section of code that is failing will look something like this:

Function load_show_feed(conn As Object) As Dynamic
If validateParam(conn, “roAssociativeArray”, “load_show_feed”)=FALSE Return invalid
Print "url: " + conn.UrlShowFeed
http=NewHttp(conn.UrlShowFeed)
m.Timer.Mark()
rsp=http.GetToStringWithRetry()
Print "Request Time: " + itostr(m.Timer.TotalMilliseconds())
feed=newShowFeed()
xml=CreateObject(“roXMLElement”)
If Not xml.Parse(rsp)
Print “Can’t parse feed”
Return feed
End If
If xml.GetName() <> “feed”
Print “no feed tag found”
Return feed
End If
If islist(xml.GetBody()) = FALSE Then
Print “no feed body found”
Return feed
End If
m.Timer.Mark()
m.ParseShowFeed(xml, feed)
Print "Show Feed Parse Took : " + itostr(m.Timer.TotalMilliseconds())
Return feed
End Function

try replacing that line with stop
and in the debugger try to print rsp and see what shows up

This is what I get.
I tried 7 other alternatives,still cannot see the answer

  • Running ------
    created feed connection for http://xxx.xxx.xxx.xxx/xml/categories.xml
    url: http://xxx.xxx.xxx.xxx/xml/categories.xml
    Took: 10ms
    Parse Took: 5ms
    begin category node parsing
    number of categories: 5
    ParseCategoryNode: banner_ad
    ParseCategoryNode skip: banner_ad
    parse returned no child node
    ParseCategoryNode: category
    category:
    categoryLeaf:
    ParseCategoryNode: categoryLeaf
    categoryLeaf:
    ParseCategoryNode: categoryLeaf
    added new child node
    ParseCategoryNode: category
    category: Live Shows | Streaming Live
    categoryLeaf: Live
    ParseCategoryNode: categoryLeaf
    categoryLeaf:
    ParseCategoryNode: categoryLeaf
    added new child node
    ParseCategoryNode: category
    category: On Demand | Past Shows and Events
    categoryLeaf: Archives
    ParseCategoryNode: categoryLeaf
    added new child node
    ParseCategoryNode: category
    category:
    categoryLeaf: Archives
    ParseCategoryNode: categoryLeaf
    added new child node
    Traversing: 29ms
    showHomeScreen | msg = | index = 2
    showHomeScreen | msg = | index = 1
    showHomeScreen | msg = | index = 1
    list item selected | index = 1
    created feed connection for http://xxx.xxx.xxx.xxx/xml/live.xml
    url: http://xxx.xxx.xxx.xxx/xml/live.xml
    Request Time: 15
    Current Function:
    076: Function load_show_feed(conn As Object) As Dynamic
    077:
    078: if validateParam(conn, “roAssociativeArray”, “load_show_feed”) = false return invalid
    079:
    080: print "url: " + conn.UrlShowFeed
    081: http = NewHttp(conn.UrlShowFeed)
    082:
    083: m.Timer.Mark()
    084: rsp = http.GetToStringWithRetry()
    085: print "Request Time: " + itostr(m.Timer.TotalMilliseconds())
    086:
    087: feed = newShowFeed()
    088: xml=CreateObject(“roXMLElement”)
    089: if not xml.Parse(rsp) then
    090: 'print “Can’t parse feed”
    091: Stop
    092: return feed
    093: endif
    094:
    095: if xml.GetName() <> “feed” then
    096: print “no feed tag found”
    097: return feed
    098: endif
    099:
    100: if islist(xml.GetBody()) = false then
    101: print “no feed body found”
    102: return feed
    103: endif
    104:
    105: m.Timer.Mark()
    106: m.ParseShowFeed(xml, feed)
    107: print "Show Feed Parse Took : " + itostr(m.Timer.TotalMilliseconds())
    108:
    109: return feed
    110:
    111: End Function
    STOP (runtime error &hf7) in …BeiL/pkg:/source/showFeed.brs(91)

091: Stop
Backtrace:
Function load_show_feed(conn As ) As
file/line: /tmp/plugin/FCAAA…BeiL/pkg:/source/showFeed.brs(92)
Function getshowsforcategoryitem(category As , item As Integer) As
file/line: /tmp/plugin/FCAAAA1CBeiL/pkg:/source/appPosterScreen.brs(123)
Function showposterscreen(screen As , category As ) As Integer
file/line: /tmp/plugin/FCAAAA1CBeiL/pkg:/source/appPosterScreen.brs(43)
Function displaycategoryposterscreen(category As ) As
file/line: /tmp/plugin/FCAAAA1CBeiL/pkg:/source/appHomeScreen.brs(79)
Function showhomescreen(screen As ) As Integer
file/line: /tmp/plugin/FCAAAA1CBeiL/pkg:/source/appHomeScreen.brs(56)
Function main() As
file/line: /tmp/plugin/FCAAAA1CBeiL/pkg:/source/appMain.brs(20)

Local Variables:
conn &h0010 bsc:roAssociativeArray, refcnt=4
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=4
http &h0010 bsc:roAssociativeArray, refcnt=1
rsp &h8010 bsc:roString (2.1 was String), refcnt=1
feed &h0010 bsc:roArray, refcnt=1
xml &h0010 bsc:roXMLElement, refcnt=1
BrightScript Debugger>

First thing would be to print rsp to make sure it contains what you think it contains.

–Mark

So is it saying that my posterscreen is the problem ? line 47

Request Time: 33
rsp:
^CCurrent Function:
034: Function showPosterScreen(screen As Object, category As Object) As Integer
035:
036: if validateParam(screen, “roPosterScreen”, “showPosterScreen”) = false return -1
037: if validateParam(category, “roAssociativeArray”, “showPosterScreen”) = false return -1
038:
039: m.curCategory = 0
040: m.curShow = 0
041:
042: screen.SetListNames(getCategoryList(category))
043: screen.SetContentList(getShowsForCategoryItem(category, m.curCategory))
044: screen.Show()
045:
046: while true
047: msg = wait(0, screen.GetMessagePort())
048: if type(msg) = “roPosterScreenEvent” then
049: print "showPosterScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
050: if msg.isListFocused() then
051: m.curCategory = msg.GetIndex()
052: m.curShow = 0
053: screen.SetFocusedListItem(m.curShow)
054: screen.SetContentList(getShowsForCategoryItem(category, m.curCategory))
055: print "list focused | current category = "; m.curCategory
056: else if msg.isListItemSelected() then
057: m.curShow = msg.GetIndex()
058: print "list item selected | current show = "; m.curShow
059: m.curShow = displayShowDetailScreen(category, m.curShow)
060: screen.SetFocusedListItem(m.curShow)
061: print "list item updated | new show = "; m.curShow
062: else if msg.isScreenClosed() then
063: return -1
064: end if
065: end If
066: end while
067:
068:
069: End Function
Break in 47
047: msg = wait(0, screen.GetMessagePort())
Backtrace:
Function showposterscreen(screen As , category As ) As Integer
file/line: /tmp/plugin/PCAAAABs49ef/pkg:/source/appPosterScreen.brs(47)
Function displaycategoryposterscreen(category As ) As
file/line: /tmp/plugin/PCAAAABs49ef/pkg:/source/appHomeScreen.brs(79)
Function showhomescreen(screen As ) As Integer
file/line: /tmp/plugin/PCAAAABs49ef/pkg:/source/appHomeScreen.brs(56)
Function main() As
file/line: /tmp/plugin/PCAAAABs49ef/pkg:/source/appMain.brs(20)

Local Variables:
screen &h0010 bsc:roPosterScreen, refcnt=2
category &h4010 bsc:roAssociativeArray, refcnt=6
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=5
msg &h0000 val:Uninitialized
BrightScript Debugger>

“onevoisses” wrote:
So is it saying that my posterscreen is the problem ? line 47

Request Time: 33
rsp:
^CCurrent Function:

No, it’s just saying that that’s where it was when you hit the interrupt. It was sitting in the event loop waiting for the next event. But before that, it looks like you printed rsp and it was empty. If so, you need to figure out why that variable is not getting a value.

Well,I think I deserve a Vitamin Water now,not a beer yet because I am up to

  • got the feeds to parse
  • but oops! just flash retrieving back to homescreen
  • i am tinkering with the bitrates,streamformat etc.

created feed connection for http://xxx.xxx.xxx.xxx/xml/live.xml
url: http://xxx.xxx.xxx.xxx/xml/live.xml
Request Time: 11
Show Feed Parse Took : 19
ButtonPressed
ButtonPressed
showHomeScreen | msg = Stream started. | index = 0
Unexpected event type: 20
showHomeScreen | msg = Content contains no playable tracks. | index = 0
Video status: 0 0
showHomeScreen | msg = | index = -5
Video request failure: -5 1
showHomeScreen | msg = | index = 0
Screen closed
Button pressed: 2 0

So its beer time now and let me impart what I did.

  • For testing I configure a local server with apache based on a popular linux distribution
    For development I am using a Roku 2 XD
    For Playback I am using a Roku 2 XS (optional)
    Remotely I have a few friends that I Introduce to Roku looking at my Private Channel (optional)
    I have a PC with Linux desktop install (try mint if you are a beginner)
    My Router is a 54g

First I went in the in appVideo.brs and turn on the print statement at this line

Step 1.
'Uncomment his line to dump the contents of the episode to be played

’ PrintAA(episode)

Use it to Troubleshoot your stream.,I would say turn it back off (comment it back) when you have locate the problem.

Mine was that I had network problem. It worked fine for the simple Videoplayer and Custom Videoplayer.

My thoughts is that if you are going to test hls, you need the bandwidth its time to ditch the 54g routers and upgrade go for 300N.They are design for streaming.

I would suggest invest in a private personal server with webhosting for testing.Use the cloud for production.

Step 2. turn on the debug logs.I found I had an uninitialised variable.This was caused by my reading of this

viewtopic.php?f=34&t=27612 and using this statement

episode.StreamFormat = episode.StreamFormats[0] in the appVideoplayer

the streamsformat have being fixed in the development kit ,it was only a fixed,it will brick your development.

I placed an elseif statement in the appshowfeed.brs to parse the feed formats for deciding wether its mp4 or hls

Step 3. follow your streams path

RokuMarkn suggest that “First thing would be to print rsp to make sure it contains what you think it contains.” this is in the appshowfeeds.brs
it what help me to find out the problem in Step 2.

Step 4. Do not be afraid to start over but made sure you have the latest development kit relevant to the environment you are developing with I am Using 2.9 there is a beta but not yet for me a beginner.

Step 5 .Grab some coffee, put the beer on Ice and read about the “snake” at the bottom of the
brightscript manual. and Read read read read.( I never read the manuals I just want the product to play).Not so Here

Best of luck and thanks to

RokuMarkn,RokuChris and destruk and of course Customer Service,I am getting my player that was never delivered.I am making it an early christmas present.Do not be cynical I am getting it for sure.Fedex told me.