Domanda

The test code:

<!doctype html>
<html>
<body>
<video id="v1" autoplay="autoplay"></video>
<script>
navigator._getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
navigator._getUserMedia({video: true}, function(stream) {
    document.getElementById('v1').src = URL.createObjectURL(stream);
}, function() {});
</script>
</body>
</html>

chrome34.0.1847.116 m doesn't give access to web camera if the page is opened over http, but it works if opened over https. That is, the web camera icon (image from google) appears in address bar. I click it, select "Ask if example.com wants to access your camera", click "Done", then "Reload" in a bar that appears. But the video doesn't appear. It works right from the start if opened over https.

The webcamera is Logitech C210. It works fine in skype. Any thoughts?

È stato utile?

Soluzione

Are you sure it's not because you are trying to open your page directly from the file, not from a webserver and thus with a file:/// prefix and not a http(s):// one ?

If the url in the bar address looks like file:///... then chrome will not allow access to the camera.

However if you launch your page through a basic webserver (python -m SimpleHTTPServer in the folder where your page is) or with JSFiddle (http://jsfiddle.net/7Hkws/), it works perfectly fine.


In chrome settings, Privacy > Content Settings > Medias should be set to Ask when a site requires access to your camera and microphone (recommended)

Altri suggerimenti

This Answer is bit tedious but worth it for techies.Refer to this link and follow the Procedures. Need to create a directory which will be used for Chrome In the Unsecured way and launch it by the command given in the link.

https://gist.github.com/jll90/5e0549ca5cce5d9c3a65600b29aab9a7

Command for windows OS before this command create a folder on this location "D:\chromeInsequre" or at any other location with any name and replace the Path in Bold

start chrome --user-data-dir=D:\chromeInsequre --unsafely-treat-insecure-origin-as-secure=http://example.com/

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top