Alan
Alan

Reputation: 2639

Object #<Navigator> has no method 'getUserMedia'

I'm trying to use the method getUserMedia() but in the moment I try to call it, the console returns me that error

"Object # has no method 'getUserMedia'"

Have you got any idea of why is this happening?

I'm using the latest version of Chrome

Upvotes: 2

Views: 2419

Answers (1)

user149341
user149341

Reputation:

Current versions of Chrome do not support unprefixed navigator.getUserMedia. You will need to check whether this feature is supported and try prefixed alternatives, such as navigator.webkitGetUserMedia, as well.

For details, see the sample code at https://developer.mozilla.org/en-US/docs/WebRTC/navigator.getUserMedia --

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

navigator.getMedia (constraints, success, error);

And keep in mind that navigator.getMedia may still be undefined if the browser supports none of these methods. It's still a very new feature, and is not universally available.

Upvotes: 4

Related Questions