Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
videojs-contrib-hls
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
5a4d09f7
authored
2016-04-04 15:56:34 -0400
by
Jon-Carlos Rivera
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #616 from makotokw/fix-aes-iv
Support EXT-X-KEY:IV prefixed with 0X
2 parents
36a94af1
15886191
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletions
src/m3u8/parse-stream.js
test/m3u8.test.js
src/m3u8/parse-stream.js
View file @
5a4d09f
...
...
@@ -280,7 +280,7 @@ export default class ParseStream extends Stream {
event
.
attributes
=
parseAttributes
(
match
[
1
]);
// parse the IV string into a Uint32Array
if
(
event
.
attributes
.
IV
)
{
if
(
event
.
attributes
.
IV
.
substring
(
0
,
2
)
===
'0x'
)
{
if
(
event
.
attributes
.
IV
.
substring
(
0
,
2
)
.
toLowerCase
()
===
'0x'
)
{
event
.
attributes
.
IV
=
event
.
attributes
.
IV
.
substring
(
2
);
}
...
...
test/m3u8.test.js
View file @
5a4d09f
...
...
@@ -608,6 +608,35 @@ QUnit.test('parses lightly-broken #EXT-X-KEY tags', function() {
'trims and removes quotes around the URI'
);
});
QUnit
.
test
(
'parses prefixed with 0x or 0X #EXT-X-KEY:IV tags'
,
function
()
{
let
manifest
;
let
element
;
this
.
parseStream
.
on
(
'data'
,
function
(
elem
)
{
element
=
elem
;
});
manifest
=
'#EXT-X-KEY:IV=0x1234567890abcdef1234567890abcdef\n'
;
this
.
lineStream
.
push
(
manifest
);
QUnit
.
ok
(
element
.
attributes
.
IV
,
'detected an IV attribute'
);
QUnit
.
deepEqual
(
element
.
attributes
.
IV
,
new
Uint32Array
([
0x12345678
,
0x90abcdef
,
0x12345678
,
0x90abcdef
]),
'parsed an IV value with 0x'
);
manifest
=
'#EXT-X-KEY:IV=0X1234567890abcdef1234567890abcdef\n'
;
this
.
lineStream
.
push
(
manifest
);
QUnit
.
ok
(
element
.
attributes
.
IV
,
'detected an IV attribute'
);
QUnit
.
deepEqual
(
element
.
attributes
.
IV
,
new
Uint32Array
([
0x12345678
,
0x90abcdef
,
0x12345678
,
0x90abcdef
]),
'parsed an IV value with 0X'
);
});
QUnit
.
test
(
'ignores empty lines'
,
function
()
{
let
manifest
=
'\n'
;
let
event
=
false
;
...
...
Please
register
or
sign in
to post a comment