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
15886191
authored
2016-03-25 18:21:05 +0900
by
makoto_kw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Support EXT-X-KEY:IV prefixed with 0X
1 parent
6fe9fa2f
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 @
1588619
...
...
@@ -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 @
1588619
...
...
@@ -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