I have got RSS working on the MRSS channel I was wondering how I could incorporate a M8U3 file into the app? Thanks
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
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?
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
- Added a function called displayVideo which calls the live feed – (Some of the code from the simplevideoplayer template was integrated)
- Added another function for error messages.
Hope this helps.
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?
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!
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.
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.
So what code changes would be needed to make that happen?
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"
}
Oh yeah, sorry I forgot about that change. Does it everything work for you now?
Yep, thanks. I got the “live” tag to work as well (just didn’t need quotes parsing it, because it’s a Boolean value, not text).
Btw, in regards to keeping it in MRSS spec I suppose you would just need to change the NWM_MRSS.brs code to parse compliant tags (e.g. media:content instead of streamFormat, and then have it assign the media:content value to the streamFormat variable, i.e. streamFormat = valueextracted)
