【发布时间】:2014-12-10 21:52:42
【问题描述】:
在 Google 中录制视频时,是否有人在 Intent 或 MediaRecorder 中禁用了声音 玻璃?
我已经从 AndroidManifest 中删除了权限,并且我没有在 MediaRecorder 中设置音频源,但我仍然录制音频。
我正在使用 XE22。
private boolean prepareVideoRecorder(){
if (mCamera != null){
mCamera.release(); // release the camera for other applications
}
mCamera = getCameraInstance();
if (mCamera == null) return false;
mrec = new MediaRecorder();
mCamera.unlock();
mrec.setCamera(mCamera);
//mrec.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
CamcorderProfile profile = getValidCamcorderProfile();
mrec.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mrec.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mrec.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight);
mrec.setVideoEncodingBitRate(profile.videoBitRate);
mrec.setVideoEncoder(profile.videoCodec);
mrec.setPreviewDisplay(mPreviewHolder.getSurface());
mOutputFile = getOutputMediaFile(MEDIA_TYPE_VIDEO);
mrec.setOutputFile(mOutputFile.toString());
try {
mrec.prepare();
}
catch (Exception e) {
Log.e(TAG, e.getMessage());
return false;
}
return true;
}
private CamcorderProfile getValidCamcorderProfile(){
CamcorderProfile profile;
if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_TIME_LAPSE_720P)){
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_TIME_LAPSE_720P);
return profile;
}
if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_720P))
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_720P);
else
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
return profile;
}
代码摘自《Beginning Google Glass Development》一书。 有什么想法吗??
【问题讨论】:
-
是的,有可能。发布您现在拥有的录制代码,我可以帮助您。这也会使其他人受益。
标签: android google-glass