0d50a43c by David LaPalomento

Remove (hopefully) the last remaining tabs

Actually run `untabify` in emacs to get rid of tabs.
1 parent 977e86ea
...@@ -25,43 +25,43 @@ ...@@ -25,43 +25,43 @@
25 25
26 self.loadManifest = function(manifestUrl, onDataCallback, onErrorCallback, onUpdateCallback) { 26 self.loadManifest = function(manifestUrl, onDataCallback, onErrorCallback, onUpdateCallback) {
27 self.mediaSource.addEventListener('sourceopen', function(event) { 27 self.mediaSource.addEventListener('sourceopen', function(event) {
28 // feed parsed bytes into the player 28 // feed parsed bytes into the player
29 self.sourceBuffer = self.mediaSource.addSourceBuffer('video/flv; codecs="vp6,aac"'); 29 self.sourceBuffer = self.mediaSource.addSourceBuffer('video/flv; codecs="vp6,aac"');
30 30
31 self.parser = new SegmentParser(); 31 self.parser = new SegmentParser();
32 32
33 self.sourceBuffer.appendBuffer(self.parser.getFlvHeader(), video); 33 self.sourceBuffer.appendBuffer(self.parser.getFlvHeader(), video);
34 34
35 if (onDataCallback) { 35 if (onDataCallback) {
36 self.manifestLoadCompleteCallback = onDataCallback; 36 self.manifestLoadCompleteCallback = onDataCallback;
37 } 37 }
38 38
39 self.manifestController = new ManifestController(); 39 self.manifestController = new ManifestController();
40 self.manifestController.loadManifest(manifestUrl, self.onM3U8LoadComplete, self.onM3U8LoadError, self.onM3U8Update); 40 self.manifestController.loadManifest(manifestUrl, self.onM3U8LoadComplete, self.onM3U8LoadError, self.onM3U8Update);
41 41
42 }, false); 42 }, false);
43 43
44 self.player.src({ 44 self.player.src({
45 src: videojs.URL.createObjectURL(self.mediaSource), 45 src: videojs.URL.createObjectURL(self.mediaSource),
46 type: "video/flv" 46 type: "video/flv"
47 }); 47 });
48 }; 48 };
49 49
50 self.onM3U8LoadComplete = function(m3u8) { 50 self.onM3U8LoadComplete = function(m3u8) {
51 if (m3u8.invalidReasons.length === 0) { 51 if (m3u8.invalidReasons.length === 0) {
52 if (m3u8.isPlaylist) { 52 if (m3u8.isPlaylist) {
53 self.currentPlaylist = m3u8; 53 self.currentPlaylist = m3u8;
54 self.rendition(self.currentPlaylist.playlistItems[0]); 54 self.rendition(self.currentPlaylist.playlistItems[0]);
55 } else { 55 } else {
56 self.currentManifest = m3u8; 56 self.currentManifest = m3u8;
57 self.manifestLoaded = true; 57 self.manifestLoaded = true;
58 58
59 self.loadSegment(self.currentManifest.mediaItems[0]); 59 self.loadSegment(self.currentManifest.mediaItems[0]);
60 60
61 if (self.manifestLoadCompleteCallback) { 61 if (self.manifestLoadCompleteCallback) {
62 self.manifestLoadCompleteCallback(m3u8); 62 self.manifestLoadCompleteCallback(m3u8);
63 } 63 }
64 } 64 }
65 } 65 }
66 }; 66 };
67 67
...@@ -77,11 +77,11 @@ ...@@ -77,11 +77,11 @@
77 self.parser.parseSegmentBinaryData(segment.binaryData); 77 self.parser.parseSegmentBinaryData(segment.binaryData);
78 78
79 while (self.parser.tagsAvailable()) { 79 while (self.parser.tagsAvailable()) {
80 self.sourceBuffer.appendBuffer(self.parser.getNextTag().bytes, self.player); 80 self.sourceBuffer.appendBuffer(self.parser.getNextTag().bytes, self.player);
81 } 81 }
82 82
83 if (self.currentSegment < self.currentManifest.mediaItems.length-1) { 83 if (self.currentSegment < self.currentManifest.mediaItems.length-1) {
84 self.loadNextSegment(); 84 self.loadNextSegment();
85 } 85 }
86 }; 86 };
87 87
......
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
18 self.url = manifestUrl; 18 self.url = manifestUrl;
19 19
20 if (onDataCallback) { 20 if (onDataCallback) {
21 self.onDataCallback = onDataCallback; 21 self.onDataCallback = onDataCallback;
22 } 22 }
23 if (onErrorCallback) { 23 if (onErrorCallback) {
24 self.onErrorCallback = onErrorCallback; 24 self.onErrorCallback = onErrorCallback;
25 } 25 }
26 26
27 if (onUpdateCallback) { 27 if (onUpdateCallback) {
28 self.onUpdateCallback = onUpdateCallback; 28 self.onUpdateCallback = onUpdateCallback;
29 } 29 }
30 30
31 vjs.get(manifestUrl, self.onManifestLoadComplete, self.onManifestLoadError); 31 vjs.get(manifestUrl, self.onManifestLoadComplete, self.onManifestLoadError);
...@@ -43,13 +43,13 @@ ...@@ -43,13 +43,13 @@
43 var output = self.parseManifest(response); 43 var output = self.parseManifest(response);
44 44
45 if (self.onDataCallback != undefined) { 45 if (self.onDataCallback != undefined) {
46 self.onDataCallback(output); 46 self.onDataCallback(output);
47 } 47 }
48 }; 48 };
49 49
50 self.onManifestLoadError = function(err) { 50 self.onManifestLoadError = function(err) {
51 if (self.onErrorCallback != undefined) { 51 if (self.onErrorCallback != undefined) {
52 self.onErrorCallback((err != undefined) ? err : null); 52 self.onErrorCallback((err != undefined) ? err : null);
53 } 53 }
54 }; 54 };
55 } 55 }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
15 request.open('GET', segmentUrl, true); 15 request.open('GET', segmentUrl, true);
16 request.responseType = 'arraybuffer'; 16 request.responseType = 'arraybuffer';
17 request.onload = function(response) { 17 request.onload = function(response) {
18 self.onSegmentLoadComplete(new Uint8Array(request.response)); 18 self.onSegmentLoadComplete(new Uint8Array(request.response));
19 }; 19 };
20 20
21 request.send(null); 21 request.send(null);
...@@ -47,17 +47,17 @@ ...@@ -47,17 +47,17 @@
47 output = self.parseSegment(response); 47 output = self.parseSegment(response);
48 48
49 if (self.onDataCallback !== undefined) { 49 if (self.onDataCallback !== undefined) {
50 self.onDataCallback(output); 50 self.onDataCallback(output);
51 } 51 }
52 }; 52 };
53 53
54 self.onSegmentLoadError = function(error) { 54 self.onSegmentLoadError = function(error) {
55 if (error) { 55 if (error) {
56 console.log(error.message); 56 console.log(error.message);
57 } 57 }
58 58
59 if (self.onErrorCallback !== undefined) { 59 if (self.onErrorCallback !== undefined) {
60 onErrorCallback(error); 60 onErrorCallback(error);
61 } 61 }
62 }; 62 };
63 } 63 }
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
67 ok(parser.tagsAvailable(), 'tags are available'); 67 ok(parser.tagsAvailable(), 'tags are available');
68 68
69 console.log('h264 tags:', parser.stats.h264Tags(), 69 console.log('h264 tags:', parser.stats.h264Tags(),
70 'aac tags:', parser.stats.aacTags()); 70 'aac tags:', parser.stats.aacTags());
71 }); 71 });
72 72
73 testAudioTag = function (tag) { 73 testAudioTag = function (tag) {
...@@ -107,8 +107,8 @@ ...@@ -107,8 +107,8 @@
107 ok(packetType <= 2 && packetType >= 0, 'the packet type is within [0, 2]'); 107 ok(packetType <= 2 && packetType >= 0, 'the packet type is within [0, 2]');
108 if (packetType !== 1) { 108 if (packetType !== 1) {
109 equal(0, 109 equal(0,
110 compositionTime, 110 compositionTime,
111 'the composition time is zero for non-NALU packets'); 111 'the composition time is zero for non-NALU packets');
112 } 112 }
113 113
114 // TODO: the rest of the bytes are an NLU unit 114 // TODO: the rest of the bytes are an NLU unit
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
153 equal(2, type, 'the script element is of string type'); 153 equal(2, type, 'the script element is of string type');
154 equal(stringLength, expected.length, 'the script string length is correct'); 154 equal(stringLength, expected.length, 'the script string length is correct');
155 string = asciiFromBytes(tag.bytes.subarray(offset + 3, 155 string = asciiFromBytes(tag.bytes.subarray(offset + 3,
156 offset + 3 + stringLength)); 156 offset + 3 + stringLength));
157 equal(expected, string, 'the string value is "' + expected + '"'); 157 equal(expected, string, 'the string value is "' + expected + '"');
158 }; 158 };
159 159
...@@ -173,17 +173,17 @@ ...@@ -173,17 +173,17 @@
173 173
174 type = tag.bytes[offset]; 174 type = tag.bytes[offset];
175 ok(type === 1 || type === 0, 175 ok(type === 1 || type === 0,
176 'the ecma array property value type is number or boolean'); 176 'the ecma array property value type is number or boolean');
177 offset++; 177 offset++;
178 if (type) { 178 if (type) {
179 // boolean 179 // boolean
180 ok(tag.bytes[offset] === 0 || tag.bytes[offset] === 1, 180 ok(tag.bytes[offset] === 0 || tag.bytes[offset] === 1,
181 'the script boolean value is 0 or 1'); 181 'the script boolean value is 0 or 1');
182 offset++; 182 offset++;
183 } else { 183 } else {
184 // number 184 // number
185 ok(!isNaN(tag.view.getFloat64(offset)), 'the value is not NaN'); 185 ok(!isNaN(tag.view.getFloat64(offset)), 'the value is not NaN');
186 offset += 8; 186 offset += 8;
187 } 187 }
188 } 188 }
189 equal(tag.bytes[offset], 0, 'the property array terminator is valid'); 189 equal(tag.bytes[offset], 0, 'the property array terminator is valid');
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
214 214
215 // generic flv headers 215 // generic flv headers
216 ok(type === 8 || type === 9 || type === 18, 216 ok(type === 8 || type === 9 || type === 18,
217 'the type field specifies audio, video or script'); 217 'the type field specifies audio, video or script');
218 218
219 byte = (tag.view.getUint32(1) & 0xFFFFFF00) >>> 8; 219 byte = (tag.view.getUint32(1) & 0xFFFFFF00) >>> 8;
220 equal(tag.bytes.byteLength - 11 - 4, byte, 'the size field is correct'); 220 equal(tag.bytes.byteLength - 11 - 4, byte, 'the size field is correct');
...@@ -225,15 +225,15 @@ ...@@ -225,15 +225,15 @@
225 225
226 // tag type-specific headers 226 // tag type-specific headers
227 ({ 227 ({
228 8: testAudioTag, 228 8: testAudioTag,
229 9: testVideoTag, 229 9: testVideoTag,
230 18: testScriptTag 230 18: testScriptTag
231 })[type](tag); 231 })[type](tag);
232 232
233 // previous tag size 233 // previous tag size
234 equal(tag.bytes.byteLength - 4, 234 equal(tag.bytes.byteLength - 4,
235 tag.view.getUint32(tag.bytes.byteLength - 4), 235 tag.view.getUint32(tag.bytes.byteLength - 4),
236 'the size of the previous tag is correct'); 236 'the size of the previous tag is correct');
237 } 237 }
238 }); 238 });
239 239
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
296 manifestController = new window.videojs.hls.ManifestController(); 296 manifestController = new window.videojs.hls.ManifestController();
297 this.vjsget = vjs.get; 297 this.vjsget = vjs.get;
298 vjs.get = function (url, success, error) { 298 vjs.get = function (url, success, error) {
299 success(window.brightcove_playlist_data); 299 success(window.brightcove_playlist_data);
300 }; 300 };
301 }, 301 },
302 teardown: function () { 302 teardown: function () {
...@@ -322,7 +322,7 @@ ...@@ -322,7 +322,7 @@
322 test('should get a manifest from hermes', function () { 322 test('should get a manifest from hermes', function () {
323 manifestController.loadManifest('http://example.com/16x9-master.m3u8', 323 manifestController.loadManifest('http://example.com/16x9-master.m3u8',
324 function(responseData) { 324 function(responseData) {
325 ok(responseData); 325 ok(responseData);
326 }, 326 },
327 function(errorData) { 327 function(errorData) {
328 ok(false, 'does not error'); 328 ok(false, 'does not error');
...@@ -335,8 +335,8 @@ ...@@ -335,8 +335,8 @@
335 segmentController = new window.videojs.hls.SegmentController(); 335 segmentController = new window.videojs.hls.SegmentController();
336 this.vjsget = vjs.get; 336 this.vjsget = vjs.get;
337 vjs.get = function (url, success, error) { 337 vjs.get = function (url, success, error) {
338 console.log('load segment url', url); 338 console.log('load segment url', url);
339 success(window.bcSegment); 339 success(window.bcSegment);
340 }; 340 };
341 }, 341 },
342 teardown: function () { 342 teardown: function () {
......