本文介绍了Firefox:navigator.getUserMedia不是一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在这样做

  var session = {
audio:true,
video:false
};
var recordRTC = null;
navigator.getUserMedia(session,initializeRecorder,onError);

但是,使用最新的FF我得到了一个javascript错误,说

此博客文章:



类似于最新的Chrome:

但是我知道这个API是来自两个浏览器的支持



我做错了什么?

解决方案

尚未支持前提。请参阅



您需要获取浏览器特定的前缀并使用它。正如在中发布的那样:

  navigator.getUserMedia =(navigator.getUserMedia || 
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);

这会将 navigator.getUserMedia 它会检测到正确的前缀版本。


I'm playing with browser and audio.

I'm doing this

        var session = {
          audio: true,
          video: false
        };
        var recordRTC = null;
        navigator.getUserMedia(session, initializeRecorder, onError);

But, using latest FF available I got a javascript error, saying that

I copied this code from this blog post: https://blog.groupbuddies.com/posts/39-tutorial-html-audio-capture-streaming-to-nodejs-no-browser-extensions

And similar on latest Chrome:

But I know that this api is supported from both browser

What am I doing wrong?

解决方案

It's not supported unprefixed yet. See http://caniuse.com/#search=getusermedia

You'll need to get the browser-specific prefix and use that. As posted in another answer:

navigator.getUserMedia = ( navigator.getUserMedia ||
                       navigator.webkitGetUserMedia ||
                       navigator.mozGetUserMedia ||
                       navigator.msGetUserMedia);

This will set navigator.getUserMedia to whatever it detects to be the proper prefixed version.

这篇关于Firefox:navigator.getUserMedia不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 02:28