我做了一个移动应用程序(来自手机的实时视频流)。通常在手机中,当相机在移动背光上时不会进入睡眠模式,但在我的应用程序中,我编写了附加相机的代码,当我开始从应用程序流式传输时,一段时间后手机进入睡眠模式。我需要制作一个应用程序,该应用程序应该能够在视频流式传输时关闭手机。我怎样才能做到这一点?这是我的代码,
camera = null;
netStreamPublisher.attachCamera(null);
if (cameraPosition == "auto") {
camera = Camera.getCamera();
trace("Entered auto");
} else {
if (Camera.names.length == 1) {
camera = Camera.getCamera();
trace("Entered camera");
} else {
var tmpCamera:Camera = null;
trace("Entered");
for (var i:uint = 0; i < Camera.names.length; i++) {
tmpCamera = Camera.getCamera(Camera.names[i]);
if (tmpCamera.position == cameraPosition) {
camera = tmpCamera;
trace("Entered");
break;
}
}
}
}
if (camera) {
camera.setMode (640, 480, 15, true);
camera.setQuality (15000, 0); // 30000, 0 (adobe settings)
netStreamPublisher.attachCamera (camera);
return camera;
} else {
return null;
}