gpt4 book ai didi

闪存,AS3 : Is there a way to obtain the current security settings/restrictions for mic/camera programmatically?

转载 作者:行者123 更新时间:2023-12-05 00:03:24 26 4
gpt4 key购买 nike

在 Flash 应用程序中使用麦克风或摄像头时,用户必须在安全设置面板中授予对设备的访问权限。通过选中“记住”复选框,可以将允许访问或拒绝访问的决定设置为在应用程序下次运行时记住。

当用户设置为“记住”他的选择时,安全面板在尝试访问所述设备时不会弹出。但是我们如何知道访问权限是否被授予?

那么有没有办法检查用户是否允许或拒绝访问麦克风,以及检查这个决定是设置为一次性还是下次记住?

当用户先前拒绝访问并将其决定设置为记住时,这将特别有用。意识到这一事实后,我们会显示一条消息,告诉用户他必须单击才能打开安全面板并允许访问,例如,如果他想使用该应用程序。

最佳答案

Flash 可以轻松地让您检查当前的限制,并且非常详细地说明它可以让您拥有哪些信息。一切尽在 Camera Adobe 网站上的文档,但我在下面发布了一个示例,希望对您有所帮助。

package 
{
import flash.display.Sprite;
import flash.events.StatusEvent;
import flash.media.Camera;
import flash.system.Security;
import flash.system.SecurityPanel;

public class CameraExample extends Sprite
{
private var _cam:Camera;

public function CameraExample()
{
if (Camera.isSupported)
{
this._cam = Camera.getCamera();

if (!this._cam)
{
// no camera is installed
}
else if (this._cam.muted)
{
// user has disabled the camera access in security settings

Security.showSettings(SecurityPanel.PRIVACY); // show security settings window to allow them to change camera security settings

this._cam.addEventListener(StatusEvent.STATUS, this._statusHandler, false, 0, true); // listen out for their new decision
}
else
{
// you have access, do what you like with the cam object
}
}
else
{
// camera is not supported on this device (iOS/Android etc)
}
}

private function _statusHandler(e:StatusEvent):void
{
if (e.code == "Camera.Unmuted")
{
this._cam.removeEventListener(StatusEvent.STATUS, this._statusHandler);

// they have allowed access to the camera, do what you like the cam object
}
}
}
}

关于闪存,AS3 : Is there a way to obtain the current security settings/restrictions for mic/camera programmatically?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6947927/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com