【发布时间】:2012-02-02 19:08:04
【问题描述】:
我在这样的 Android 设备上以 PORTRAIT 方向拍摄新视频:
Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(intent, 1886);
它给了我这个文件:“/mnt/sdcard/DCIM/Camera/video-2012-02-02-10-45-48.mp4”
那我这样玩:
private VideoView videoView = (VideoView) findViewById(R.id.videoView);
String videoUrl = "/mnt/sdcard/DCIM/Camera/video-2012-02-02-10-45-48.mp4";
videoView.setMediaController(new MediaController(this));
videoView.setVideoURI(Uri.parse(videoUrl));
videoView.start();
这是我的布局文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<VideoView
android:id="@+id/videoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true" />
</RelativeLayout>
当我在标准的 Android 库中播放它时,方向是正确的。但是当我在上面的 VideoView 中播放视频时,它旋转了 90 度。横向效果很好,唯一的问题是纵向视频。
如何在 VideoView 中旋转此视频?
另外,如何以编程方式确定方向?
【问题讨论】:
-
您能找到解决此问题的方法吗?我也有同样的问题
标签: android video orientation portrait android-videoview