Are there any plans to allow the use of the webcam in Anki for Mac?

I try to develop add-ons to use the webcam in Anki for desktop.
It is already working fine on Windows and Linux, but on Mac I cannot display the screen or encounter crashes. Like this:

I’ve looked into the cause, it looks like Macs are security-conscious and apps need to be set up with camera permissions in advance, and Anki probably doesn’t allow this. (But I have not built Anki so I do not know if this is the exact cause or not).

For now a workaround is to start Anki from the terminal. The user can give permission for the camera to the terminal and the add-on will work fine.

If so, this change does not seem to be possible with add-on. Are there any plans to allow the use of the camera in Anki for Mac?


This is a minimal add-on for reproducing the problem. Use Qt5 or Qt6 to display the webcam video. If a crash occurs, you need to press Shift to restart Anki and disable the add-on:


According to Anki source code, “qt/bundle/mac/src/Info.plist” does not have NSPhotoLibraryUsageDescription set, but “qt/bundle/mac/dmg/set-dmg-settings.app/Contents/Info.plist” seems to have the NSPhotoLibraryUsageDescription set. (I don’t know how they are related or what the difference is.)

1 Like

As a heads up: I tested your addon in debian linux (oldstable) with gnome and anki doesn’t even ask for camera permission here. Your addon thus doesn’t work for me, I only get a blank white screen.

1 Like

Thanks for the feedback!

  1. I only tested it on Ubuntu so it may not work elsewhere.
  2. Maybe Win and Linux don’t ask permission for the camera.
  3. If the camera is not connected when the add-on is launched, nothing is displayed.
  4. If the camera is being used by another app, it will not show up.
  5. Depending on the device, video display may only work with PyQt5.

Cool, I did the tests and it worked here on Windows 10, on versions 24.11 of Anki pyqt5 and pyqt6

1 Like

Thanks! So far Windows seems to be working the most stable.

I tested it on Ubuntu 24 and it was giving me the same problem as the guy above, with the white screen, but I remembered that I installed Anki with Flatpak there

so I had to use these 2 commands in the terminal to make it work on Linux Ubuntu
sudo flatpak override net.ankiweb.Anki --device=all
flatpak install flathub com.github.tchx84.Flatseal

1 Like

Thanks! That’s very helpful. I’m a little concerned about security if the user allows everything, so it looks like it would be good to have a code to allow only the camera and a code to revoke the permission. I’ll look into it later.

2 Likes

What command are they using? Perhaps they just need to go into the system settings>privacy & security section and ensure camera permission is enabled?

1 Like

When I typed this into the terminal and started Anki, a popup automatically appeared asking if I wanted to allow the camera.
/Applications/Anki.app/Contents/MacOS/anki

After that privacy & security will show that I have allowed the terminal. Until the popup is shown, nothing is displayed in privacy & security.

This only worked on my debugging device, so it has not been tested to work on other Mac devices.

I tried adding the following to the plist, but it didn’t seem to help in the resulting bundle.

		<key>NSCameraUsageDescription</key>
		<string>Add-ons may access your camera.</string>
1 Like

Thanks for testing!
Would it be possible to add that change as is to the plist and have it included in the next Anki for desktop? If there is something wrong with the current test add-on code or camera connection setting, it may work fine if I fix the add-on code.

I’ll give it a try.

1 Like

Thank you! As far as I know this is the only setting needed before building, so maybe other problems can be solved with add-on code.