Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Unfortunately i have no USB camera to test this with (only got insight).</p> <p>You could try ActivityEvent and set motionlevel to some low value.</p> <p>ActivityEvent will give you response if and when motion is detected in camera. I belive when Camera is physically disconnected, activity event should trigger since no activity will be detected.</p> <p>Here's a piece of example:</p> <pre><code>import flash.media.Camera; import flash.display.Stage; import flash.media.Video; import flash.events.ActivityEvent; import flash.events.StatusEvent; var camera:Camera = Camera.getCamera(); camera.setMode(stage.stageWidth, stage.stageHeight,25); camera.addEventListener(ActivityEvent.ACTIVITY, activityEventHandler,false,0,true); camera.setMotionLevel(3); var video:Video = new Video(); video.width = stage.stageWidth; video.height = stage.stageHeight; video.attachCamera(camera); addChild(video); function activityEventHandler(a:ActivityEvent):void{ trace('Motion detected: '+a.activating); } </code></pre> <p>Note: setMotionlevel default value is 50 so if you set it to eg. 3 then camera still notices some small changes, even eye-blinking. That would help you to detect if there is any kind of motion at all. If no motion is detected then camera is probably dead.</p> <p>You maybe even can use motionlevel as 1, but this value is very sensitive and even slightest change in room lightning is probably detected as motion.</p> <p>Let me know if that helps, would be interesting to hear about this in practice with real USB camera.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload