1541a1dc by David LaPalomento

Working example!

The single-segment example works.
1 parent fbb6a663
...@@ -71,14 +71,14 @@ ...@@ -71,14 +71,14 @@
71 mediaSource = new videojs.MediaSource(); 71 mediaSource = new videojs.MediaSource();
72 72
73 mediaSource.addEventListener('sourceopen', function(event){ 73 mediaSource.addEventListener('sourceopen', function(event){
74 var tag, bytes, parser, i, feedBytes, everything, old; 74 var tag, bytes, parser, i, everything, old;
75 75
76 // feed parsed bytes into the player 76 // feed parsed bytes into the player
77 var sourceBuffer = mediaSource.addSourceBuffer('video/flv; codecs="vp6,aac"'); 77 var sourceBuffer = mediaSource.addSourceBuffer('video/flv; codecs="vp6,aac"');
78 parser = new videojs.hls.SegmentParser(); 78 parser = new videojs.hls.SegmentParser();
79 // var header = parser.getFlvHeader(); 79 // var header = parser.getFlvHeader();
80 everything = parser.getFlvHeader(); 80 everything = parser.getFlvHeader();
81 // sourceBuffer.appendBuffer(header); 81 // sourceBuffer.appendBuffer(header, video);
82 82
83 parser.parseSegmentBinaryData(window.bcSegment); 83 parser.parseSegmentBinaryData(window.bcSegment);
84 84
...@@ -90,12 +90,12 @@ ...@@ -90,12 +90,12 @@
90 everything.set(tag.bytes, old.byteLength); 90 everything.set(tag.bytes, old.byteLength);
91 } 91 }
92 console.log('sending ' + everything.byteLength + 'B'); 92 console.log('sending ' + everything.byteLength + 'B');
93 var iframe = document.createElement('iframe'); 93 // var iframe = document.createElement('iframe');
94 iframe.src = 'data:video/x-flv;base64,' + window.btoa((Array.prototype.map.call(everything, function(byte) { 94 // iframe.src = 'data:video/x-flv;base64,' + window.btoa((Array.prototype.map.call(everything, function(byte) {
95 return String.fromCharCode(byte); 95 // return String.fromCharCode(byte);
96 })).join('')); 96 // })).join(''));
97 document.body.appendChild(iframe); 97 //document.body.appendChild(iframe);
98 // sourceBuffer.appendBuffer(everything, video); 98 sourceBuffer.appendBuffer(everything, video);
99 }, false); 99 }, false);
100 100
101 url = videojs.URL.createObjectURL(mediaSource); 101 url = videojs.URL.createObjectURL(mediaSource);
......