Search code examples
androidvideobackgroundrecording

Background video recording in Android 4.0


I try to organize background video recording in Android 4.0. But I can't do it because of these problems:

  1. Dummy Surface does not work in MediaRecorder (error: invalid surface)

  2. If you use Surface 1 x 1 px on Activity, Surface is destroyed on Activity pause (recording is stopped)

  3. If you use Surface 1 x 1 px on WindowsManager, Surface is destroyed on Application pause (recording is stopped)

  4. SurfaceTexture does not work in MediaRecorder.setPreviewDisplay(new Surface(SurfaceTexture))

  5. Widget does not allow to handle Surface 1 x 1 px

  6. Status Bar does not allow to handle Surface 1 x 1 px

Please, help me to find right way.


Solution

  • I found the answer: it is necessary to use WindowManager and call it from Service.