js调用MediaRecorder录制麦克风声音并回放下载代码

代码语言:html

所属分类:多媒体

代码描述:js调用MediaRecorder录制麦克风声音并回放下载代码

代码标签: 麦克风 录音 回放 下载

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">


</head>

<body>
    <button id="recordButton">Record/Stop</button>



    <script>
        var recorder, gumStream;
        var recordButton = document.getElementById("recordButton");
        recordButton.addEventListener("click", toggleRecording);
        
        function toggleRecording() {
          if (recorder && recorder.state == "recording") {
            recorder.stop();
            gumStream.getAudioTracks()[0].stop();
          } else {
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0