Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript function navigator.getUserMedia is undefined in Safari 5?

I'm using Safari v5.1.7 on Windows 7
I want to use the javascript function: navigator.getUserMedia; to use media devices
such as a camera or microphone for audio,
The problem is that navigator.getUserMedia is always undefined

Here's my code:

navigator.getUserMedia (
    {audio: true}, 
    function(stream) {console.log('Stream: ' + e);}, 
    function(error)  {console.log('Error: '  + e);}
);

I also tried the following code, and it's also undefined:

navigator.getMedia = ( navigator.getUserMedia       ||
                       navigator.webkitGetUserMedia ||
                       navigator.mozGetUserMedia    ||
                       navigator.msGetUserMedia );    
navigator.getMedia (
    {audio: true}, 
    function(stream) {console.log('Stream: ' + e);}, 
    function(error)  {console.log('Error: '  + e);}
);

How to solve this ?
Or what is its equivalent if this function isn't provided in Safari ?

like image 789
Ashraf Bashir Avatar asked Feb 06 '26 21:02

Ashraf Bashir


1 Answers

Safari doesn't support WebRTC, which is the HTML5 standard that defines getUserMedia. At the moment this API will only work in Firefox and Chrome.

like image 167
tomtheengineer Avatar answered Feb 08 '26 11:02

tomtheengineer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!