Android mediarecorder stop failed

前端 未结 4 1850
旧巷少年郎
旧巷少年郎 2021-01-17 12:24

I\'ve faced a very strange behavior: sometimes my mediarecorder crashes with an error \"Stop failed\" and sometimes it works fine. Is there my fault or it is a bug of the sy

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-17 13:16

    add following in your SurfaceCreated(SurfaceHolder holder):

    CamcorderProfile camcorderProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);  //get your own profile   
     Camera.Parameters parameters = mCamera.getParameters();  
     parameters.setPreviewSize(camcorderProfile.videoFrameWidth,camcorderProfile.videoFrameHeight);   
     mCamera.setParameters(parameters);  
    

提交回复
热议问题