Copyright © 2012 Kaltura Inc.
All Rights Reserved. Designated trademarks and brands are the property of their respective owners.
Use of this web site constitutes acceptance of the Terms of Use and Privacy Policy.
EduVideo.org
The method used in the DeviceDetector is EXTREMELY slow it takes almost 10 seconds to get a mic and camera.
I think rather than monitoring the video display you can actually just look at the currentFPS property of the camera object. This property is 0 when there is no valid device and positive when there is a valid device.
Here are the changes I made:
private var triesOnCurrent:int = 0;
private var testVideo:Video = new Video(50,50);
private var currIndex:Number = 0;
private function tryDetectingCamera(e:Event):void{
if(triesOnCurrent>5){
currIndex++;
if(currIndex>=Camera.names.length){
dispatchCameraError ();
}
triesOnCurrent = 0;
currCamera = Camera.getCamera(currIndex.toString());
testVideo.attachCamera(currCamera);
}
triesOnCurrent++;
if(currCamera){
trace("FPS:" + currCamera.currentFPS);
if( currCamera.currentFPS>0){
trace("Found valid Camera FPS:" + currCamera.currentFPS);
camera = currCamera;
dispatchCameraSuccess ();
oneMinuteTimer.stop();
}}else{trace("NO CAMERA : " + currIndex);}
}
Perhaps you can polish this and work it in to a future release?
Didn't have time to test it too thoroughly. The problem with the DeviceDetector is more so with detecting the mic than the camera -- that is what was taking a really long time.
As far as time goes -- it might only be faster because I sped up the delay between checks of different cameras. So maybe it breaks down on certain platforms.
I do know that this is the same way facebook does their camera detection (i looked at their decompiled swfs)
Thanks for the suggestion!
Comparing to the bitmap test, what is the time difference?
We found many techniques are causing run-time errors with Flash on mac, did you test this on mac or PC?