Javascript Capture Camera on Phone Doesn’t Work on iPhone

By Forrest Smith -

On an iphone you need to add a 'playsinline' parameter. I think it works by placing it either in the javascript, or as part of the HTML tag -- I just added it to both to be safe, and it resolved the issue so I called it good.

In javascript as part of the getUserMedia function:
let stream = await navigator.mediaDevices.getUserMedia({ 
  video: {
    facingMode: 'environment',
    playsinline: true
  audio: false 

Just in the HTML
<video id="video" style="width: 100%; height: 100%;" autoplay playsinline></video>