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: 
radargaming
Visitor

MRSS Live

I have got RSS working on the MRSS channel I was wondering how I could incorporate a M8U3 file into the app? Thanks
0 Kudos
11 REPLIES 11
RokuJoel
Binge Watcher

Re: MRSS Live

one way would be to have a Live item in the config.opml pointing to a feed with one item which is the Live content, however, if you take a look at line 36 from NWM_MRSS.brs:

for each item in xml.channel.item
newItem = {
streams: []
streamFormat: "mp4"
actors: []
categories: []
contentType: "episode"
}


you see that it is auto-assigning the stream format to mp4 regardless of the actual streamformat. So you would have to introduce some logic to set the stream format to "hls" based on some tag in your Live mrss item.

- Joel
0 Kudos
radargaming
Visitor

Re: MRSS Live

Thanks for getting back Joel. I am a noob when it comes to making Roku apps, Is there any way to set 2 different stream sources?
0 Kudos
uarlive
Visitor

Re: MRSS Live

Here is a snippet of the RSS channel code I used.

note: (This was over year ago but may still be helpful)

NWM_MRSS.brs file was modified here

xml = CreateObject("roXMLElement")
if xml.Parse(raw)
for each item in xml.channel.item
newItem = {
streams: []
streamFormat: []
actors: []
categories: []
contentType: "episode"
}

' title
tmp = item.GetNamedElements("media:title")
if tmp.Count() > 0
newItem.title = util.HTMLEntityDecode(ValidStr(tmp[0].GetText()))
newItem.shortDescriptionLine1 = util.HTMLEntityDecode(ValidStr(tmp[0].GetText()))
else
newItem.title = util.HTMLEntityDecode(ValidStr(item.title.GetText()))
newItem.shortDescriptionLine1 = util.HTMLEntityDecode(ValidStr(item.title.GetText()))
end if

' streamFormat
if item.enclosure.count() > 0
for each enclosure in item.enclosure

if item.enclosure@type = "hls"
fileFormat = "hls"
else if item.enclosure@type = "video/x-mp4"
fileFormat = "mp4"
else if item.enclosure@type = "video/mp4"
fileFormat = "mp4"
else if fileFormat = ""
end if

newItem.streamFormat = fileFormat
end for
end if


Then I modified the addVideoScreen.brs

1. Added a function called displayVideo which calls the live feed -- (Some of the code from the simplevideoplayer template was integrated)
2. Added another function for error messages.

Hope this helps.
0 Kudos
tvjay
Channel Surfer

Re: MRSS Live

I am very new to Roku development and just had a couple of questions.

Do you mean you modified appVideoSreen.brs?
If so, how do you call that function?
Can you post that code?
0 Kudos
coryatcf
Visitor

Re: MRSS Live

Hello,

I am also very interested in incorporating a live stream M8U3 into a working MRSS channel. I tried modifying NWM_MRSS.brs with uarlive's code, but that won't let it load the non-live item in config.opml that was working (just gets stuck "Retrieving"), so I haven't even tried it yet with a Live item.

Are the indentations in the code sample correct, or is there anything amiss there that anyone can see? Has anybody else figured out how to do this?

Thanks!
0 Kudos
tvjay
Channel Surfer

Re: MRSS Live

Here is the modified part of config.opml

<outline title="Live Video" subtitle="Watch live content from ####" img="http://www.####.com/LiveVideoHD.png" url="http://www.####.com/streaming.xml"/>


Then here is my streaming.xml.

<?xml version="1.0" encoding="utf-8" ?> 
<rss version="2.0">
<channel>

<title>####</title>
<link>http://www.####.com</link>
<description></description>

<item>
<title>Live Newscast</title>
<category>Streaming Video</category>
<description>We're proud to be the only news station in #### to offer live streaming on your Roku.</description>
<streamformat>hls</streamformat>
<media:content url="http://www.###.com/master.m3u8"/>
<media:thumbnail url="http://www.####.com/StreamingHD.png" />
</item>

</channel>
</rss>


Then I added this to NWM_MRSS.brs

' streamformat
if item.GetNamedElements("streamformat").Count() > 0
tmp = item.GetNamedElements("streamformat")
newItem.streamformat = ValidStr(tmp[0].GetText())
end if


I do not believe I modified anything else to make it work. No appvideo screen modifications or anything like that.
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: MRSS Live

This is a good discussion and if you find a solution that works for your purposes, thats great. I just want to take a minute to point out that once you add a streamformat element to your XML, it is technically no longer valid MRSS because the new element is not defined by the MRSS spec (http://www.rssboard.org/media-rss).

Another solution that complies with the spec is to make use of the type attribute of the media:content element.

"http wrote:
type is the standard MIME type of the object. It is an optional attribute.


So you would give it a value that is one of the accepted mime types for HLS content: application/vnd.apple.mpegurl or application/x-mpegURL.

Or, since RSS is extensible, you could define your own namespace for a new element, but I think think the mime type is the better solution.
0 Kudos
tvjay
Channel Surfer

Re: MRSS Live

So what code changes would be needed to make that happen?
0 Kudos
coryatcf
Visitor

Re: MRSS Live

@tvjay

I used the same approach, but also changed this line in NWM_MRSS.brs from "streamFormat: mp4" to "streamFormat: []" to get it to parse the tag instead of just assigning a default value

	xml = CreateObject("roXMLElement")
if xml.Parse(raw)
for each item in xml.channel.item
newItem = {
streams: []
streamFormat: []
Live: []
actors: []
categories: []
contentType: "episode"
}
0 Kudos