Search code examples
macosgoogle-chromesafaricameraavfoundation

AVFoundation CoreMediaIO virtual camera not being detected in browser


I have been testing the Apple CoreMediaIO sample camera on Mac OS X 10.9 Mavericks.

Locally the applications i have tried could detect and recognize the sample camera automatically (like Skype, AVRecorder - Apple's AVFoundation capture API sample)

In Mozilla Firefox and Opera browsers the camera has been detected automatically on the Flash Player based sites that i have checked (for example Adobe's Cirrus sample), although in Safari and Chrome the sample camera was missing from the video input devices list.

How could i make these browsers recognize the CoreMediaIO sample camera on such a website?


Solution

  • Safari:

    The problem causing this to happen is that on Mavericks the current Safari uses a sandboxed Flash Player which refuses to detect the sample camera.

    You can solve this by allowing sites to run Flash Player in unsafe mode: (make sure you have allowed the website to use your cameras on the Flash Player pop-up window)

    1. Go to Safari/Preferences.
    2. Go to the Security page.
    3. Click Manage Website Settings.
    4. On the left pane select Adobe Flash Player.
    5. Select the website you have allowed to use the camera and want to use the camera with.
    6. Click on the combobox.
    7. Select Run in Unsafe Mode.
    8. On the pop-up window choose Trust.
    9. Refresh the website.

    From now on, Safari can detect the sample camera on the specific website.

    I could not find a better/all-around solution yet.

    Chrome:

    This problem is mainly based on the Mac OS X AVFoundation API being disabled by default in the current Chrome (the CoreMediaIO sample uses it).

    There are various methods to make Chrome detect the sample camera.

    So far my best solution is the following:

    1. Open a new tab in chrome.
    2. Go to chrome://flags.
    3. Search for "Enable use of Mac OS X AVFoundation APIs, instead of QTKit, Mac" entry.
    4. Set the above-mentioned entry to Enabled.
    5. Relaunch Chrome.

    As far as i could get, the key AVFoundation flag's internal ID is IDS_FLAGS_DISABLE_AVFOUNDATION_NAME. As long as you try to use AVFoundation based things in Chrome (OS X Mavericks) you will probably need this. (I don't really know why the default value is disabled, but i hope they will change it as Apple tends to deprecate QTKit.)


    Other solutions that i prefer less:

    Disabling Pepper Flash (PPAPI) and using NPAPI Flash Player instead.

    1. Open a new tab in chrome.
    2. Go to chrome://plugins.
    3. Hit the plus (+) sign in the upper right corner next to Details.
    4. Search for the Adobe Flash Player plugin section.
    5. Locate the Pepper Flash version (PPAPI type).
    6. Click Disable.
    7. Refresh the website.

    Google intends to deprecate NPAPI Flash Player soon, which leaves the Pepper Flash (PPAPI) as the only alternative, that was the reason to try and find a better solution than this. I don't recommend to rely on this solution considering the future of NPAPI Flash Player.

    There is another temporary solution involving Mozilla Firefox. I don't know why exactly this works and i think this might easily change in the future, but i tried and verified that it works at the moment:

    1. Close Chrome entirely (Chrome/Quit Google Chrome or Command+Q).
    2. Start Firefox.
    3. Go to the website you would like to use the camera with (any Flash Player based site works that calls for camera list).
    4. Open Chrome.
    5. Close Firefox.
    6. Go to the website in Chrome.

    If you close Chrome you will have to redo the process from Step #2. It seems like Firefox initializes something that makes the Chrome startup different and causes it to detect the sample camera. I don't recommend to rely on this though.