Android:如何在播放期间旋转 VideoView
我正在开发一个利用我的 Droid 上的硬件的项目。就视频而言,我初始化一个 mediaRecorder 对象,运行它的所有状态,然后录制视频。视频录制成功并保存到sd卡。
在播放视频时,我有一个包含 VideoView 对象的布局。我正在从 SD 卡上的路径解码视频,然后初始化 VideoView 来播放它。我遇到的问题是视频是横向播放的。
我在尝试找出如何旋转 VideoView 以便我的视频正确播放(我的视频以纵向模式播放,并且活动也被锁定在这个方向)时遇到了很多麻烦。
我查看了 Android 参考,它说 View 有一个名为 setRotation 的方法。当我尝试在 Eclipse 中调用此方法时,出现编译器错误。我也无法使用 8 级以上的 API (Froyo)。
I am working on a project that utilizes the hardware on my Droid. As far as video is concerned, I initialize a mediaRecorder object, run it through all of its states, and then record a video. The video is successfully recorded and saved to the sd card.
In playing the video back, I have a layout with a VideoView object in it. I am decoding the video from its path on the sd card, and then I initialize the VideoView to play it. The problem I am having is that the video is playing sideways.
I'm having a LOT of trouble trying to find out how to rotate the VideoView so my video plays correctly (my video plays back in Portrait mode, and the activity is locked in this orientation as well).
I looked at the Android reference and it says that View has a method called setRotation. When I try to call this method in Eclipse I am getting compiler errors. I also cannot use an API above level 8 (Froyo).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论