I am trying to append an ArrayBuffer of a chunk of a mp4 file to a SourceBuffer. After struggling with this for a few days it does append without giving an error. So I guess the format is good.
But when I console.log the SourceBuffer.buffered attribute it stays empty. I’m using sequence as mode.
const buffer = Buffer.concat(tempBuffer);
tempBuffer = [];
const blob = new Blob([buffer], { type: mimeCodec });
const arrayBuffer = await blob.arrayBuffer();
console.log(sourceBuffer);
try {
sourceBuffer.appendBuffer(arrayBuffer);
} catch (error) {
console.log('Error appending to buffer', error);
}
This is how I’m appending data to the SourceBuffer. Every time there is a chunk coming from the api I store it in a temporary buffer. Then when the tempbuffer is appended to the SourceBuffer. I empty the temp buffer.
This is working because I don’t have any errors. I can appendBuffer a complete movie without errors. But when I console.log the sourceBuffer it stays empty:
When I play the video nothing happens just a black screen. So I guess the appending of the buffer isn’t working as it should be. I have no clue what to do now. Documentation is very limited and I can’t find any support groups on discord or other channels.
Why is my SourceBuffer still empty while the appendBuffer method doesn’t throw an error.
Thanks in advance!