Android: How to initialize MediaRecorder without a valid surface for video preview?

后端 未结 4 2009
余生分开走
余生分开走 2020-12-31 12:53

I am building a camera app, where videos are continuously being captured and saved to the SD card. The videos are short (few minutes), and their length are preset with setMa

4条回答
  •  礼貌的吻别
    2020-12-31 13:42

    You just have to create a surface with MediaCodec by adding the following line:

    Surface  mySurface = MediaCodec.createPersistentInputSurface();
    mMediaRecorder.setPreviewDisplay(mySurface);
    
    ...
    
    mMediaRecorder.prepare();
    

提交回复
热议问题