gpt4 book ai didi

android - 视频 View 在android中旋转90度

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:18:01 25 4
gpt4 key购买 nike

我想将视频旋转 90 度。

当前我旋转布局但无法播放视频。xml

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:rotation="90" >

<VideoView
android:id="@+id/videoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>

Java

videoView = (VideoView) findViewById(R.id.videoView);

final Uri videoUri = Uri.parse(
Environment.getExternalStorageDirectory().getAbsolutePath()+"/UnoPlayList/restaurant_menu_pro_mkv.mkv");

videoView.setVideoPath(Environment.getExternalStorageDirectory().getAbsolutePath()+"/UnoPlayList/restaurant_menu_pro_mkv.mkv");
//videoView.setRotation(180);
// videoView.setVideoURI(videoUri);
videoView.start();

有什么方法可以旋转视频。

例子: https://play.google.com/store/apps/details?id=com.mycall.videorotate&hl=en

请帮帮我。

最佳答案

使用 camera.setDisplayOrientation()recorder.setOrientationHint() 方法在捕捉视频时旋转视频。

    camera = Camera.open();
//Set preview with a 90° ortientation
camera.setDisplayOrientation(90);
camera.unlock();

recorder = new recorder();
recorder.setCamera(camera);
recorder.setAudioSource(recorder.AudioSource.MIC);
recorder.setVideoSource(recorder.VideoSource.CAMERA);
recorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_720P));
recorder.setPreviewDisplay(mPreview.getHolder().getSurface());
recorder.setOutputFile(getOutputMediaFile(MEDIA_TYPE_VIDEO).toString());

//Rotate video by 90 degree
recorder.setOrientationHint(90);

关于android - 视频 View 在android中旋转90度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22759469/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com