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.

3 Answers 3

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.

7
  • 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 5, 2020 at 20:48
  • 2
    @OGSean Yeah , Same. Mar 19, 2020 at 10:34
  • Same here as well. Still not addressed by Apple I'm supposing.
    – RickZ
    Apr 27, 2020 at 15:21
  • According to the notes here: 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. Apr 27, 2020 at 21:10
  • 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 8, 2020 at 6: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">
2
  • I think you have them switched. Front/selfie camera should use "user" and the main/rear camera should use "environment."
    – Art Geigel
    Jul 1, 2020 at 4:06
  • I was mistaken, chalk it up to quarantine... thanks. Jul 2, 2020 at 12:21
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.