8fbb05f0 by David LaPalomento

Merge pull request #28 from videojs/smallerrors

Small errors
2 parents b2716ec2 917f9ac5
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
20 window.setTimeout(process, 0); 20 window.setTimeout(process, 0);
21 q.running = true; 21 q.running = true;
22 } 22 }
23 }, 23 }
24 }, 24 },
25 process = function() { 25 process = function() {
26 var task; 26 var task;
......
...@@ -3,28 +3,7 @@ ...@@ -3,28 +3,7 @@
3 window.videojs = window.videojs || {}; 3 window.videojs = window.videojs || {};
4 window.videojs.hls = window.videojs.hls || {}; 4 window.videojs.hls = window.videojs.hls || {};
5 5
6 var 6 var hls = window.videojs.hls;
7 hls = window.videojs.hls,
8
9 // commonly used metadata properties
10 widthBytes = new Uint8Array('width'.length),
11 heightBytes = new Uint8Array('height'.length),
12 videocodecidBytes = new Uint8Array('videocodecid'.length),
13 i;
14
15 // calculating the bytes of common metadata names ahead of time makes the
16 // corresponding writes faster because we don't have to loop over the
17 // characters
18 // re-test with test/perf.html if you're planning on changing this
19 for (i in 'width') {
20 widthBytes[i] = 'width'.charCodeAt(i);
21 }
22 for (i in 'height') {
23 heightBytes[i] = 'height'.charCodeAt(i);
24 }
25 for (i in 'videocodecid') {
26 videocodecidBytes[i] = 'videocodecid'.charCodeAt(i);
27 }
28 7
29 // (type:uint, extraData:Boolean = false) extends ByteArray 8 // (type:uint, extraData:Boolean = false) extends ByteArray
30 hls.FlvTag = function(type, extraData) { 9 hls.FlvTag = function(type, extraData) {
...@@ -49,7 +28,33 @@ hls.FlvTag = function(type, extraData) { ...@@ -49,7 +28,33 @@ hls.FlvTag = function(type, extraData) {
49 bytes.set(flv.bytes.subarray(0, flv.position), 0); 28 bytes.set(flv.bytes.subarray(0, flv.position), 0);
50 flv.bytes = bytes; 29 flv.bytes = bytes;
51 flv.view = new DataView(flv.bytes.buffer); 30 flv.view = new DataView(flv.bytes.buffer);
52 }; 31 },
32
33 // commonly used metadata properties
34 widthBytes = hls.FlvTag.widthBytes || new Uint8Array('width'.length),
35 heightBytes = hls.FlvTag.heightBytes || new Uint8Array('height'.length),
36 videocodecidBytes = hls.FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length),
37 i;
38
39 if (!hls.FlvTag.widthBytes) {
40 // calculating the bytes of common metadata names ahead of time makes the
41 // corresponding writes faster because we don't have to loop over the
42 // characters
43 // re-test with test/perf.html if you're planning on changing this
44 for (i in 'width') {
45 widthBytes[i] = 'width'.charCodeAt(i);
46 }
47 for (i in 'height') {
48 heightBytes[i] = 'height'.charCodeAt(i);
49 }
50 for (i in 'videocodecid') {
51 videocodecidBytes[i] = 'videocodecid'.charCodeAt(i);
52 }
53
54 hls.FlvTag.widthBytes = widthBytes;
55 hls.FlvTag.heightBytes = heightBytes;
56 hls.FlvTag.videocodecidBytes = videocodecidBytes;
57 }
53 58
54 this.keyFrame = false; // :Boolean 59 this.keyFrame = false; // :Boolean
55 60
......
...@@ -591,6 +591,10 @@ var ...@@ -591,6 +591,10 @@ var
591 }; 591 };
592 592
593 videojs.plugin('hls', function() { 593 videojs.plugin('hls', function() {
594 if (typeof Uint8Array === 'undefined') {
595 return;
596 }
597
594 var initialize = function() { 598 var initialize = function() {
595 return function() { 599 return function() {
596 this.hls = initialize(); 600 this.hls = initialize();
......