Forum Discussion

fortscan's avatar
fortscan
Visitor
15 years ago

XML syntax for roArray items (like StreamUrls)

Can anyone confirm what is the correct syntax in order to define the StreamUrls, StreamBitrates, StreamQualities arrays directly at the XML feed?

At ShowFeed.brs from videoplayer example there is a section that seems to pull that info from StreamUrl, StreamBitrate, StreamQuality:

'media may be at multiple bitrates, so parse an build arrays
for idx = 0 to 2
e = curShow.media[idx]
if e <> invalid then

item.StreamBitrates.Push(strtoi(validstr(e.streamBitrate.GetText())))
item.StreamQualities.Push(validstr(e.streamQuality.GetText()))
item.StreamUrls.Push(validstr(e.streamUrl.GetText()))
endif
next idx


But the correct way of defining this at the XML feed does not seem to be documented...

We have tried several combinations like:

<StreamUrl>http://url1 , http://url2</StreamUrl>

<StreamUrl>"http://url1" , "http://url2"</StreamUrl>

<StreamUrl>"http://url1 , http://url2"</StreamUrl>


But it doesn't seem to work (perhaps it doesn't create the array...)

A suggestion regarding this would be very appreciated.

Thanks.

2 Replies

  • The videoplayer example includes sample XML. Have you looked at that? One of the sample feeds can be found at http://rokudev.roku.com/rokudev/example ... hemind.xml

    It is also worth noting that BrightScript can parse and make use of any XML schema you want to use. You should not feel locked into the specific schema used by the SDK samples.
  • Hi,

    Thank you very much for your quick reply, we appreciate it.

    We are familiar with the XML examples. The feature we weren't able to find was how to define the proper XML "media" settings so that the function parse_show_feed could fecth all the "StreamURL" values and build the corresponding array to be mapped to "StreamURLs". We needed this because we will begin implementing 4 different bitrates for all of our videos at CDN level (i.e. 600k, 1000k, 1500k, 2000k).

    After searching a lot we found the answe to our own question. Just in case it's useful for someone else reading this post, the proper way of including additional StreamURL links, tied to specific StreamBitrate and StreamQuality, directly at the XML level, so that parse_show_feed (like in showFeed.brs from videoplayer example) can fetch it and build the corresponding array was to extra "media" blocks, like the following:

    <media>
    <streamQuality>SD</streamQuality>
    <streamBitrate>1000</streamBitrate>
    <streamUrl>http://video_encoded_at_1000k.mp4</streamUrl>
    </media>

    <media>
    <streamQuality>SD</streamQuality>
    <streamBitrate>1500</streamBitrate>
    <streamUrl>http://video_encoded_at_1500k.mp4</streamUrl>
    </media>

    (...)


    Everything inside the beginning and ending "item" tags defining the content.

    Thanks.