I must apologize to all who have downloaded my class. I have forgotten a
very simple yet important piece of code.
I forgot to check if there were no cameras at all available.
Please replace the begin function with this one:
public function begin ():void {
_numCameras = Camera.names.length;
/* FAIL */ if (_numCameras == 0) {
dispatchEvent (new WebcamEvent (WebcamEvent.RESOLVE, null,
"noCameras") ); // No cameras available
return;
}
if (Capabilities.os.substr (0, 6) == "Mac OS") _isMac = true;
_video = new Video();
getDefaultCamera ();
}
Thanks, and again I'm sorry.
Ktu
On Sat, Nov 14, 2009 at 2:01 AM, Ktu <[email protected]>wrote:
> Thanks Eric,
>
> I have not heard about the bluetooth cameras and any related issues. I
> wonder if the fps works there as well. It is hard enough for me to get
> access to Macs and that's half the reason I made the class.
>
> I initially chose 1.5 seconds for each camera and so far almost all cameras
> I have tested have come out of their initial init phase before 1.1 seconds.
> I don't have a lot of experience with a lot of cameras so if you say FW
> cameras tend to be really slow maybe I should change the default for a bit
> longer, but there are properties in the class so you can tell the object how
> long it should check for. I put those in for exactly the reason you are
> describing. Some cameras take longer, and if the developer using my class
> wants to test each camera for a longer period of time he has the ability to.
>
> Thanks for the feedback.
>
> Ktu
>
>
> On Fri, Nov 13, 2009 at 2:16 PM, eric socolofsky <[email protected]>wrote:
>
>> hey ktu et al, i also ran into this problem with FLARManager. my solution
>> is not as reusable as yours, as it's wrapped inside a larger framework, but
>> i used some of the same logic you did. you can find it here:
>>
>>
>> http://transmote.com/codeshare/FLARManager/dev/src/com/transmote/flar/source/FLARCameraSource.as
>>
>> FLARCameraSource checks activity level, just like your WebcamDetection.
>> however, some users have reported that newer sony vaios have a 'bluetooth
>> camera' driver that is not attached to a camera (kind of like OSX's 'DV
>> Video'), but that an activity check on the vaio cam returns activity even
>> when there is none. FLARCameraSource gets around this by differencing
>> frames to check for a change in the camera feed. it looks like you're also
>> checking the reported camera fps; i don't have a vaio so can't check that
>> technique against the 'bluetooth camera', but i wonder if it works there
>> too...
>>
>> also, i notice you're checking across 1.5 seconds for each camera. i have
>> double that time in FLARCameraSource, tho i'm not happy about it...can take
>> a while to cycle through cameras. i've found that 2 seconds is borderline,
>> and 3 is safer, but i'm not sure i trust 1.5 seconds to be enough for all
>> cameras (some are very slow to init, particulary external FW cameras). any
>> thoughts on that?
>>
>> nice work, wish i had found this a month ago, would have saved me some
>> headaches...
>>
>> -eric
>>
>>
>> Message: 1
>>> Date: Thu, 12 Nov 2009 12:51:33 -0500
>>> From: Ktu <[email protected]>
>>> Subject: Re: [Flashcoders] Auto Webcam Detection
>>> To: Flash Coders List <[email protected]>
>>> Message-ID:
>>> <[email protected]>
>>> Content-Type: text/plain; charset=ISO-8859-1
>>>
>>>
>>> I've made an update to my class. I added better Mac detection so the
>>> process
>>> goes quicker on Macs. I've also updated the detection math in general.
>>>
>>> Please if you downloaded it, re-download and update with the new version.
>>> Feedback is nice, and I hope you like it.
>>>
>>> WebcamDetection <http://blog.cataclysmicrewind.com/webcamdetection/>
>>>
>>>
>>> Ktu
>>>
>>> On Fri, Nov 6, 2009 at 4:31 PM, Ktu <[email protected]>
>>> wrote:
>>>
>>> Thanks Juan, I hope you find it beneficial and easy to use.
>>>>
>>>> I also plan on making another update to it this week to make its
>>>> detection
>>>> a little more robust.
>>>> Since most of my reasoning for creating the class was because Macs suck
>>>> and
>>>> always have three cameras in the list, I am going to add some special
>>>> Mac
>>>> detection which should speed up the process for all Mac laptops.
>>>>
>>>> Ktu
>>>>
>>>>
>>>> On Wed, Nov 4, 2009 at 11:08 AM, Juan Pablo Califano <
>>>> [email protected]> wrote:
>>>>
>>>> The test code works fine for me (Win XP, FP 10).
>>>>>
>>>>> I'll be working on a project that includes webcam soon and this could
>>>>> be
>>>>> useful. I'll let you know how it goes if I use it. Thanks for sharing!
>>>>>
>>>>> Cheers
>>>>> Juan Pablo Califano
>>>>>
>>>>> 2009/11/4 Ktu <[email protected]>
>>>>>
>>>>> So I've noticed that Facebook will automatically detect which Camera
>>>>>>
>>>>> object
>>>>>
>>>>>> to use on your computer.
>>>>>> It seems on most if not all macs there are at least three (3) Camera
>>>>>> objects
>>>>>> always available.
>>>>>> So, I've made a class that will automatically detect which webcam is
>>>>>>
>>>>> active
>>>>>
>>>>>> and running.
>>>>>>
>>>>>> Feedback anyone?
>>>>>>
>>>>>> Download it here <http://blog.cataclysmicrewind.com/webcamdetection/>
>>>>>>
>>>>>> It's pretty simple to use:
>>>>>>
>>>>>> import com.crp.utils.WebcamDetection;
>>>>>> import com.crp.events.WebcamEvent;
>>>>>>
>>>>>> var wd:WebcamDetection = new WebcamDetection();
>>>>>> wd.addEventListener (WebcamEvent.RESOLVE, onResolve);
>>>>>> wd.begin();
>>>>>>
>>>>>> function onResolve (e:WebcamEvent):void {
>>>>>> trace(e.code);
>>>>>> switch (e.code) {
>>>>>> case "success":
>>>>>> var myCamera:Camera = e.camera;
>>>>>> break;
>>>>>> case "noPermission":
>>>>>> // the user denied permission
>>>>>> break;
>>>>>> case "noCameras":
>>>>>> // no suitable camera's were found
>>>>>> break;
>>>>>> }
>>>>>> }
>>>>>> _______________________________________________
>>>>>> Flashcoders mailing list
>>>>>> [email protected]
>>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>>>
>>>>>> _______________________________________________
>>>>> Flashcoders mailing list
>>>>> [email protected]
>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>>
>>>>>
>>>>
>>>>
>> _______________________________________________
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders