2014-03-28 134 views
0

我正在录制使用自定义媒体录制器类和录制视频的一些设备工作正常,但一些设备创建0长度video.I不知道是什么问题MediaRecording配置。媒体录制问题Android

  Camera mcamera 
      mCamera.unlock(); 
      mrec.setCamera(mCamera); 
      mrec.setPreviewDisplay(surfaceHolder.getSurface()); 
      mrec.setVideoSource(MediaRecorder.VideoSource.CAMERA); 
      mrec.setAudioSource(MediaRecorder.AudioSource.MIC); 
      if (cameraID != -1) { 
       mrec.setProfile(CamcorderProfile.get(cameraID, 
         CamcorderProfile.QUALITY_HIGH)); 
      } else { 
       mrec.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH)); 
      } 

      mrec.setPreviewDisplay(surfaceHolder.getSurface()); 
      mrec.setOutputFile(filename); 

Plz帮助预先感谢。

我M还检查hasprofile方式

CamcorderProfile profile = null; 

     if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_1080P)) 
      profile = CamcorderProfile.get(CamcorderProfile.QUALITY_1080P); 
     else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_720P)) 
      profile = CamcorderProfile.get(CamcorderProfile.QUALITY_720P); 
     else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_480P)) 
      profile = CamcorderProfile.get(CamcorderProfile.QUALITY_480P); 
     else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_HIGH)) 
      profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH); 

     if (cameraID != -1) { 
      mrec.setProfile(profile); 
       } 

但这种方式获得问题的问题startunlock失败。

+0

检查我米更新发布@Michel但获取记录开始问题开始解锁失败 – Sanket990

回答

0

我敢肯定你得掉这些行:

 mrec.setOutputFile(filename); 
     mrec.setPreviewDisplay(surfaceHolder.getSurface()); 

现在,将它的工作原理?让我知道!