Skip to content

Commit

Permalink
chore: change code example transmuxer event listeners (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
arturparkhisenko authored Mar 7, 2024
1 parent c10bb8c commit 2d61f49
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ Here we put all of this together in a very basic example player.
data.set(segment.data, segment.initSegment.byteLength);
console.log(muxjs.mp4.tools.inspect(data));
sourceBuffer.appendBuffer(data);
// reset the 'data' event listener to just append (moof/mdat) boxes to the Source Buffer
transmuxer.off('data');
})
fetch(segments.shift()).then((response)=>{
Expand All @@ -294,10 +296,9 @@ Here we put all of this together in a very basic example player.
}
function appendNextSegment(){
// reset the 'data' event listener to just append (moof/mdat) boxes to the Source Buffer
transmuxer.off('data');
transmuxer.on('data', (segment) =>{
sourceBuffer.appendBuffer(new Uint8Array(segment.data));
transmuxer.off('data');
})
if (segments.length == 0){
Expand Down

0 comments on commit 2d61f49

Please sign in to comment.