Search code examples
androidstreamingreverse-engineeringwebcamandroid-2.3-gingerbread

Record video in background, preferably with no file or surface, preferably also on 2.2


So I read here that it's not possible to capture preview frames without a valid Surface. However, I saw that the IP Webcam app can do this, and I wanna know how.

Can that app do it on versions below v2.3? If so, how?

Furthermore, the bug isn't marked as fixed, so I'm wondering if the restriction was ever lifted.

Also, if I don't wanna save the video stream from the Preview, but rather stream it over the network, is that possible with the MediaRecorder? All the examples I see use a file for saving, but I reckon the IP Webcam app uses the Preview. Or maybe it writes to a pipe?


Solution

  • When using Android, you must have a valid Surface object to take pictures or video. The Preview also requires the Surface object. I would guess that the IP Webcam uses native calls (C or C++) to the Dalvik lower layers, bypassing the Java layer(s). That way, they can access the hardware more directly. If you have the skills you should be able to do this using the Android NDK.