A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Auto Webcam Detection

  1. #1
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312

    Talking Auto Webcam Detection

    4.19.11 **UPDATE** Now on GitHub. Also, much better than before.

    This project 'CameraDetection' does one thing; Find the first working Camera object in AS3.

    This class looks at all of the available Cameras in the Camera.names list and tests them. Using a combination of fps and activity, each Camera is looked at until one is deemed usable.


    It's pretty simple to use:
    PHP Code:
    import ktu.media.CameraDetection;
    import ktu.events.CameraDetectionEvent;

    var 
    cd:CameraDetection = new CameraDetection();
    cd.addEventListener (CameraDetectionEvent.RESOLVEonResolve);
    cd.begin();

    function 
    onResolve (e:CameraEvent):void {
        switch (
    e.code) {
            case 
    CameraDetectionEvent.SUCCESS:
                var 
    myCamera:Camera e.camera;
            break;
            case 
    CameraDetectionEvent.NO_SUCCESS:
                
    // none of the camera's worked properly
            
    break;
            case 
    CameraDetectionEvent.NO_PERMISSIONS:
                
    // the user denied permission
            
    break;
            case 
    CameraDetectionEvent.NO_CAMERAS:
                
    // no camera's were found
            
    break;
        }

    Last edited by Baby Minion; 04-19-2011 at 08:53 AM. Reason: a lot has changed
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  2. #2
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    I've made an update to this class. It now has better detection, and faster detection on Mac laptops.
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  3. #3
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    I have made another update to this class.

    Added better support for determining permissions.
    Updated some logic.
    Cleaned up code.
    No magic values.

    This is a great class folks
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  4. #4
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312

    2012.10.06 update

    UPDATED 2012.10.06

    A lot has changed:

    MediaPermissions object makes asking for permission easy as, well, adding an eventlistener to an object...

    CameraChecker was a pleasant abstraction that simplified the CameraDetection code

    check out the blog post

    go to github to get it
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  5. #5
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    Thumbs up for updating 2 years old project!
    who is this? a word of friendly advice: FFS stop using AS2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center