NotReadableError: Could not start source : <p>I have added this piece of code in my project</p>

<pre><code>if (navigator.mediaDevices === undefined) {
  navigator.mediaDevices = {};
}

if (navigator.mediaDevices.getUserMedia === undefined) {
  navigator.mediaDevices.getUserMedia = function (constraints) {

    var getUserMedia = (
      navigator.getUserMedia ||
      navigator.webkitGetUserMedia ||
      navigator.mozGetUserMedia
    );

    if (!getUserMedia) {
      return Promise.reject(new Error('getUserMedia is not implemented in this browser'));
    }

    return new Promise(function (resolve, reject) {
      getUserMedia.call(navigator, constraints, resolve, reject);
    });

  };
}
</code></pre>

<p>Then I'm trying to access a video stream using <code>getUserMedia</code></p>

<pre><code>navigator.mediaDevices.getUserMedia({
    video: true,
    audio: false
}).then(stream =&gt; {
    // do stuff
}).catch(error =&gt; {
    console.log(error.name + " " + error.message);
});
</code></pre>

<p>When I test this in my emulators it works on android versions 5 and up, however when I run it on an actual device I get this error</p>

<blockquote>
  <p>NotReadableError Could not start source</p>
</blockquote>

<p>I have added the <code>cordova-plugin-media-capture</code> plugin to make sure my app will request the appropriate permissions, however I don't want to use the plugin I'd rather use the <code>getUserMedia</code> API.</p>

<p>So far my researches show that the reason for this error is that some other app is already using the camera but that's not the case, I even went a step further and restarted the device, then opened my app, making sure there are no other running apps and I still got the error.</p>

<p>Has anyone had this issue?</p>
