hpdean
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2016
08:52 AM
Live Stream Offline Image
I am a beginner with this and I need help! I am switching live streaming services. We only stream our service once a week, so for the majority of the time, our live stream is not active. My previous stream host streamed an offline loop to the HLS stream, however, my new stream host does not do this. I need to see if there is any way to do this within the roku code. Here is how my current live stream is hard coded into the channel:
Is it possible to have a fallback image or something, that tells the channel to check the HLS stream first and then fall back to image if no stream is active?
Function showHomeScreen(screen) As Integer
if validateParam(screen, "roPosterScreen", "showHomeScreen") = false return -1
initCategoryList()
screen.SetContentList(m.Categories.Kids)
screen.SetFocusedListItem(0)
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent" then
print "showHomeScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.isListFocused() then
print "list focused | index = "; msg.GetIndex(); " | category = "; m.curCategory
else if msg.isListItemSelected() then
print "list item selected | index = "; msg.GetIndex()
kid = m.Categories.Kids[msg.GetIndex()]
if kid.type = "About Us" then
ShowParagraphScreen()
else if kid.type = "Hope Point Live Stream" then
' method 1: hard code the stream here in the channel
' init the video item now and go to video:
item = init_show_feed_item()
item.StreamBitrates.Push(2000)
item.StreamQualities.Push("SD")
item.StreamFormat = "hls"
item.StreamUrls.Push(validstr("http://www.yourstreamlive.com/live/901/hls"))
showVideoScreen(item)
else if kid.Title = "Hope Point Live Stream"
' method 2: key it off some element in the xml so you can update the stream later
' try to get the video item from the kid's xml and play it now
shows = getShowsForCategoryItem(kid, 0)
showVideoScreen(shows[0])
else
displayCategoryPosterScreen(kid)
end if
else if msg.isScreenClosed() then
return -1
end if
end If
end while
return 0
End Function
Is it possible to have a fallback image or something, that tells the channel to check the HLS stream first and then fall back to image if no stream is active?
3 REPLIES 3

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2016
06:25 PM
Re: Live Stream Offline Image
Look for msg.isRequestFailed() and if it is, then load an imageCanvas and show a poster image, of course you will need to listen for the back-button and up button events to exit the roImageCanvasScreen.
- Joel
- Joel
jmatt0806
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2017
03:33 PM
Re: Live Stream Offline Image
"hpdean" wrote:
I am a beginner with this and I need help! I am switching live streaming services. We only stream our service once a week, so for the majority of the time, our live stream is not active. My previous stream host streamed an offline loop to the HLS stream, however, my new stream host does not do this. I need to see if there is any way to do this within the roku code. Here is how my current live stream is hard coded into the channel:Function showHomeScreen(screen) As Integer
if validateParam(screen, "roPosterScreen", "showHomeScreen") = false return -1
initCategoryList()
screen.SetContentList(m.Categories.Kids)
screen.SetFocusedListItem(0)
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent" then
print "showHomeScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.isListFocused() then
print "list focused | index = "; msg.GetIndex(); " | category = "; m.curCategory
else if msg.isListItemSelected() then
print "list item selected | index = "; msg.GetIndex()
kid = m.Categories.Kids[msg.GetIndex()]
if kid.type = "About Us" then
ShowParagraphScreen()
else if kid.type = "Hope Point Live Stream" then
' method 1: hard code the stream here in the channel
' init the video item now and go to video:
item = init_show_feed_item()
item.StreamBitrates.Push(2000)
item.StreamQualities.Push("SD")
item.StreamFormat = "hls"
item.StreamUrls.Push(validstr("http://www.yourstreamlive.com/live/901/hls"))
showVideoScreen(item)
else if kid.Title = "Hope Point Live Stream"
' method 2: key it off some element in the xml so you can update the stream later
' try to get the video item from the kid's xml and play it now
shows = getShowsForCategoryItem(kid, 0)
showVideoScreen(shows[0])
else
displayCategoryPosterScreen(kid)
end if
else if msg.isScreenClosed() then
return -1
end if
end If
end while
return 0
End Function
Is it possible to have a fallback image or something, that tells the channel to check the HLS stream first and then fall back to image if no stream is active?
I see if your channel you have a dialog pop-up if the stream isn't active. How did you end up doing this?
Thanks
IVEN
Newbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2024
11:04 AM
Re: Live Stream Offline Image
Sorry , do you have the complate solution sample zip file , it will help me alot
thanks