Navigator.mediaDevices.getUserMedia not working on iOS 12 Safari : <p>As of iOS 12, <code>navigator.mediaDevices.getUserMedia()</code> is returning an error in Safari.</p>

<p>To recreate this, open <a href="https://developer.apple.com/library/archive/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/GettingStarted/GettingStarted.html" rel="noreferrer">iPhone Web Inspector</a>, then run this snippet in the console:</p>

<pre><code>var constraints = { audio: true, video: { width: 1280, height: 720 } }; 

navigator.mediaDevices.getUserMedia(constraints)
  .then(function() {
    console.log('getUserMedia completed successfully.');
  })
  .catch(function(error) {
    console.log(error.name + ": " + error.message);
  });
</code></pre>

<p>You'll see that this runs successfully in desktop browsers, and in iOS 11 Safari, but fails in iOS 12 Safari.</p>

<blockquote>
  <p>NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.</p>
</blockquote>

<p>Any idea why?</p>

<p><em>note: This is happening prior to the user being asked if their camera can be accessed, ruling out the possibility of it being because the user denied permission.</em></p>
