我正在使用以下代码使用nodejs服务器,以下是我收到的错误的屏幕截图。
我正在尝试使用视频元素播放网址,该视频在上面的屏幕截图中给出了错误,请让我知道是否缺少某些内容。
function startRecording(){
var canvasElt = document.querySelector('canvas');
var videoElement = document.querySelector('video');
var stream = canvasElt.captureStream(25);
// pc.addStream(stream);
var options = {mimeType: 'video/webm; codecs=vp9'};
var mediaRecorder = new MediaRecorder(stream, options);
mediaRecorder.ondataavailable = handleDataAvailable;
mediaRecorder.start();
var recordedChunks = []
function handleDataAvailable(event) {
if (event.data.size > 0) {
console.log("inside recorded chunks");
recordedChunks.push(event.data);
} else {
// ...
console.log("inside events");
}
}
setTimeout(function(){
console.log("player stopped");
console.log(recordedChunks);
mediaRecorder.stop();
videoElement.src = null;
console.log(videoElement)
var superBuffer = new Blob(recordedChunks,{type: 'video/webm'});
videoElement.src= URL.createObjectURL(superBuffer);
console.log(videoElement.src);
}, 10000);
}