仅在Android中以横向模式捕获视频

时间:2017-10-04 09:17:19

标签: android video-capture landscape

我有一个视频捕捉代码,可以在potrait和横向模式下捕捉视频。我想在android中以横向模式捕捉视频。请帮助我。

 public void startRecordingVideo() {
if (getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)) {
    Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    File mediaFile = new File(
            Environment.getExternalStorageDirectory().getAbsolutePath() + "/myvideo.mp4");
    videoUri = Uri.fromFile(mediaFile);
    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri);
    intent.putExtra(MediaStore.EXTRA_FULL_SCREEN,true);
    startActivityForResult(intent, VIDEO_CAPTURE);
} else {
    Toast.makeText(this.getActivity(), "No camera on device", Toast.LENGTH_LONG).show();
}

}

0 个答案:

没有答案