I have an activity that show half of the screen facing user and the other half facing another guy in opposite direction. The portion facing another guy has a video view. Like this:
我有一个活动,显示一半的屏幕面向用户,另一半面向另一个相反方向的人。面对另一个人的部分有一个视频视图。是这样的:
In my activity layout, I have:
在我的活动布局中,我有:
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:id="@+id/scrollViewTop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:layout_weight="1"
android:scrollbars="none"
android:rotation="180.0" >
......
android:id="@+id/videoView1"
android:layout_width="75dp"
android:layout_height="75dp" />
......
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="vertical" >
I use following code to set the video view: (videofile.mp4)
我使用以下代码来设置视频视图:(videofile.mp4)
videoView1 = (VideoView) findViewById(R.id.videoView1);
Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.videofile);
videoView1.setVideoURI(video);
videoView1.start();
It show a black screen without the video playing. Other content is showing correctly in 180 degree rotation except the video playback.
它显示了一个没有视频播放的黑色屏幕。除视频播放外,其他内容在180度旋转时显示正确。
However, if I remove the line android:rotation="180.0" the video is playing correctly.
但是,如果我删除线android:旋转="180.0"视频播放正确。
Is there a way to play the video while the screen is rotated?
当屏幕旋转时,有办法播放视频吗?
1 个解决方案
#1
0
Haven't got any luck finding the proper solution. I use a walk-around instead.
没有找到合适的解决办法。我用散步代替。
First apply a rotation to the video view within the parent rotation.
首先对父旋转中的视频视图进行旋转。
android:layout_width="75dp" android:layout_height="75dp" android:旋转="180.0" />。
This will cause the layout to become:
这将导致布局成为:
Then we output the video source (videofile.mp4) to play in 180 degrees.
然后我们输出视频源(videofile.mp4),播放180度。
With 1 + 2, it is "as if" the video is playing in the other direction.
在1 + 2的情况下,“好像”这个视频在另一个方向播放。