webcamjs icon indicating copy to clipboard operation
webcamjs copied to clipboard

Access to camera denied in IE11

Open ErikEklund opened this issue 9 years ago • 9 comments

I get "Webcam.js error: Access to the camera denied" in IE 11 when running from a web server. If I run the same code on a server running at 192.168.1.x (ie local machine) in the same browser/computer, everything works fine. I checked that flash was set to ask for access, and the IE security settings were set to Medium. Webcam.js is set to force flash.

Is this a bug? It says it's denied even though the camera permission request window never appears.

ErikEklund avatar Jan 22 '16 18:01 ErikEklund

Seems the issue was the SWF was not preloaded. When preloading it before initializing the webcam object it worked. Race condition?

ErikEklund avatar Jan 22 '16 21:01 ErikEklund

Wow, that is very bizarre.  I've never experienced that issue before.  I will try to reproduce once I get my PC working again.

Thanks for the bug report.  How did you preload the SWF?

Joseph Huckaby [email protected]

On Fri, Jan 22, 2016, at 01:53 PM, ErikEklund wrote:

Seems the issue was the SWF was not preloaded. When preloading it before initializing the webcam object it worked. Race condition?

— Reply to this email directly or view it on GitHub[1].

Links:

  1. https://github.com/jhuckaby/webcamjs/issues/148#issuecomment-174064678

jhuckaby avatar Jan 22 '16 21:01 jhuckaby

Used preloadjs to preload. I tried to recreate this on a test page (only the cam with no preloader and nothing else), on two different external servers, but that worked every time. Might be that I preloaded other stuff in the background while adding the webcam, causing slower loading.

Hard to tell the exact cause of the issue. Feel free to close this bug as it's not reproducable.

ErikEklund avatar Jan 22 '16 22:01 ErikEklund

I'm having the same issue, but it happens local or remote, and I'm not using preloadjs. The only strange thing is that I'm showing it from a modal

escobar5 avatar Mar 03 '16 20:03 escobar5

Yeah, It happens when you access domain for the first time and after clearing localStorage

CezaryDanielNowak avatar May 16 '16 11:05 CezaryDanielNowak

I have same error message. With flash plugin and a width less than < 214px

Webcam.set({
    width: 200,
    ...
});

It seems container is to small for Flash parameters dialog.

So in this case, flash parameter dialog is not shown. And we have an error from Webcam.js:

Access to camera is denied

I understand if it would not be fixed but it can help in case of debugging

emhar avatar Feb 08 '17 12:02 emhar

@emhar I found that the height matters too. 137px failed, 150px worked.

tjsingleton avatar Feb 27 '17 21:02 tjsingleton

I have that problem too. When I use webcam.js in my website, it works fine at first, but the error "Access to camera denied" occurs when i open the camera for the second time. I still don't know why or how to fix it. Must the swf file be placed in the same category with webcam.js? Please help me and I will be very thankful. @ErikEklund @jhuckaby

sunny-ray avatar Sep 04 '18 05:09 sunny-ray

Hello everyone i fixed this issue by using preloadjs. The idea is to attach the camera when the swf file is loaded. I used preloadjs which you can download it here https://www.createjs.com/downloads.

Example

`var queue = new createjs.LoadQueue(false); queue.on("fileload", handleFileComplete); queue.loadFile('/Content/Images/webcam.swf');

function handleFileComplete(event) {
    $("#video").hide();
    Webcam.set({
        swfURL: '/Content/Scripts/webcam.swf',
        width: 320,
        height: 240,
        image_format: 'png',
    });

    Webcam.attach('#cam-video');
  
}`

Dorentin1997 avatar Sep 28 '18 09:09 Dorentin1997