19

The below code of HTML

<video id="video" class="video" height="400" width="400" playsinline autoplay muted loop></video>

and JavaScript

var video = document.getElementById("video");

navigator.mediaDevices.getUserMedia({video: true, audio: false})
    .then(function(s) {
    stream = s;
    video.srcObject = s;
    video.play();
  })

The link works fine on all Browsers in Android device, also works fine on Safari browser of iPhone devices, but it does not even ask camera permission for other Browsers like Chrome and Firefox on iPhone Devices.

Simon Fernandes
  • 235
  • 1
  • 3
  • 14

3 Answers3

31

I have not tested this myself, but apparently this functionality was introduced in November 2020


Original answer:

Chrome and FireFox on iOS still use the iOS WebKit rendering engine. getUserMedia is only available in Safari, not other browsers on iOS.

This is currently being tracked here: https://bugs.chromium.org/p/chromium/issues/detail?id=752458 - but given it was first reported over a year ago and just 5 days ago it was updated to say it hasn't been fixed, I am not holding my breath.

Mark Henderson
  • 2,586
  • 1
  • 33
  • 44
  • 16
    It's now 2020 and I'm having the same issue... works fine on Android / Chrome, doesn't even ask for media access on iOS / Chrome and just ends up with no webcam. Strange – OG Sean Feb 05 '20 at 20:48
  • 2
    @OGSean Yeah , Same. – Thanveer Shah Mar 19 '20 at 10:34
  • Same here as well. Still not addressed by Apple I'm supposing. – RickZ Apr 27 '20 at 15:21
  • According to the notes here: https://bugs.webkit.org/show_bug.cgi?id=185448#c6 - this should be fixed _for apps that have been added to the home screen_. No word on webpages being browsed normally though. – Mark Henderson Apr 27 '20 at 21:10
  • One of the last comments says it should be fixed in iOS 13.4, could anyone confirm it? – Codeicus Jun 19 '20 at 15:05
  • Does anyone has a solution for this? I still can't find any workaround for this. – Abbas Afzal Sep 20 '20 at 21:46
  • 3
    US Congress released a report this week detailing the anti-competitive behavior by Apple (and Google, among others). Little things like this but a small sample of the platform monopoly abuse—in this case harming rapid response COVID-19 testing sites, as one story among untold millions. – Laser Oct 08 '20 at 06:19
0

Chrome on iOS (13.1.1) is able to access both front and rear cameras using html5 proper input tag for image capture, but yeah still a bummer they don't support the getUserMedia for video streaming.

Here's a fiddle

For Front:
<input type="file" accept="image/*" capture="user">

For Rear:
<input type="file" accept="image/*" capture="environment">
0

it's the last day of 2020 now, this accesses the camera on an iPad pro and shows the real-time camera view in the display just fine from safari, but on chrome all I see is a black screen with the camera controls.

<input id="sImage" name="sImage" type="file" accept="image/png, image/jpeg" capture="user">

iPad pro using the latest IOS, version 14.3: fails on Chrome, works on Safari iPad mini using IOS 14.2 and 14.3: both work on Chrome. iPhone X using IOS 14.2 and 14.3: both work on Chrome.

den232
  • 682
  • 6
  • 14