@ -39,11 +39,11 @@
var data = manifestController . parseManifest ( window . brightcove_playlist_data ) ;
ok ( data ) ;
e qual( data . playlists . length , 4 , 'Has correct rendition count' ) ;
e qual( data . playlists [ 0 ] . attributes . bandwidth , 240000 , 'First rendition index bandwidth is correct' ) ;
e qual( data . playlists [ 0 ] . attributes . programId , 1 , 'First rendition index program-id is correct' ) ;
e qual( data . playlists [ 0 ] . attributes . resolution . width , 396 , 'First rendition index resolution width is correct' ) ;
e qual( data . playlists [ 0 ] . attributes . resolution . height , 224 , 'First rendition index resolution height is correct' ) ;
strictE qual( data . playlists . length , 4 , 'Has correct rendition count' ) ;
strictE qual( data . playlists [ 0 ] . attributes . bandwidth , 240000 , 'First rendition index bandwidth is correct' ) ;
strictE qual( data . playlists [ 0 ] . attributes . programId , 1 , 'First rendition index program-id is correct' ) ;
strictE qual( data . playlists [ 0 ] . attributes . resolution . width , 396 , 'First rendition index resolution width is correct' ) ;
strictE qual( data . playlists [ 0 ] . attributes . resolution . height , 224 , 'First rendition index resolution height is correct' ) ;
} ) ;
test ( 'should get a manifest from an external URL' , function ( ) {
@ -81,9 +81,9 @@
} ) ;
tokenizer . push ( '#EXTM3U\nmovie.ts\n' ) ;
e qual( 2 , lines . length , 'two lines are ready' ) ;
e qual( '#EXTM3U' , lines . shift ( ) , 'the first line is the first token' ) ;
e qual( 'movie.ts' , lines . shift ( ) , 'the second line is the second token' ) ;
strictE qual( 2 , lines . length , 'two lines are ready' ) ;
strictE qual( '#EXTM3U' , lines . shift ( ) , 'the first line is the first token' ) ;
strictE qual( 'movie.ts' , lines . shift ( ) , 'the second line is the second token' ) ;
} ) ;
test ( 'empty lines become empty strings' , function ( ) {
var lines = [ ] ;
@ -92,9 +92,9 @@
} ) ;
tokenizer . push ( '\n\n' ) ;
e qual( 2 , lines . length , 'two lines are ready' ) ;
e qual( '' , lines . shift ( ) , 'the first line is empty' ) ;
e qual( '' , lines . shift ( ) , 'the second line is empty' ) ;
strictE qual( 2 , lines . length , 'two lines are ready' ) ;
strictE qual( '' , lines . shift ( ) , 'the first line is empty' ) ;
strictE qual( '' , lines . shift ( ) , 'the second line is empty' ) ;
} ) ;
test ( 'handles lines broken across appends' , function ( ) {
var lines = [ ] ;
@ -102,12 +102,12 @@
lines . push ( line ) ;
} ) ;
tokenizer . push ( '#EXTM' ) ;
e qual( 0 , lines . length , 'no lines are ready' ) ;
strictE qual( 0 , lines . length , 'no lines are ready' ) ;
tokenizer . push ( '3U\nmovie.ts\n' ) ;
e qual( 2 , lines . length , 'two lines are ready' ) ;
e qual( '#EXTM3U' , lines . shift ( ) , 'the first line is the first token' ) ;
e qual( 'movie.ts' , lines . shift ( ) , 'the second line is the second token' ) ;
strictE qual( 2 , lines . length , 'two lines are ready' ) ;
strictE qual( '#EXTM3U' , lines . shift ( ) , 'the first line is the first token' ) ;
strictE qual( 'movie.ts' , lines . shift ( ) , 'the second line is the second token' ) ;
} ) ;
test ( 'stops sending events after deregistering' , function ( ) {
var
@ -123,12 +123,12 @@
tokenizer . on ( 'data' , temporary ) ;
tokenizer . on ( 'data' , permanent ) ;
tokenizer . push ( 'line one\n' ) ;
e qual( temporaryLines . length , permanentLines . length , 'both callbacks receive the event' ) ;
strictE qual( temporaryLines . length , permanentLines . length , 'both callbacks receive the event' ) ;
ok ( tokenizer . off ( 'data' , temporary ) , 'a listener was removed' ) ;
tokenizer . push ( 'line two\n' ) ;
e qual( 1 , temporaryLines . length , 'no new events are received' ) ;
e qual( 2 , permanentLines . length , 'new events are still received' ) ;
strictE qual( 1 , temporaryLines . length , 'no new events are received' ) ;
strictE qual( 2 , permanentLines . length , 'new events are still received' ) ;
} ) ;
module ( 'M3U8 Parser' , {
@ -148,8 +148,8 @@
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
e qual( element . type , 'comment' , 'the type is comment' ) ;
e qual( element . text ,
strictE qual( element . type , 'comment' , 'the type is comment' ) ;
strictE qual( element . text ,
manifest . slice ( 1 , manifest . length - 1 ) ,
'the comment text is parsed' ) ;
} ) ;
@ -163,8 +163,8 @@
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
e qual( element . type , 'uri' , 'the type is uri' ) ;
e qual( element . uri ,
strictE qual( element . type , 'uri' , 'the type is uri' ) ;
strictE qual( element . uri ,
manifest . substring ( 0 , manifest . length - 1 ) ,
'the uri text is parsed' ) ;
} ) ;
@ -178,11 +178,13 @@
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
e qual( element . type , 'tag' , 'the type is tag' ) ;
e qual( element . data ,
strictE qual( element . type , 'tag' , 'the type is tag' ) ;
strictE qual( element . data ,
manifest . slice ( 4 , manifest . length - 1 ) ,
'unknown tag data is preserved' ) ;
} ) ;
// #EXTM3U
test ( 'parses #EXTM3U tags' , function ( ) {
var
manifest = '#EXTM3U\n' ,
@ -193,9 +195,11 @@
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
e qual( element . type , 'tag' , 'the line type is tag' ) ;
e qual( element . tagType , 'm3u' , 'the tag type is m3u' ) ;
strictE qual( element . type , 'tag' , 'the line type is tag' ) ;
strictE qual( element . tagType , 'm3u' , 'the tag type is m3u' ) ;
} ) ;
// #EXTINF
test ( 'parses minimal #EXTINF tags' , function ( ) {
var
manifest = '#EXTINF\n' ,
@ -206,8 +210,8 @@
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
e qual( element . type , 'tag' , 'the line type is tag' ) ;
e qual( element . tagType , 'inf' , 'the tag type is inf' ) ;
strictE qual( element . type , 'tag' , 'the line type is tag' ) ;
strictE qual( element . tagType , 'inf' , 'the tag type is inf' ) ;
} ) ;
test ( 'parses #EXTINF tags with durations' , function ( ) {
var
@ -219,18 +223,18 @@
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
e qual( element . type , 'tag' , 'the line type is tag' ) ;
e qual( element . tagType , 'inf' , 'the tag type is inf' ) ;
e qual( element . duration , 15 , 'the duration is parsed' ) ;
strictE qual( element . type , 'tag' , 'the line type is tag' ) ;
strictE qual( element . tagType , 'inf' , 'the tag type is inf' ) ;
strictE qual( element . duration , 15 , 'the duration is parsed' ) ;
ok ( ! ( 'title' in element ) , 'no title is parsed' ) ;
manifest = '#EXTINF:21,\n'
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
e qual( element . type , 'tag' , 'the line type is tag' ) ;
e qual( element . tagType , 'inf' , 'the tag type is inf' ) ;
e qual( element . duration , 21 , 'the duration is parsed' ) ;
strictE qual( element . type , 'tag' , 'the line type is tag' ) ;
strictE qual( element . tagType , 'inf' , 'the tag type is inf' ) ;
strictE qual( element . duration , 21 , 'the duration is parsed' ) ;
ok ( ! ( 'title' in element ) , 'no title is parsed' ) ;
} ) ;
test ( 'parses #EXTINF tags with a duration and title' , function ( ) {
@ -243,13 +247,302 @@
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
e qual( element . type , 'tag' , 'the line type is tag' ) ;
e qual( element . tagType , 'inf' , 'the tag type is inf' ) ;
e qual( element . duration , 13 , 'the duration is parsed' ) ;
e qual( element . title ,
strictE qual( element . type , 'tag' , 'the line type is tag' ) ;
strictE qual( element . tagType , 'inf' , 'the tag type is inf' ) ;
strictE qual( element . duration , 13 , 'the duration is parsed' ) ;
strictE qual( element . title ,
manifest . substring ( manifest . indexOf ( ',' ) + 1 , manifest . length - 1 ) ,
'the title is parsed' ) ;
} ) ;
// #EXT-X-TARGETDURATION
test ( 'parses minimal #EXT-X-TARGETDURATION tags' , function ( ) {
var
manifest = '#EXT-X-TARGETDURATION\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'targetduration' , 'the tag type is targetduration' ) ;
ok ( ! ( 'duration' in element ) , 'no duration is parsed' ) ;
} ) ;
test ( 'parses #EXT-X-TARGETDURATION with duration' , function ( ) {
var
manifest = '#EXT-X-TARGETDURATION:47\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'targetduration' , 'the tag type is targetduration' ) ;
strictEqual ( element . duration , 47 , 'the duration is parsed' ) ;
} ) ;
// #EXT-X-VERSION
test ( 'parses minimal #EXT-X-VERSION tags' , function ( ) {
var
manifest = '#EXT-X-VERSION:\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'version' , 'the tag type is version' ) ;
ok ( ! ( 'version' in element ) , 'no version is present' ) ;
} ) ;
test ( 'parses #EXT-X-VERSION with a version' , function ( ) {
var
manifest = '#EXT-X-VERSION:99\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'version' , 'the tag type is version' ) ;
strictEqual ( element . version , 99 , 'the version is parsed' ) ;
} ) ;
// #EXT-X-MEDIA-SEQUENCE
test ( 'parses minimal #EXT-X-MEDIA-SEQUENCE tags' , function ( ) {
var
manifest = '#EXT-X-MEDIA-SEQUENCE\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'media-sequence' , 'the tag type is media-sequence' ) ;
ok ( ! ( 'number' in element ) , 'no number is present' ) ;
} ) ;
test ( 'parses #EXT-X-MEDIA-SEQUENCE with sequence numbers' , function ( ) {
var
manifest = '#EXT-X-MEDIA-SEQUENCE:109\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'media-sequence' , 'the tag type is media-sequence' ) ;
ok ( element . number , 109 , 'the number is parsed' ) ;
} ) ;
// #EXT-X-PLAYLIST-TYPE
test ( 'parses minimal #EXT-X-PLAYLIST-TYPE tags' , function ( ) {
var
manifest = '#EXT-X-PLAYLIST-TYPE:\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'playlist-type' , 'the tag type is playlist-type' ) ;
ok ( ! ( 'playlistType' in element ) , 'no playlist type is present' ) ;
} ) ;
test ( 'parses #EXT-X-PLAYLIST-TYPE with mutability info' , function ( ) {
var
manifest = '#EXT-X-PLAYLIST-TYPE:EVENT\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'playlist-type' , 'the tag type is playlist-type' ) ;
strictEqual ( element . playlistType , 'EVENT' , 'the playlist type is EVENT' ) ;
manifest = '#EXT-X-PLAYLIST-TYPE:VOD\n' ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'playlist-type' , 'the tag type is playlist-type' ) ;
strictEqual ( element . playlistType , 'VOD' , 'the playlist type is VOD' ) ;
manifest = '#EXT-X-PLAYLIST-TYPE:nonsense\n' ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'playlist-type' , 'the tag type is playlist-type' ) ;
strictEqual ( element . playlistType , 'nonsense' , 'the playlist type is parsed' ) ;
} ) ;
// #EXT-X-BYTERANGE
test ( 'parses minimal #EXT-X-BYTERANGE tags' , function ( ) {
var
manifest = '#EXT-X-BYTERANGE\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'byterange' , 'the tag type is byterange' ) ;
ok ( ! ( 'length' in element ) , 'no length is present' ) ;
ok ( ! ( 'offset' in element ) , 'no offset is present' ) ;
} ) ;
test ( 'parses #EXT-X-BYTERANGE with length and offset' , function ( ) {
var
manifest = '#EXT-X-BYTERANGE:45\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'byterange' , 'the tag type is byterange' ) ;
strictEqual ( element . length , 45 , 'length is parsed' ) ;
ok ( ! ( 'offset' in element ) , 'no offset is present' ) ;
manifest = '#EXT-X-BYTERANGE:108@16\n' ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'byterange' , 'the tag type is byterange' ) ;
strictEqual ( element . length , 108 , 'length is parsed' ) ;
strictEqual ( element . offset , 16 , 'offset is parsed' ) ;
} ) ;
// #EXT-X-ALLOW-CACHE
test ( 'parses minimal #EXT-X-ALLOW-CACHE tags' , function ( ) {
var
manifest = '#EXT-X-ALLOW-CACHE:\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'allow-cache' , 'the tag type is allow-cache' ) ;
ok ( ! ( 'allowed' in element ) , 'no allowed is present' ) ;
} ) ;
test ( 'parses valid #EXT-X-ALLOW-CACHE tags' , function ( ) {
var
manifest = '#EXT-X-ALLOW-CACHE:YES\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'allow-cache' , 'the tag type is allow-cache' ) ;
ok ( element . allowed , 'allowed is parsed' ) ;
manifest = '#EXT-X-ALLOW-CACHE:NO\n' ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'allow-cache' , 'the tag type is allow-cache' ) ;
ok ( ! element . allowed , 'allowed is parsed' ) ;
} ) ;
// #EXT-X-STREAM-INF
test ( 'parses minimal #EXT-X-STREAM-INF tags' , function ( ) {
var
manifest = '#EXT-X-STREAM-INF\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'stream-inf' , 'the tag type is stream-inf' ) ;
ok ( ! ( 'attributes' in element ) , 'no attributes are present' ) ;
} ) ;
test ( 'parses #EXT-X-STREAM-INF with common attributes' , function ( ) {
var
manifest = '#EXT-X-STREAM-INF:BANDWIDTH=14400\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'stream-inf' , 'the tag type is stream-inf' ) ;
strictEqual ( element . attributes . BANDWIDTH , 14400 , 'bandwidth is parsed' ) ;
manifest = '#EXT-X-STREAM-INF:PROGRAM-ID=7\n' ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'stream-inf' , 'the tag type is stream-inf' ) ;
strictEqual ( element . attributes [ 'PROGRAM-ID' ] , 7 , 'program-id is parsed' ) ;
manifest = '#EXT-X-STREAM-INF:RESOLUTION=396x224\n' ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'stream-inf' , 'the tag type is stream-inf' ) ;
strictEqual ( element . attributes . RESOLUTION . width , 396 , 'width is parsed' ) ;
strictEqual ( element . attributes . RESOLUTION . height , 224 , 'heigth is parsed' ) ;
} ) ;
test ( 'parses #EXT-X-STREAM-INF with arbitrary attributes' , function ( ) {
var
manifest = '#EXT-X-STREAM-INF:NUMERIC=24,ALPHA=Value,MIXED=123abc\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'stream-inf' , 'the tag type is stream-inf' ) ;
strictEqual ( element . attributes . NUMERIC , '24' , 'numeric attributes are parsed' ) ;
strictEqual ( element . attributes . ALPHA , 'Value' , 'alphabetic attributes are parsed' ) ;
strictEqual ( element . attributes . MIXED , '123abc' , 'mixed attributes are parsed' ) ;
} ) ;
// #EXT-X-ENDLIST
test ( 'parses #EXT-X-ENDLIST tags' , function ( ) {
var
manifest = '#EXT-X-ENDLIST\n' ,
element ;
parser . on ( 'data' , function ( elem ) {
element = elem ;
} ) ;
tokenizer . push ( manifest ) ;
ok ( element , 'an event was triggered' ) ;
strictEqual ( element . type , 'tag' , 'the line type is tag' ) ;
strictEqual ( element . tagType , 'endlist' , 'the tag type is stream-inf' ) ;
} ) ;
test ( 'ignores empty lines' , function ( ) {
var
manifest = '\n' ,
@ -290,15 +583,15 @@
} ) ;
tokenizer . push ( window . playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
e qual( data . openTag , true , 'data has valid EXTM3U' ) ;
e qual( data . targetDuration , 10 , 'data has correct TARGET DURATION' ) ;
e qual( data . allowCache , undefined , 'ALLOW-CACHE is not present in the manifest' ) ;
e qual( data . playlistType , "VOD" , 'acceptable PLAYLIST TYPE' ) ;
e qual( data . segments . length , 17 , 'there are 17 segments in the manifest' ) ;
e qual( data . mediaSequence , 0 , 'MEDIA SEQUENCE is correct' ) ;
e qual( data . totalDuration , undefined , "no total duration is specified" ) ;
e qual( data . closeTag , true , 'should have ENDLIST tag' ) ;
notStrict Equal ( data , null , 'data is not NULL' ) ;
strictE qual( data . openTag , true , 'data has valid EXTM3U' ) ;
strictE qual( data . targetDuration , 10 , 'data has correct TARGET DURATION' ) ;
strictE qual( data . allowCache , undefined , 'ALLOW-CACHE is not present in the manifest' ) ;
strictE qual( data . playlistType , "VOD" , 'acceptable PLAYLIST TYPE' ) ;
strictE qual( data . segments . length , 17 , 'there are 17 segments in the manifest' ) ;
strictE qual( data . mediaSequence , 0 , 'MEDIA SEQUENCE is correct' ) ;
strictE qual( data . totalDuration , undefined , "no total duration is specified" ) ;
strictE qual( data . closeTag , true , 'should have ENDLIST tag' ) ;
} ) ;
/ * 3 . 4 . 7 . E X T - X - P L A Y L I S T - T Y P E
@ -326,9 +619,9 @@
} ) ;
tokenizer . push ( window . playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
//e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
e qual( data . playlistType , "VOD" , 'acceptable PLAYLIST TYPE' ) ;
notStrict Equal ( data , null , 'data is not NULL' ) ;
//strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
strictE qual( data . playlistType , "VOD" , 'acceptable PLAYLIST TYPE' ) ;
} ) ;
test ( 'should have parsed EVENT playlist type' , function ( ) {
@ -342,9 +635,9 @@
} ) ;
tokenizer . push ( window . playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
//e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
e qual( data . playlistType , "EVENT" , 'acceptable PLAYLIST TYPE' ) ;
notStrict Equal ( data , null , 'data is not NULL' ) ;
//strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
strictE qual( data . playlistType , "EVENT" , 'acceptable PLAYLIST TYPE' ) ;
} ) ;
test ( 'handles a missing playlist type' , function ( ) {
@ -358,10 +651,10 @@
} ) ;
tokenizer . push ( window . playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
//e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
//e qual(data.warnings, 'EXT-X-PLAYLIST-TYPE was empty or missing. Assuming VOD');
e qual( data . playlistType , undefined , 'no PLAYLIST TYPE present' ) ;
notStrict Equal ( data , null , 'data is not NULL' ) ;
//strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
//strictE qual(data.warnings, 'EXT-X-PLAYLIST-TYPE was empty or missing. Assuming VOD');
strictE qual( data . playlistType , undefined , 'no PLAYLIST TYPE present' ) ;
} ) ;
test ( 'should have an invalid reason due to invalid playlist type' , function ( ) {
@ -370,9 +663,9 @@
testData = { playlistType : 'baklsdhfajsdf' } ,
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
//e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
//e qual(data.invalidReasons[0], 'Invalid Playlist Type Value: \'baklsdhfajsdf\'');
notStrict Equal ( data , null , 'data is not NULL' ) ;
//strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
//strictE qual(data.invalidReasons[0], 'Invalid Playlist Type Value: \'baklsdhfajsdf\'');
} ) ;
// test('handles an empty playlist type', function() {
@ -381,10 +674,10 @@
// testData = {playlistType: ''},
// playlistData = playlistTemplate(testData),
// data = m3u8parser.parse(playlistData);
// notEqual(data, null, 'data is not NULL');
// //e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
// //e qual(data.warnings, 'EXT-X-PLAYLIST-TYPE was empty or missing. Assuming VOD');
// e qual(data.playlistType, '', 'PLAYLIST TYPE is the empty string');
// notStrict Equal(data, null, 'data is not NULL');
// //strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
// //strictE qual(data.warnings, 'EXT-X-PLAYLIST-TYPE was empty or missing. Assuming VOD');
// strictE qual(data.playlistType, '', 'PLAYLIST TYPE is the empty string');
// });
/ * 3 . 4 . 2 . E X T - X - T A R G E T D U R A T I O N
@ -410,9 +703,9 @@
testData = { targetDuration : '10' } ,
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
e qual( data . targetDuration , 10 , 'data has correct TARGET DURATION' ) ;
//e qual(data.invalidReasons.length, 0, 'data has 1 invalid reasons');
notStrict Equal ( data , null , 'data is not NULL' ) ;
strictE qual( data . targetDuration , 10 , 'data has correct TARGET DURATION' ) ;
//strictE qual(data.invalidReasons.length, 0, 'data has 1 invalid reasons');
} ) ;
test ( 'NaN target duration' , function ( ) {
@ -423,10 +716,10 @@
data = m3u8parser . parse ( playlistData ) ;
console . log ( playlistData ) ;
console . log ( data . targetDuration ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 0 invalid reasons');
// e qual(data.invalidReasons[0], 'Invalid Target Duration Value: \'NaN\'');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 0 invalid reasons');
// strictE qual(data.invalidReasons[0], 'Invalid Target Duration Value: \'NaN\'');
} ) ;
test ( 'empty target duration' , function ( ) {
@ -437,10 +730,10 @@
data = m3u8parser . parse ( playlistData ) ;
console . log ( playlistData ) ;
console . log ( data . targetDuration ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// e qual(data.invalidReasons[0], 'Invalid Target Duration Value: \'NaN\'');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// strictE qual(data.invalidReasons[0], 'Invalid Target Duration Value: \'NaN\'');
} ) ;
test ( 'undefined target duration' , function ( ) {
@ -451,10 +744,10 @@
data = m3u8parser . parse ( playlistData ) ;
console . log ( playlistData ) ;
console . log ( data . targetDuration ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// e qual(data.invalidReasons[0], 'Invalid Target Duration Value: \'undefined\'');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// strictE qual(data.invalidReasons[0], 'Invalid Target Duration Value: \'undefined\'');
} ) ;
@ -465,10 +758,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// e qual(data.invalidReasons[0], 'Invalid Target Duration Value: 4 is lower than segments');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// strictE qual(data.invalidReasons[0], 'Invalid Target Duration Value: 4 is lower than segments');
} ) ;
/ * 3 . 4 . 3 . E X T - X - M E D I A - S E Q U E N C E
@ -501,10 +794,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
e qual( data . mediaSequence , 0 , 'MEDIA SEQUENCE is correct' ) ;
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
strictE qual( data . mediaSequence , 0 , 'MEDIA SEQUENCE is correct' ) ;
} ) ;
test ( 'media sequence is encountered twice in the playlist' , function ( ) {
@ -514,10 +807,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
e qual( data . mediaSequence , 0 , 'MEDIA SEQUENCE tags after the first should be ignored' ) ;
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
strictE qual( data . mediaSequence , 0 , 'MEDIA SEQUENCE tags after the first should be ignored' ) ;
} ) ;
test ( 'media sequence is undefined in the playlist' , function ( ) {
@ -527,10 +820,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
e qual( data . mediaSequence , undefined , 'MEDIA SEQUENCE is undefined' ) ;
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
strictE qual( data . mediaSequence , undefined , 'MEDIA SEQUENCE is undefined' ) ;
} ) ;
// test('media sequence is empty in the playlist', function() {
@ -540,10 +833,10 @@
// playlistData = playlistTemplate(testData),
// data = m3u8parser.parse(playlistData);
// notEqual(data, null, 'data is not NULL');
// // notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// // e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// e qual(data.mediaSequence, '', 'media sequence is the empty string');
// notStrict Equal(data, null, 'data is not NULL');
// // notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// // strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// strictE qual(data.mediaSequence, '', 'media sequence is the empty string');
// });
test ( 'media sequence is high (non-zero in first file) in the playlist' , function ( ) {
@ -553,10 +846,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// e qual(data.invalidReasons[0], 'Invalid Media Sequence Value: \'1\'');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// strictE qual(data.invalidReasons[0], 'Invalid Media Sequence Value: \'1\'');
} ) ;
test ( 'handles invalid media sequence numbers in the playlist' , function ( ) {
@ -566,11 +859,11 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// e qual(data.invalidReasons[0], 'Invalid Media Sequence Value: \'-1\'');
e qual( data . mediaSequence , - 1 , 'negative media sequence numbers don\'t break parsing' ) ;
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// strictE qual(data.invalidReasons[0], 'Invalid Media Sequence Value: \'-1\'');
strictE qual( data . mediaSequence , - 1 , 'negative media sequence numbers don\'t break parsing' ) ;
} ) ;
test ( 'media sequence invalid (string) in the playlist' , function ( ) {
@ -580,10 +873,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// e qual(data.invalidReasons[0], 'Invalid Media Sequence Value: \'asdfkasdkfl\'');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// strictE qual(data.invalidReasons[0], 'Invalid Media Sequence Value: \'asdfkasdkfl\'');
} ) ;
module ( 'Representative Playlist' , {
@ -596,13 +889,13 @@
var data = m3u8parser . parse ( window . brightcove_playlist_data ) ;
ok ( data ) ;
e qual( data . playlists . length , 4 , 'has correct playlist count' ) ;
e qual( data . playlists [ 0 ] . attributes . bandwidth , 240000 , 'first rendition index bandwidth is correct' ) ;
e qual( data . playlists [ 0 ] . attributes . programId , 1 , 'first rendition index program-id is correct' ) ;
e qual( data . playlists [ 0 ] . attributes . resolution . width ,
strictE qual( data . playlists . length , 4 , 'has correct playlist count' ) ;
strictE qual( data . playlists [ 0 ] . attributes . bandwidth , 240000 , 'first rendition index bandwidth is correct' ) ;
strictE qual( data . playlists [ 0 ] . attributes . programId , 1 , 'first rendition index program-id is correct' ) ;
strictE qual( data . playlists [ 0 ] . attributes . resolution . width ,
396 ,
'first rendition index resolution width is correct' ) ;
e qual( data . playlists [ 0 ] . attributes . resolution . height ,
strictE qual( data . playlists [ 0 ] . attributes . resolution . height ,
224 ,
'first rendition index resolution height is correct' ) ;
@ -638,9 +931,9 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
} ) ;
test ( 'test valid extinf without associated segment in playlist' , function ( ) {
@ -650,10 +943,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
//e qual(data.invalidReasons[0], 'Invalid Segment Data: \'#EXTINF missing segment\'');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
//strictE qual(data.invalidReasons[0], 'Invalid Segment Data: \'#EXTINF missing segment\'');
} ) ;
//
@ -664,9 +957,9 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
} ) ;
//its best practice that every extinf have the same value, but its not required
@ -677,9 +970,9 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
} ) ;
//extinf values must be below the target duration
@ -690,10 +983,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// e qual(data.invalidReasons[0], 'Invalid Segment Data: \'#EXTINF value higher than #TARGETDURATION\'');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// strictE qual(data.invalidReasons[0], 'Invalid Segment Data: \'#EXTINF value higher than #TARGETDURATION\'');
} ) ;
//extinf values must be below the target duration
@ -704,10 +997,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// e qual(data.invalidReasons[0], 'Invalid Segment Data: \'#EXTINF value not an integer\'');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// strictE qual(data.invalidReasons[0], 'Invalid Segment Data: \'#EXTINF value not an integer\'');
} ) ;
//extinf values must be below the target duration
@ -718,9 +1011,9 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
} ) ;
//extinf values must be below the target duration
@ -731,10 +1024,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// e qual(data.invalidReasons[0], 'Invalid Segment Data: \'#EXTINF value empty\'');
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// strictE qual(data.invalidReasons[0], 'Invalid Segment Data: \'#EXTINF value empty\'');
} ) ;
/ *
@ -756,10 +1049,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
e qual( data . allowCache , 'YES' , 'EXT-X-ALLOW-CACHE should be YES' ) ;
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
strictE qual( data . allowCache , 'YES' , 'EXT-X-ALLOW-CACHE should be YES' ) ;
} ) ;
test ( 'test EXT-X-ALLOW-CACHE NO' , function ( ) {
@ -769,10 +1062,10 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
e qual( data . allowCache , 'NO' , 'EXT-X-ALLOW-CACHE should be NO' ) ;
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 0, 'Errors object should not be empty.');
strictE qual( data . allowCache , 'NO' , 'EXT-X-ALLOW-CACHE should be NO' ) ;
} ) ;
test ( 'test EXT-X-ALLOW-CACHE invalid, default to YES' , function ( ) {
@ -782,11 +1075,11 @@
playlistData = playlistTemplate ( testData ) ,
data = m3u8parser . parse ( playlistData ) ;
notEqual ( data , null , 'data is not NULL' ) ;
// notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// e qual(data.invalidReasons[0], 'Invalid EXT-X-ALLOW-CACHE value: \'YESTERDAYNO\'');
e qual( data . allowCache , 'YES' , 'EXT-X-ALLOW-CACHE should default to YES.' ) ;
notStrict Equal ( data , null , 'data is not NULL' ) ;
// notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// strictE qual(data.invalidReasons[0], 'Invalid EXT-X-ALLOW-CACHE value: \'YESTERDAYNO\'');
strictE qual( data . allowCache , 'YES' , 'EXT-X-ALLOW-CACHE should default to YES.' ) ;
} ) ;
// test('test EXT-X-ALLOW-CACHE empty, default to YES', function() {
@ -796,11 +1089,11 @@
// playlistData = playlistTemplate(testData),
// data = m3u8parser.parse(playlistData);
// notEqual(data, null, 'data is not NULL');
// // notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// // e qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// // e qual(data.invalidReasons[0], 'Invalid EXT-X-ALLOW-CACHE value: \'\'');
// e qual(data.allowCache, 'YES', 'EXT-X-ALLOW-CACHE should default to YES.');
// notStrict Equal(data, null, 'data is not NULL');
// // notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// // strictE qual(data.invalidReasons.length, 1, 'data has 1 invalid reasons');
// // strictE qual(data.invalidReasons[0], 'Invalid EXT-X-ALLOW-CACHE value: \'\'');
// strictE qual(data.allowCache, 'YES', 'EXT-X-ALLOW-CACHE should default to YES.');
// });
// test('test EXT-X-ALLOW-CACHE missing, default to YES', function() {
@ -810,10 +1103,10 @@
// playlistData = playlistTemplate(testData),
// data = m3u8parser.parse(playlistData);
// notEqual(data, null, 'data is not NULL');
// // notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// // e qual(data.invalidReasons.length, 1, 'No EXT-X-ALLOW-CACHE specified. Default: YES.');
// e qual(data.allowCache, 'YES', 'EXT-X-ALLOW-CACHE should default to YES');
// notStrict Equal(data, null, 'data is not NULL');
// // notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// // strictE qual(data.invalidReasons.length, 1, 'No EXT-X-ALLOW-CACHE specified. Default: YES.');
// strictE qual(data.allowCache, 'YES', 'EXT-X-ALLOW-CACHE should default to YES');
// });
// test('test EXT-X-BYTERANGE valid', function() {
@ -823,14 +1116,14 @@
// playlistData = playlistTemplate(testData),
// data = m3u8parser.parse(playlistData);
// notEqual(data, null, 'data is not NULL');
// //notEqual(data.invalidReasons, null, 'invalidReasons is not NULL');
// //e qual(data.invalidReasons.length, 0, 'Errors object should be empty.');
// notStrict Equal(data, null, 'data is not NULL');
// //notStrict Equal(data.invalidReasons, null, 'invalidReasons is not NULL');
// //strictE qual(data.invalidReasons.length, 0, 'Errors object should be empty.');
// //TODO: Validate the byteRange info
// e qual(data.segments.length, 16, '16 segments should have been parsed.');
// e qual(data.segments[0].byterange, testData.byteRange, 'byteRange incorrect.');
// e qual(data.segments[1].byterange, testData.byteRange1, 'byteRange1 incorrect.');
// e qual(data.segments[15].byterange, testData.byteRange2, 'byteRange2 incorrect.');
// strictE qual(data.segments.length, 16, '16 segments should have been parsed.');
// strictE qual(data.segments[0].byterange, testData.byteRange, 'byteRange incorrect.');
// strictE qual(data.segments[1].byterange, testData.byteRange1, 'byteRange1 incorrect.');
// strictE qual(data.segments[15].byterange, testData.byteRange2, 'byteRange2 incorrect.');
// });
// test('test EXT-X-BYTERANGE used but version is < 4', function() {
@ -840,12 +1133,12 @@
// playlistData = playlistTemplate(testData),
// data = m3u8parser.parse(playlistData);
// notEqual(data, null, 'data is not NULL');
// e qual(data.segments.length, 16, '16 segments should have been parsed.');
// // notEqual(data.invalidReasons, null, 'there should be an error');
// // e qual(data.invalidReasons.length, 1, 'there should be 1 error');
// notStrict Equal(data, null, 'data is not NULL');
// strictE qual(data.segments.length, 16, '16 segments should have been parsed.');
// // notStrict Equal(data.invalidReasons, null, 'there should be an error');
// // strictE qual(data.invalidReasons.length, 1, 'there should be 1 error');
// // //TODO: Validate the byteRange info
// // e qual(data.invalidReasons[0], 'EXT-X-BYTERANGE used but version is < 4.');x
// // strictE qual(data.invalidReasons[0], 'EXT-X-BYTERANGE used but version is < 4.');x
// });
} ) ( window , window . console ) ;