我设法创建了一个android应用程序来录制视频,但问题是前置摄像头视频的方向。输出不符合要求。它会自动旋转。Android前置摄像头录制视频但播放颠倒...!
应用程序方向是风景。所以,我需要在横向模式下使用前置摄像头进行录制。
什么都没有解决。
我设法创建了一个android应用程序来录制视频,但问题是前置摄像头视频的方向。输出不符合要求。它会自动旋转。Android前置摄像头录制视频但播放颠倒...!
应用程序方向是风景。所以,我需要在横向模式下使用前置摄像头进行录制。
什么都没有解决。
你可能想看看AOSP VideoCamera activity是如何实现这一点:
if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
rotation = (info.orientation - mOrientation + 360) % 360;
} else { // back-facing camera
rotation = (info.orientation + mOrientation) % 360;
}
有在my answer for another question here一些更多的细节。
添加这个你开始你下面setVideoSource录像
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
if (cameraId == 1) {
mediaRecorder.setProfile(CamcorderProfile
.get(CamcorderProfile.QUALITY_LOW));
mediaRecorder.setOrientationHint(270);
} else if (cameraId == 0) {
mediaRecorder.setProfile(CamcorderProfile
.get(CamcorderProfile.QUALITY_HIGH));
mediaRecorder.setOrientationHint(orientation);
}
mediaRecorder.setOrientationHint(270);
是前置摄像头倒挂问题
我试过了。但它只是创建视频的镜像。 –
我尝试使用 'mrec.setOrientationHint(0);' 在'私人void startRecording()'函数,但它不允许我启动视频 –
什么是mOrientation?你能提供完整的代码吗?我正在尝试从过去两天重新支持它 –
@RahulKhurana,我将过时的omapzoom链接更新为androidxref,以便您查看完整的代码。 – Joe