6

I'm using the following code in an HTML5 page. When I run my page on Android and PC (chrome), the code works fine and I get the correct JavaScript alert(); but when I run the same page on an iOS device like iPhone or iPad, I don't get anything (no alert() at all).

This is my code:

navigator.getUserMedia = ( navigator.getUserMedia || // use the proper vendor prefix
                       navigator.webkitGetUserMedia ||
                       navigator.mozGetUserMedia ||
                       navigator.msGetUserMedia);

navigator.getUserMedia({video: true}, function() {
   alert('camera is supported in your browser');
}, function() {
   alert('camera is not supported in your browser!');
});

Is there something that I'm missing?

Any help would be appreciated.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Jackson
  • 800
  • 16
  • 36
  • 2
    Possible duplicate of [WebApp using webRTC for cross-platform videochat in iOS Browser and Android Chrome](http://stackoverflow.com/questions/23374806/webapp-using-webrtc-for-cross-platform-videochat-in-ios-browser-and-android-chro) – Jeremy J Starcher May 16 '16 at 16:49
  • [Please don't put tags in question titles](https://stackoverflow.com/help/tagging) – Liam Jun 06 '17 at 07:59
  • `getUserMedia` is part of WebRTC and isn't supported by Safari/Apple at this point in time. See: http://iswebrtcreadyyet.com/ And see this question for more information: https://stackoverflow.com/questions/23374806/webapp-using-webrtc-for-cross-platform-videochat-in-ios-browser-and-android-chro/23391401#23391401 – nineteeneightyeight May 16 '16 at 16:40

1 Answers1

-1

It will work in fall 2017, once iOS11 is released.

wildpeaks
  • 7,273
  • 2
  • 30
  • 35