检测用户的相机设置

发布于 2024-10-19 15:28:46 字数 285 浏览 4 评论 0原文

我在正确检测用户的相机设置时遇到问题。

如果用户选择了“允许”和“记住”,则camera.muted 设置为假(不静音)。

但是,如果用户选择了“拒绝”和“记住”,则camera.muted 设置为true。 (相机已被用户静音)

但是,如果用户没有选择任何内容并且未选中“记住”复选框,则camera.muted设置也为真(相机再次静音,但这只是因为有人没有'还没有“允许”摄像头)

有没有办法区分用户选择永远拒绝特定站点的摄像头(通过选中“记住”复选框)或他们只是不允许摄像头进入第一名?

I am having a problem with correctly detecting a user's camera settings.

If the user has selected "allow" and "remember", then the camera.muted setting is false (not muted)

However, if the user has selected "deny" and "remember", then the camera.muted setting is true. (camera has been muted by the user)

BUT, if the user hasn't selected anything and the "remember" checkbox is unchecked, the camera.muted setting is ALSO TRUE (the camera is again muted, but it's only because someone hasn't "allowed" the camera yet)

Is there a way to differentiate between when a user has chosen to deny a camera forever for a particular site (by checking the "remember" check box) OR when they just haven't allowed the camera in the first place?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

落在眉间の轻吻 2024-10-26 15:28:46

据我所知,没有办法检测“记住”复选框之前是否已被选中。解决方法是根据请求检测相机是否静音。例如:

camera = Camera.getCamera();
if (camera.muted) {
    // "remember" checkbox was not checked, or user needs to allow access
}
else {
    // "remember" checkbox was checked, access is already granted
}

As far as I can tell, there is no way to detect if the "remember" checkbox has been checked before. The workaround is to detect if the camera is muted or not when requested. Such as:

camera = Camera.getCamera();
if (camera.muted) {
    // "remember" checkbox was not checked, or user needs to allow access
}
else {
    // "remember" checkbox was checked, access is already granted
}
李白 2024-10-26 15:28:46

在与 Flash 中的网络摄像头进行过战斗之后,我建议每个人都使用这个库。

https://github.com/cataclysmicrewind/CameraDetection/

Flash + 网络摄像头应该 = 简单 + 很棒。
不幸的是,这是痛苦+折磨。

Having done battle with webcams in flash, I would suggest that everyone use this library.

https://github.com/cataclysmicrewind/CameraDetection/

Flash + webcam should = easy + awesome.
Unfortunately, it is pain + suffering.

乖乖 2024-10-26 15:28:46

您也许可以使用此解决方法来检测安全对话框是否打开。

https://gist.github.com/1266104 中引用了 https://bugbase.adobe.com/index.cfm?event=bug&id=2993848

然后你可以做类似的事情:

var camera:Camera = Camera.getCamera();
if (camera.muted) {
    if (securityPanelIsClosed()) {
        // "remember" was checked and deny radio button is selected
    } else {
        // "remember" was not checked
    }
} else {
    // "remember" checkbox was checked, access is already granted
}

You might be able to use this workaround which can detect whether the security dialog is open.

https://gist.github.com/1266104 referenced in https://bugbase.adobe.com/index.cfm?event=bug&id=2993848

Then you could do something like:

var camera:Camera = Camera.getCamera();
if (camera.muted) {
    if (securityPanelIsClosed()) {
        // "remember" was checked and deny radio button is selected
    } else {
        // "remember" was not checked
    }
} else {
    // "remember" checkbox was checked, access is already granted
}
三人与歌 2024-10-26 15:28:46

对于所有使用 CameraDetection 类的人要小心...这仅适用于在安全面板打开时尝试绘制舞台的解决方法。如果您尝试绘制舞台,而舞台上的某些元素会出现安全沙箱问题(从其他位置加载的图像,甚至当前正在流式传输的视频),您将会遇到问题。基本上,解决方法会自动继续失败并给出错误的结果。

就我而言,当我在舞台上播放视频时,我在尝试使用 CameraDetection 时遇到了困难。无论安全面板是否打开,都会发生 try/catch。

For all those that use the CameraDetection class be cautious... This only works because of a workaround that tries to draw the stage while the security panel is open. You will run into problems if you try to draw the stage while it has certain elements on it that present a security sandbox problem(loaded images from other locations, or even videos thats that are currently streaming). Basically the workaround will automatically continue to fail and give false results.

In my case I was stuck trying to use the CameraDetection while I had a video on the stage that was being streamed. The try/catch happens regardless of the security panel being open.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文