Making webcam work in flash on Ubuntu
It’s no secret that flash implementation for linux is buggy, unstable and resource hog. This post is about one particular bug: webcam not working in flash. It took me better part of one saturday to make webcam work in flash. Workaround is actually pretty easy, but you have to know what to do. My environment is: Thinkpad T61, Xubuntu 9.10 (Karmic Koala), flash 10.0.45.2, firefox 3.5.9 and chrome 5.0.342.9.
Ideally, these would be the steps to make webcam work in flash :
- Buy a webcam
- Plug it into your usb port
However, real world always slaps you in your face. First, make sure that your webcam works outside flash :
- Buy a webcam that is listed as supported (green icon) here, I bought cheapest available webcam in local store – Logitech C200
- Plug it into your usb port and use guvcview to test it (it should work ok, if not, I can’t help you)
Ok, now that we know that webcam is recognized and usable, let’s try it in flash. Oops, when I tried loading our old development flash widget it freezed my firefox tab :
I couldn’t click on anything, because that settings pop-up window wasn’t responding. So, what happened ? Flash widget wanted access to my webcam and microphone and I had to confirm it. But I couldn’t because whole tab was unresponsive. Or was it ? Lo and behold, one key worked. One key out of one hundred and some keys on my keyboard worked. That key is TAB with which I could cycle through pop-up window’s components (note the yellow rectangle) :
Cool, but the problem was, that I couldn’t toggle the selection, because only TAB worked. Enter, space and other keys didn’t work ! So I thought that replacing flash with version 9 would help or even a downgrade of firefox to version 3. Well, I’ve been down that road before and I didn’t like it. Downgrading only introduces new problems. Another option would be to change flash security settings via some other mechanism. After some googling it turns out that it actually is possible to change settings via Adobe’s Settings manager. I had to add our development server address as trusted :
and :
There are also Microphone and Camera settings in Adobe’s Settings Manager, but they are as unresponsive as that pop-up. Which is a bummer if you have more that one camera and/or microphone. But it’s a limitation that I can live with. Now reload that flash widget and it should work, because that security pop-up never shows up. Right ? Wrong, flash widget works, but there’s no camera stream. It is as if there was no camera plugged into usb port, flash simply doesn’t know it’s there ! At this point I was ready to throw my laptop over my balcony 20 meters down to the pavement. After I calmed down I googled some more and found that v4l (video for linux, used for capturing stream from video devices) comes in two flavors, version one and version two. There are some compatibility issues, so even though v4l version 2 is recommended, it doesn’t always work. It certainly doesn’t with flash widgets. Luckily, it’s possible to force some sort of compatibility layer unto every application that tries to use v4l with following command :
LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so firefox &
Finally, webcam stream showed up in flash widget :
(I used paper snowman to cover up my tired face, no need to show it on the “internets“, there are better pics of me out there)
A note about microphones:
It turns out that there’s a way to set one particular microphone as preferred sound capturing device by using alsamixer (in terminal):
After it loads up press F4 to switch to Capture settings where you can set Input Source (I have multiple options – internal, docking and mix). However, this still leaves us the problem with camera choice (if there’s more than one available). I don’t know how to solve this problem but, frankly, I didn’t put to much effort into it. I don’t care.
Well, that’s it. Hopefully this will help someone until all multimedia shit finally starts working normally on linux.






In order to spend some time off-work and relax together we went spent our Sunday shooting other geeks in a 
