Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
adrianc1982
Level 7

help playing this m3u8

can someone post a simple example how to play this file from url of course

http://www.nasa.gov/multimedia/nasatv/NTV-Public-IPS.m3u8


Thanks!
0 Kudos
3 REPLIES 3
renojim
Community Streaming Expert

Re: help playing this m3u8

Here ya go:
Sub RunUserInterface()
screenFacade = CreateObject("roPosterScreen")
screenFacade.show()

port = CreateObject("roMessagePort")
videoScreen = CreateObject("roVideoScreen")
videoScreen.setMessagePort(port)
videoScreen.SetPositionNotificationPeriod(10)

videoclip = {}
videoclip.StreamUrls = ["http://www.nasa.gov/multimedia/nasatv/NTV-Public-IPS.m3u8"]
videoclip.StreamFormat = "hls"
videoclip.ContentType = "movie"
videoclip.title = "NASA"
videoclip.StreamBitrates = [0]
videoclip.playstart = 0
videoclip.StreamQualities = ["SD"]
videoclip.SwitchingStrategy = "full-adaptation"
videoScreen.SetContent(videoclip)

videoScreen.show()
nowpos = 0
while true
msg = wait(0, port)
if type(msg) = "roVideoScreenEvent"
if msg.isScreenClosed() then 'ScreenClosed event'
print "Closing video screen"
exit while
else if msg.isPlaybackPosition() then
nowpos = msg.GetIndex()
print nowpos
else if msg.isRequestFailed()
print "play failed: "; msg.GetMessage()
else if msg.isFullResult()
print "isFullResult"
else if msg.isPartialResult()
print "isPartialResult, nowpos = ";nowpos
else if msg.isStreamStarted()
print "isStreamStarted"
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
end if
else
print "Event: ";type(msg)
print msg.GetInfo()
end if
end while

print "Exiting app"
screenFacade.showMessage("")
sleep(25)
End Sub

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
adrianc1982
Level 7

Re: help playing this m3u8

thanks ill give it a go right now 🙂
0 Kudos
adrianc1982
Level 7

Re: help playing this m3u8

thanks worked flawlessly.
0 Kudos