Hook up transmuxer to test page
Invoke the transmuxer on muxer/mp4.html and display the results of inspecting the output.
Showing
1 changed file
with
11 additions
and
3 deletions
... | @@ -161,23 +161,31 @@ | ... | @@ -161,23 +161,31 @@ |
161 | reader.addEventListener('loadend', function() { | 161 | reader.addEventListener('loadend', function() { |
162 | var segment = new Uint8Array(reader.result), | 162 | var segment = new Uint8Array(reader.result), |
163 | transmuxer = new videojs.mp2t.Transmuxer(), | 163 | transmuxer = new videojs.mp2t.Transmuxer(), |
164 | events = [], | ||
165 | bytes, | ||
164 | hex = ''; | 166 | hex = ''; |
165 | 167 | ||
166 | transmuxer.on('data', function(data) { | 168 | transmuxer.on('data', function(data) { |
167 | if (data) { | 169 | if (data) { |
168 | console.log(data); | 170 | events.push(data.data); |
169 | } | 171 | } |
170 | }); | 172 | }); |
171 | transmuxer.push(segment); | 173 | transmuxer.push(segment); |
172 | transmuxer.end(); | 174 | transmuxer.end(); |
173 | 175 | ||
176 | bytes = new Uint8Array(events[0].byteLength + events[1].byteLength); | ||
177 | bytes.set(events[0]); | ||
178 | bytes.set(events[1], events[0].byteLength); | ||
179 | |||
180 | console.log('transmuxed', videojs.inspectMp4(bytes)) | ||
181 | // clear old box info | ||
182 | vjsBoxes.innerHTML = JSON.stringify(videojs.inspectMp4(bytes), null, ' '); | ||
183 | |||
174 | // write out the result | 184 | // write out the result |
175 | hex += '<pre>'; | 185 | hex += '<pre>'; |
176 | hex += 'nothing to see here'; | 186 | hex += 'nothing to see here'; |
177 | hex += '</pre>'; | 187 | hex += '</pre>'; |
178 | vjsOutput.innerHTML = hex; | 188 | vjsOutput.innerHTML = hex; |
179 | |||
180 | vjsBoxes.innerHTML = 'nothing to see here'; | ||
181 | }); | 189 | }); |
182 | reader.readAsArrayBuffer(this.files[0]); | 190 | reader.readAsArrayBuffer(this.files[0]); |
183 | }, false); | 191 | }, false); | ... | ... |
-
Please register or sign in to post a comment