samdutton / simpl

Simplest possible examples of HTML, CSS and Javascript:

Home Page:https://simpl.info

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getUserMedia example on iOS

varvello opened this issue · comments

Hi Sam,

On iOS, even is I select the rear camera, the front camera is always chosen.

TIA
Cheers
Davide

Thanks for the heads-up.

This commit fixes this.

There were two problems:
• I'd forgotten to add playsinline to <video> for this demo.
• AFAICT Safari only gets default devices until after gUM is called.

(Demo is at simpl.info/sources.)

Let me know if you're still experiencing glitches.

Unfortunately, Sam, the behaviour is the same. Selecting camera 1 or camera 2 always shows the front camera, sorry.

Update 1: I've noticed that on iOS the camera initially shown as selected may not be the same as the camera that's actually in use. This means you may need to need to select the camera twice in order to see a change. I'll fix this.

Update 2: I've done some additional commits attempting to fix this, but it still seems to require multiple selection on iOS. I'll keep trying...

Sorry to hear it's not working.

What version of iOS are you using?

I've tried iOS 12.3.1 and 12.4 on an iPhone 7 and the demo is working as expected.

(Sounds obvious, I know, but make sure you've got the updated version. It should say mediaDevices.enumerateDevices() in the title and Front/Back Camera in the selector.)

iPhone xr, iOs 12.3.1