Is HTML5's getUserMedia for audio recording working now?

前端 未结 4 1759
不知归路
不知归路 2021-01-31 05:41

I had searched a lot of DEMO and examples about getUserMedia , but most are just camera capturing, not microphone.

So I downloaded some examples and tried on my own comp

相关标签:
4条回答
  • 2021-01-31 06:11

    It's working, you just need to add toString parameter after audio : true

    Check this article - link

    0 讨论(0)
  • 2021-01-31 06:17

    It is currently supported in Chrome Canary. You need to type about:flags into the address bar then enable Web Audio Input.

    The following code connects the audio input to the speakers. WATCH OUT FOR THE FEEDBACK!

    <script>
    // this is to store a reference to the input so we can kill it later 
    var liveSource;
    // creates an audiocontext and hooks up the audio input
    function connectAudioInToSpeakers(){
      var context = new webkitAudioContext();  
      navigator.webkitGetUserMedia({audio: true}, function(stream) {
        console.log("Connected live audio input");
        liveSource = context.createMediaStreamSource(stream);
        liveSource.connect(context.destination);
      });
     }
    // disconnects the audio input
    function makeItStop(){
       console.log("killing audio!");
       liveSource.disconnect();
     }
    // run this when the page loads
    connectAudioInToSpeakers();
    </script>
    <input type="button" value="please make it stop!" onclick="makeItStop()"/>
    
    0 讨论(0)
  • 2021-01-31 06:27

    (sorry, I forgot to login, so posting with my proper username...)

    It is currently supported in Chrome Canary. You need to type about:flags into the address bar then enable Web Audio Input.

    The following code connects the audio input to the speakers. WATCH OUT FOR THE FEEDBACK!

    http://jsfiddle.net/2mLtM/

    <script>
    // this is to store a reference to the input so we can kill it later 
    var liveSource;
    // creates an audiocontext and hooks up the audio input
    function connectAudioInToSpeakers(){
      var context = new webkitAudioContext();  
      navigator.webkitGetUserMedia({audio: true}, function(stream) {
        console.log("Connected live audio input");
        liveSource = context.createMediaStreamSource(stream);
        liveSource.connect(context.destination);
      });
     }
    // disconnects the audio input
    function makeItStop(){
       console.log("killing audio!");
       liveSource.disconnect();
     }
    // run this when the page loads
    connectAudioInToSpeakers();
    </script>
    <input type="button" value="please make it stop!" onclick="makeItStop()"/>
    
    0 讨论(0)
  • 2021-01-31 06:34

    It is currently not available in Google Chrome. See Issue 112367.

    You can see in the demo, it will always throw an error saying

    GET blob:http%3A//whatever.it.is/b0058260-9579-419b-b409-18024ef7c6da 404 (Not Found)

    And also you can't listen to the microphone either in

    {
        video: true,
        audio: true
    }
    
    0 讨论(0)
提交回复
热议问题