I am trying to transfer a video file through socket.io to my client (currently using Chrome as a client). I get only the first frame of the video, and then the message βFailed to add appendBufferβ appears:
Failed to execute 'appendBuffer' in 'SourceBuffer': HTMLMediaElement.error attribute is not null
Part of JS Code:
if (buffer.updating || queue.length > 0) {
console.log("buffer.updating = " + buffer.updating + " queue.length = " + (queue.length));
queue.push(videoData);
} else {
console.log("else buffer.updating = " + buffer.updating + " queue.length = " + (queue.length));
buffer.appendBuffer(videoData);
}
}
};
var play = function() {
var mimeType = 'video/mp4;codecs="' + codec +'"';
console.log("mimetype = " + mimeType + " is supported = " + MediaSource.isTypeSupported(mimeType));
buffer = mediaSource.addSourceBuffer(mimeType);
buffer.addEventListener('update', function () {
if (queue.length > 0 && !buffer.updating) {
console.log("buffer.appendBuffer");
buffer.appendBuffer(queue.shift());
}
});
video.play();
};
Please help me!
source
share