일부 웹캠 드라이버의 경우 웹캠이 다른 응용 프로그램에서 사용중인 경우에도 Camera 객체가 null이되지 않습니다. 유일한 차이점은 카메라가 이미 사용중인 경우 카메라가 Video 객체에 연결되면 ActivityEvent가 실행되지 않습니다.
내가 5 초 타임 아웃을 설정하고 활동 이벤트가 아직 해고하지 않았다면 이벤트를 제기하여 문제를 해결 :이 사람을 도움이
public function WebCam(w:Number, h:Number, eventClient:Object) {
_camera = Camera.getCamera();
_micLive = Microphone.getMicrophone();
_cameraWidth = w; // DEFAULT_CAMERA_WIDTH;
_cameraHeight = h; // DEFAULT_CAMERA_HEIGHT;
if (_camera != null) {
video = new Video(_camera.width, _camera.height); //displays video feed
video.attachCamera(_camera);
addChild(video);
_camera.addEventListener(StatusEvent.STATUS, cameraStatus);
_camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
_camera.setMode(_cameraWidth, _cameraHeight, DEFAULT_CAMERA_FPS)
//set timer to ensure that the camera activates. If not, it might be in use by another application
_waitingActivation = true;
_timer = new Timer(TIMER_INTERVAL);
_timer.addEventListener(TimerEvent.TIMER, activationTimeout);
_timer.start();
}
else {
//Security.showSettings(SecurityPanel.CAMERA)
}
}
private function cameraStatus(event:StatusEvent):void{
trace(_camera.muted);
}
private function activityHandler(e:ActivityEvent):void {
trace('camera Activity');
trace(_camera.activityLevel);
if (e.activating){
this._waitingActivation = false;
}
}
protected function activationTimeout(e:TimerEvent):void{
if (this._waitingActivation)
this.dispatchEvent(new Event(WebCam.ACTIVATION_TIMEOUT, true));
_timer.stop();
}
희망을.
답장을 보내 주셔서 감사합니다. 문제는 Camera.getCamera()가 시스템에 연결된 카메라가없는 경우에만 null을 반환한다는 것입니다. 카메라가 다른 응용 프로그램에서 사용되고있는 경우에도 카메라 유형 객체를 반환합니다. 카메라 객체를 얻었을 때 두 경우 모두의 속성을 검사했으며 카메라가 이미 사용 중인지 여부를 식별하는 데는 차이가 없습니다. 플래시 플레이어의 개인 정보 보안 상자에서 충돌 문제가 발생합니다. "허용"버튼을 클릭하면 브라우저가 충돌합니다. 거부 될 경우 예상대로 아무 일도 일어나지 않습니다. 지금 당신은 분명히 그림이 있기를 바랍니다. –
'허용'에서 어떤 코드가 호출됩니까? 충돌 이전 상태 또는 활동 이벤트 수신기가 있습니까? 이 상황을 위해 카메라 앱을 자주 테스트했으며,이 버그가 발생하지 않았습니다. – quoo
상태 이벤트에 리스너를 등록하지 않았습니다. 이 문제가 발생하면 두 가지 브라우저에서 앱을 사용해보세요. 동일한 브라우저에서 여러 개의 앱에서 동일한 카메라에 액세스하면 왜 그런 일이 발생하지 않는지 알 수 없습니다. 그러나 데스크탑 응용 프로그램이나 다른 브라우저에서 사용중인 카메라는 반드시 발생합니다. 다른 브라우저에서 웹캠 녹화 옵션을 사용하여 YouTube 동영상 업 로더로 카메라 앱 중 하나를 사용하면 내가 말하는 것을 볼 수 있습니다. –