73420aa6 by Gary Katsevman

Rename videojs.hls to videojs.Hls to use the tech

1 parent d2a7225b
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
21 */ 21 */
22 var 22 var
23 buffer, 23 buffer,
24 ExpGolomb = window.videojs.hls.ExpGolomb, 24 ExpGolomb = window.videojs.Hls.ExpGolomb,
25 expGolomb; 25 expGolomb;
26 26
27 module('Exponential Golomb coding'); 27 module('Exponential Golomb coding');
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
19 notStrictEqual(actual, expected, [message]) 19 notStrictEqual(actual, expected, [message])
20 throws(block, [expected], [message]) 20 throws(block, [expected], [message])
21 */ 21 */
22 var FlvTag = window.videojs.hls.FlvTag; 22 var FlvTag = window.videojs.Hls.FlvTag;
23 23
24 module('FLV tag'); 24 module('FLV tag');
25 25
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
2 module('H264 Stream'); 2 module('H264 Stream');
3 3
4 var 4 var
5 nalUnitTypes = window.videojs.hls.NALUnitType, 5 nalUnitTypes = window.videojs.Hls.NALUnitType,
6 FlvTag = window.videojs.hls.FlvTag; 6 FlvTag = window.videojs.Hls.FlvTag;
7 7
8 test('metadata is generated for IDRs after a full NAL unit is written', function() { 8 test('metadata is generated for IDRs after a full NAL unit is written', function() {
9 var 9 var
10 h264Stream = new videojs.hls.H264Stream(), 10 h264Stream = new videojs.Hls.H264Stream(),
11 accessUnitDelimiter = new Uint8Array([ 11 accessUnitDelimiter = new Uint8Array([
12 0x00, 12 0x00,
13 0x00, 13 0x00,
...@@ -62,7 +62,7 @@ test('metadata is generated for IDRs after a full NAL unit is written', function ...@@ -62,7 +62,7 @@ test('metadata is generated for IDRs after a full NAL unit is written', function
62 62
63 test('starting PTS values can be negative', function() { 63 test('starting PTS values can be negative', function() {
64 var 64 var
65 h264Stream = new videojs.hls.H264Stream(), 65 h264Stream = new videojs.Hls.H264Stream(),
66 accessUnitDelimiter = new Uint8Array([ 66 accessUnitDelimiter = new Uint8Array([
67 0x00, 67 0x00,
68 0x00, 68 0x00,
......
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
127 original.addEventListener('change', function() { 127 original.addEventListener('change', function() {
128 var reader = new FileReader(); 128 var reader = new FileReader();
129 reader.addEventListener('loadend', function() { 129 reader.addEventListener('loadend', function() {
130 var parser = new videojs.hls.SegmentParser(), 130 var parser = new videojs.Hls.SegmentParser(),
131 tags = [parser.getFlvHeader()], 131 tags = [parser.getFlvHeader()],
132 tag, 132 tag,
133 hex, 133 hex,
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
164 } 164 }
165 165
166 hex = '<pre>' 166 hex = '<pre>'
167 hex += videojs.hls.utils.hexDump(data); 167 hex += videojs.Hls.utils.hexDump(data);
168 hex += '</pre>' 168 hex += '</pre>'
169 169
170 vjsOutput.innerHTML = hex; 170 vjsOutput.innerHTML = hex;
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
201 } 201 }
202 202
203 // output the hex dump 203 // output the hex dump
204 hex += videojs.hls.utils.hexDump(bytes); 204 hex += videojs.Hls.utils.hexDump(bytes);
205 hex += '</pre>'; 205 hex += '</pre>';
206 workingOutput.innerHTML = hex; 206 workingOutput.innerHTML = hex;
207 }); 207 });
......
...@@ -36,26 +36,26 @@ ...@@ -36,26 +36,26 @@
36 36
37 test('throws if the playlist url is empty or undefined', function() { 37 test('throws if the playlist url is empty or undefined', function() {
38 throws(function() { 38 throws(function() {
39 videojs.hls.PlaylistLoader(); 39 videojs.Hls.PlaylistLoader();
40 }, 'requires an argument'); 40 }, 'requires an argument');
41 throws(function() { 41 throws(function() {
42 videojs.hls.PlaylistLoader(''); 42 videojs.Hls.PlaylistLoader('');
43 }, 'does not accept the empty string'); 43 }, 'does not accept the empty string');
44 }); 44 });
45 45
46 test('starts without any metadata', function() { 46 test('starts without any metadata', function() {
47 var loader = new videojs.hls.PlaylistLoader('master.m3u8'); 47 var loader = new videojs.Hls.PlaylistLoader('master.m3u8');
48 strictEqual(loader.state, 'HAVE_NOTHING', 'no metadata has loaded yet'); 48 strictEqual(loader.state, 'HAVE_NOTHING', 'no metadata has loaded yet');
49 }); 49 });
50 50
51 test('requests the initial playlist immediately', function() { 51 test('requests the initial playlist immediately', function() {
52 new videojs.hls.PlaylistLoader('master.m3u8'); 52 new videojs.Hls.PlaylistLoader('master.m3u8');
53 strictEqual(requests.length, 1, 'made a request'); 53 strictEqual(requests.length, 1, 'made a request');
54 strictEqual(requests[0].url, 'master.m3u8', 'requested the initial playlist'); 54 strictEqual(requests[0].url, 'master.m3u8', 'requested the initial playlist');
55 }); 55 });
56 56
57 test('moves to HAVE_MASTER after loading a master playlist', function() { 57 test('moves to HAVE_MASTER after loading a master playlist', function() {
58 var loader = new videojs.hls.PlaylistLoader('master.m3u8'); 58 var loader = new videojs.Hls.PlaylistLoader('master.m3u8');
59 requests.pop().respond(200, null, 59 requests.pop().respond(200, null,
60 '#EXTM3U\n' + 60 '#EXTM3U\n' +
61 '#EXT-X-STREAM-INF:\n' + 61 '#EXT-X-STREAM-INF:\n' +
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
67 test('jumps to HAVE_METADATA when initialized with a media playlist', function() { 67 test('jumps to HAVE_METADATA when initialized with a media playlist', function() {
68 var 68 var
69 loadedmetadatas = 0, 69 loadedmetadatas = 0,
70 loader = new videojs.hls.PlaylistLoader('media.m3u8'); 70 loader = new videojs.Hls.PlaylistLoader('media.m3u8');
71 loader.on('loadedmetadata', function() { 71 loader.on('loadedmetadata', function() {
72 loadedmetadatas++; 72 loadedmetadatas++;
73 }); 73 });
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
85 }); 85 });
86 86
87 test('jumps to HAVE_METADATA when initialized with a live media playlist', function() { 87 test('jumps to HAVE_METADATA when initialized with a live media playlist', function() {
88 var loader = new videojs.hls.PlaylistLoader('media.m3u8'); 88 var loader = new videojs.Hls.PlaylistLoader('media.m3u8');
89 requests.pop().respond(200, null, 89 requests.pop().respond(200, null,
90 '#EXTM3U\n' + 90 '#EXTM3U\n' +
91 '#EXTINF:10,\n' + 91 '#EXTINF:10,\n' +
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
99 var 99 var
100 loadedPlaylist = 0, 100 loadedPlaylist = 0,
101 loadedMetadata = 0, 101 loadedMetadata = 0,
102 loader = new videojs.hls.PlaylistLoader('master.m3u8'); 102 loader = new videojs.Hls.PlaylistLoader('master.m3u8');
103 loader.on('loadedplaylist', function() { 103 loader.on('loadedplaylist', function() {
104 loadedPlaylist++; 104 loadedPlaylist++;
105 }); 105 });
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
131 }); 131 });
132 132
133 test('moves to HAVE_CURRENT_METADATA when refreshing the playlist', function() { 133 test('moves to HAVE_CURRENT_METADATA when refreshing the playlist', function() {
134 var loader = new videojs.hls.PlaylistLoader('live.m3u8'); 134 var loader = new videojs.Hls.PlaylistLoader('live.m3u8');
135 requests.pop().respond(200, null, 135 requests.pop().respond(200, null,
136 '#EXTM3U\n' + 136 '#EXTM3U\n' +
137 '#EXTINF:10,\n' + 137 '#EXTINF:10,\n' +
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
145 }); 145 });
146 146
147 test('returns to HAVE_METADATA after refreshing the playlist', function() { 147 test('returns to HAVE_METADATA after refreshing the playlist', function() {
148 var loader = new videojs.hls.PlaylistLoader('live.m3u8'); 148 var loader = new videojs.Hls.PlaylistLoader('live.m3u8');
149 requests.pop().respond(200, null, 149 requests.pop().respond(200, null,
150 '#EXTM3U\n' + 150 '#EXTM3U\n' +
151 '#EXTINF:10,\n' + 151 '#EXTINF:10,\n' +
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
161 test('emits an error when an initial playlist request fails', function() { 161 test('emits an error when an initial playlist request fails', function() {
162 var 162 var
163 errors = [], 163 errors = [],
164 loader = new videojs.hls.PlaylistLoader('master.m3u8'); 164 loader = new videojs.Hls.PlaylistLoader('master.m3u8');
165 165
166 loader.on('error', function() { 166 loader.on('error', function() {
167 errors.push(loader.error); 167 errors.push(loader.error);
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
175 test('errors when an initial media playlist request fails', function() { 175 test('errors when an initial media playlist request fails', function() {
176 var 176 var
177 errors = [], 177 errors = [],
178 loader = new videojs.hls.PlaylistLoader('master.m3u8'); 178 loader = new videojs.Hls.PlaylistLoader('master.m3u8');
179 179
180 loader.on('error', function() { 180 loader.on('error', function() {
181 errors.push(loader.error); 181 errors.push(loader.error);
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
197 // http://tools.ietf.org/html/draft-pantos-http-live-streaming-12#section-6.3.4 197 // http://tools.ietf.org/html/draft-pantos-http-live-streaming-12#section-6.3.4
198 test('halves the refresh timeout if a playlist is unchanged' + 198 test('halves the refresh timeout if a playlist is unchanged' +
199 'since the last reload', function() { 199 'since the last reload', function() {
200 new videojs.hls.PlaylistLoader('live.m3u8'); 200 new videojs.Hls.PlaylistLoader('live.m3u8');
201 requests.pop().respond(200, null, 201 requests.pop().respond(200, null,
202 '#EXTM3U\n' + 202 '#EXTM3U\n' +
203 '#EXT-X-MEDIA-SEQUENCE:0\n' + 203 '#EXT-X-MEDIA-SEQUENCE:0\n' +
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
218 }); 218 });
219 219
220 test('media-sequence updates are considered a playlist change', function() { 220 test('media-sequence updates are considered a playlist change', function() {
221 new videojs.hls.PlaylistLoader('live.m3u8'); 221 new videojs.Hls.PlaylistLoader('live.m3u8');
222 requests.pop().respond(200, null, 222 requests.pop().respond(200, null,
223 '#EXTM3U\n' + 223 '#EXTM3U\n' +
224 '#EXT-X-MEDIA-SEQUENCE:0\n' + 224 '#EXT-X-MEDIA-SEQUENCE:0\n' +
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
238 test('emits an error if a media refresh fails', function() { 238 test('emits an error if a media refresh fails', function() {
239 var 239 var
240 errors = 0, 240 errors = 0,
241 loader = new videojs.hls.PlaylistLoader('live.m3u8'); 241 loader = new videojs.Hls.PlaylistLoader('live.m3u8');
242 242
243 loader.on('error', function() { 243 loader.on('error', function() {
244 errors++; 244 errors++;
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
256 }); 256 });
257 257
258 test('switches media playlists when requested', function() { 258 test('switches media playlists when requested', function() {
259 var loader = new videojs.hls.PlaylistLoader('master.m3u8'); 259 var loader = new videojs.Hls.PlaylistLoader('master.m3u8');
260 requests.pop().respond(200, null, 260 requests.pop().respond(200, null,
261 '#EXTM3U\n' + 261 '#EXTM3U\n' +
262 '#EXT-X-STREAM-INF:BANDWIDTH=1\n' + 262 '#EXT-X-STREAM-INF:BANDWIDTH=1\n' +
...@@ -284,7 +284,7 @@ ...@@ -284,7 +284,7 @@
284 }); 284 });
285 285
286 test('can switch media playlists based on URI', function() { 286 test('can switch media playlists based on URI', function() {
287 var loader = new videojs.hls.PlaylistLoader('master.m3u8'); 287 var loader = new videojs.Hls.PlaylistLoader('master.m3u8');
288 requests.pop().respond(200, null, 288 requests.pop().respond(200, null,
289 '#EXTM3U\n' + 289 '#EXTM3U\n' +
290 '#EXT-X-STREAM-INF:BANDWIDTH=1\n' + 290 '#EXT-X-STREAM-INF:BANDWIDTH=1\n' +
...@@ -312,7 +312,7 @@ ...@@ -312,7 +312,7 @@
312 }); 312 });
313 313
314 test('aborts in-flight playlist refreshes when switching', function() { 314 test('aborts in-flight playlist refreshes when switching', function() {
315 var loader = new videojs.hls.PlaylistLoader('master.m3u8'); 315 var loader = new videojs.Hls.PlaylistLoader('master.m3u8');
316 requests.pop().respond(200, null, 316 requests.pop().respond(200, null,
317 '#EXTM3U\n' + 317 '#EXTM3U\n' +
318 '#EXT-X-STREAM-INF:BANDWIDTH=1\n' + 318 '#EXT-X-STREAM-INF:BANDWIDTH=1\n' +
...@@ -331,7 +331,7 @@ ...@@ -331,7 +331,7 @@
331 }); 331 });
332 332
333 test('switching to the active playlist is a no-op', function() { 333 test('switching to the active playlist is a no-op', function() {
334 var loader = new videojs.hls.PlaylistLoader('master.m3u8'); 334 var loader = new videojs.Hls.PlaylistLoader('master.m3u8');
335 requests.pop().respond(200, null, 335 requests.pop().respond(200, null,
336 '#EXTM3U\n' + 336 '#EXTM3U\n' +
337 '#EXT-X-STREAM-INF:BANDWIDTH=1\n' + 337 '#EXT-X-STREAM-INF:BANDWIDTH=1\n' +
...@@ -350,7 +350,7 @@ ...@@ -350,7 +350,7 @@
350 }); 350 });
351 351
352 test('throws an error if a media switch is initiated too early', function() { 352 test('throws an error if a media switch is initiated too early', function() {
353 var loader = new videojs.hls.PlaylistLoader('master.m3u8'); 353 var loader = new videojs.Hls.PlaylistLoader('master.m3u8');
354 354
355 throws(function() { 355 throws(function() {
356 loader.media('high.m3u8'); 356 loader.media('high.m3u8');
...@@ -368,7 +368,7 @@ ...@@ -368,7 +368,7 @@
368 }); 368 });
369 369
370 test('throws an error if a switch to an unrecognized playlist is requested', function() { 370 test('throws an error if a switch to an unrecognized playlist is requested', function() {
371 var loader = new videojs.hls.PlaylistLoader('master.m3u8'); 371 var loader = new videojs.Hls.PlaylistLoader('master.m3u8');
372 requests.pop().respond(200, null, 372 requests.pop().respond(200, null,
373 '#EXTM3U\n' + 373 '#EXTM3U\n' +
374 '#EXT-X-STREAM-INF:BANDWIDTH=1\n' + 374 '#EXT-X-STREAM-INF:BANDWIDTH=1\n' +
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
39 39
40 module('segment parser', { 40 module('segment parser', {
41 setup: function() { 41 setup: function() {
42 parser = new window.videojs.hls.SegmentParser(); 42 parser = new window.videojs.Hls.SegmentParser();
43 } 43 }
44 }); 44 });
45 45
...@@ -168,11 +168,11 @@ ...@@ -168,11 +168,11 @@
168 result = result.concat(makePsi(settings)); 168 result = result.concat(makePsi(settings));
169 169
170 // ensure the resulting packet is the correct size 170 // ensure the resulting packet is the correct size
171 result.length = window.videojs.hls.SegmentParser.MP2T_PACKET_LENGTH; 171 result.length = window.videojs.Hls.SegmentParser.MP2T_PACKET_LENGTH;
172 return result; 172 return result;
173 }, 173 },
174 h264Type = window.videojs.hls.SegmentParser.STREAM_TYPES.h264, 174 h264Type = window.videojs.Hls.SegmentParser.STREAM_TYPES.h264,
175 adtsType = window.videojs.hls.SegmentParser.STREAM_TYPES.adts; 175 adtsType = window.videojs.Hls.SegmentParser.STREAM_TYPES.adts;
176 176
177 parser.parseSegmentBinaryData(new Uint8Array(makePacket({ 177 parser.parseSegmentBinaryData(new Uint8Array(makePacket({
178 programs: { 178 programs: {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
15 <script src="../libs/qunit/qunit.js"></script> 15 <script src="../libs/qunit/qunit.js"></script>
16 16
17 <!-- video.js --> 17 <!-- video.js -->
18 <script src="../node_modules/video.js/dist/video-js/video.js"></script> 18 <script src="../node_modules/video.js/dist/video-js/video.dev.js"></script>
19 <script src="../node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js"></script> 19 <script src="../node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js"></script>
20 20
21 <!-- HLS plugin --> 21 <!-- HLS plugin -->
......