MediaRecorder API simple example / “hello world”
问题 Here's a simple example for the MediaRecorder API: (async function() { let chunks = []; let stream = await navigator.mediaDevices.getUserMedia({ audio:true, video:false }); let mediaRecorder = new MediaRecorder(stream); // record for 3 seconds: mediaRecorder.start(); setTimeout(() => { mediaRecorder.stop(); }, 3000) mediaRecorder.ondataavailable = function(e) { chunks.push(e.data); }; mediaRecorder.onstop = async function() { let blob = new Blob(chunks, { type: mediaRecorder.mimeType }); let