Louis
Louis

Reputation: 75

Code to detect webcam does not work on Chrome when running on server

I am using the Javascript code below to detect a webcam:

navigator.getMedia = ( navigator.getUserMedia 
    || navigator.webkitGetUserMedia 
    || navigator.mozGetUserMedia 
    || navigator.msGetUserMedia);

It works with Chrome when the application is running on my computer. But when I am running the application on the server, it works fine with Firefox but not with Chrome. I am getting the error message "No Camera available" like if it is trying to detect the webcam on the server side (the server has no webcan) and not on the client side, my computer. What can be the problem?

Upvotes: 0

Views: 1659

Answers (1)

ROCHEDY
ROCHEDY

Reputation: 85

It's because Google chrome wants https connection to enable webcam.

Webcam works on google chrome only on https connection or on localhost.

Upvotes: 2

Related Questions