I was playing around with the html5 new specifications, precisely the webcam functionalities.
By following this tutorial. I was getting the following error:
Native web camera streaming (getUserMedia) is not supported in this browser.
which was taken by this if statement:
if (navigator.getUserMedia)
now, I am sure that navigator.getUserMedia is enabled in my browser, as these examples here work perfectly
so, I modified the code in the if, with the following:
if (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia)
but now, I am getting a javascript error:
Uncaught TypeError: Object #<Navigator> has no method 'getUserMedia'
at this line here:
navigator.getUserMedia('video', successCallback, errorCallback);
which doesn't really make sense! it IS working on the last link i posted!
Any ideas?
Thanks in advance.
If you're testing for navigator.getUserMedia
, navigator.webkitGetUserMedia
, navigator.mozGetUserMedia
and navigator.msGetUserMedia
then you have no guarantee that navigator.getUserMedia()
is available. It could be that or any one of the other three. You could try something like this (from getUserMedia.js):
navigator.getUserMedia_ = ( navigator.getUserMedia
|| navigator.webkitGetUserMedia
|| navigator.mozGetUserMedia
|| navigator.msGetUserMedia);
if ( !! navigator.getUserMedia_) {
navigator.getUserMedia_('video', successCallback, errorCallback);
//The rest of your code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With