/daily-virtual-camera

macos virtual camera

Primary LanguageSwift

Camera Extension template

This is an implementation of camera extension app (as shown in this WWDC video). It will add a new device to the OS and will appear when navigator.mediaDevices.enumerateDevices() is called.

More info on developing camera extensions can be found here.

requirements

for a bare-bones, gstreamer-less boilerplate template version, checkout boilerplate-template branch

installation

  1. open daily-virtual-camera.xcodeproj in xcode
  2. select the Daily Virtual Camera scheme

3. build app

4. copy app from build directory to `/Applications`

 $ cp $HOME/Library/Developer/Xcode/DerivedData/daily-virtual-camera-.../Build/Products/Debug/daily-virtual-camera.app /Applications
  1. open daily-virtual-camera.app from /Applications and click install virtual camera
  2. follow prompts to allow installation

usage

After install, the camera will be in devices list, even after the installation app is closed. That's it!

$ systemextensionsctl list
1 extension(s)
--- com.apple.system_extension.cmio
enabled active  teamID  bundleID (version)  name  [state]
* * EEBGKV9N3N  co.daily.daily-virtual-camera.cam (1.0/1)  cam [activated enabled]
$ ffmpeg -f avfoundation -list_devices true -i ""
...
[AVFoundation indev @ 0x7fb15bf05700] AVFoundation video devices:
[AVFoundation indev @ 0x7fb15bf05700] [0] FaceTime HD Camera (Built-in)
[AVFoundation indev @ 0x7fb15bf05700] [1] Daily Virtual Camera <========================
[AVFoundation indev @ 0x7fb15bf05700] [2] Capture screen 0

usage+ javascript hack

uninstallation

open the app and click uninstall and go through the security & privacy permissions song and dance. note: device will not be fully uninstalled until the computer is rebooted.

$ systemextensionsctl list
1 extension(s)
--- com.apple.system_extension.cmio
enabled active  teamID  bundleID (version)  name  [state]
    EEBGKV9N3N  co.daily.daily-virtual-camera.cam (1.0/1)  cam [terminated waiting to uninstall on reboot]

development

If you want to generate your own fake media within the app, main.swift is where you can change the camera name and you can also do more interesting camera things like changing the default GStreamer video source... Go wild.