dabulls312
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2015
10:20 PM
M3U8 + AES Encryption Key
I'm trying to play an m3u8 file that is encrypted. The m3u8 has an AES key file that is used to decrypt the stream.
How would I go about applying that AES key file into the following code in order to have the file decrypted for Roku to play it? NOTE: This code was initially created for an m3u8 file that was not encrypted. I basically need to understand what line(s) to add in order for the decryption to take place.
How would I go about applying that AES key file into the following code in order to have the file decrypted for Roku to play it? NOTE: This code was initially created for an m3u8 file that was not encrypted. I basically need to understand what line(s) to add in order for the decryption to take place.
Sub RunUserInterface()
screenFacade = CreateObject("roPosterScreen")
screenFacade.show()
port = CreateObject("roMessagePort")
videoScreen = CreateObject("roVideoScreen")
videoScreen.setMessagePort(port)
videoScreen.SetPositionNotificationPeriod(10)
videoclip = {}
videoclip.StreamUrls = ["URL.m3u8"]
videoclip.StreamFormat = "hls"
videoclip.ContentType = "movie"
videoclip.title = "MOVIE"
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
7 REPLIES 7
dabulls312
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2015
05:23 PM
Re: M3U8 + AES Encryption Key
Anyone?

kc8pql
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2015
08:30 PM
Re: M3U8 + AES Encryption Key
It's the weekend...More devs are around workdays.
____________________________________________________________________________________________________________
No, I don't work for Roku.
Netflix Player N1000X, XDS 2100X (premature death by lightning)
Roku2 XD 3050X, Roku2 XS 3100R, Roku2 4210R
No, I don't work for Roku.
Netflix Player N1000X, XDS 2100X (premature death by lightning)
Roku2 XD 3050X, Roku2 XS 3100R, Roku2 4210R


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2015
11:20 AM
Re: M3U8 + AES Encryption Key
Assuming you've implemented the encryption according to the HLS spec using the #EXT-X-KEY tag, you don't necessarily have to do anything in BrightScript to make it work. The firmware will handle it automatically. You may need to add a call to SetCertificatesFile() to get any HTTPS requests working.
http://sdkdocs.roku.com/display/sdkdoc/ ... thasString)asBoolean
http://sdkdocs.roku.com/display/sdkdoc/ ... thasString)asBoolean
dabulls312
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2015
08:09 PM
Re: M3U8 + AES Encryption Key
"RokuChris" wrote:
Assuming you've implemented the encryption according to the HLS spec using the #EXT-X-KEY tag, you don't necessarily have to do anything in BrightScript to make it work. The firmware will handle it automatically. You may need to add a call to SetCertificatesFile() to get any HTTPS requests working.
http://sdkdocs.roku.com/display/sdkdoc/ ... thasString)asBoolean
Can you elaborate a bit more using the sample code I posted?
Sorry, I am still at the 101 level.
dabulls312
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2015
10:57 AM
Re: M3U8 + AES Encryption Key
Just following up here.
I have a .m3u8 file AND a .key file.
How do I play the .m3u8 on my Roku?
I have a .m3u8 file AND a .key file.
How do I play the .m3u8 on my Roku?


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2015
12:31 PM
Re: M3U8 + AES Encryption Key
You don't have to do any different in BrightScript. The key needs to be specified in your HLS manifest.
The Encoding Guide talks about this: http://sdkdocs.roku.com/display/sdkdoc/ ... Encryption
As does the HLS spec: https://tools.ietf.org/html/draft-panto ... tion-6.2.3
The Encoding Guide talks about this: http://sdkdocs.roku.com/display/sdkdoc/ ... Encryption
As does the HLS spec: https://tools.ietf.org/html/draft-panto ... tion-6.2.3
chaklasiyanikun
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020
01:12 AM
Re: M3U8 + AES Encryption Key
With AES Encryption. I have the same problem. Did you find any solution for this?