Android - 播放视频的不同方式

发布于 2024-09-02 21:19:00 字数 140 浏览 3 评论 0原文

我刚刚遇到了 VideoView 的限制,无法播放宽度超过 320 像素的 mp4 视频文件。我想知道我们如何才能克服这些限制。我试图让我的应用程序尽可能宽容,所以除了使用 VideoViews 之外,还有其他方法来播放这些 mp4 视频吗?

克里斯

I just came across the limitation of VideoView of not being able to play mp4 video files that are wider than 320 pixels. I was wondering how can we overcome these limitations. I am trying to make my app as forgiving as possible, so other than using VideoViews is there another way to play these mp4 videos?

Chris

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流星番茄 2024-09-09 21:19:08

我不知道 VideoView 的宽度限制为 320px,尽管我还没有尝试过。

您可以使用 MediaPlayerSurfaceView 来播放视频。事实上,这几乎就是 VideoView 的全部内容。最后我查看了 VideoView 源代码,只有大约 200 行。

这是一个示例项目,它使用 MediaPlayer实现视频播放器SurfaceView,通过屏幕点击来调出一些弹出面板(例如,时间轴)。

I am not aware of a 320px wide limit on VideoView, though I haven't tried it.

You can use MediaPlayer and a SurfaceView to play back videos. In fact, that's pretty much all VideoView is. Last I looked at the VideoView source code, it was only ~200 lines.

Here is a sample project that implements a video player using MediaPlayer and SurfaceView, with screen taps to bring up some pop-up panels (e.g., timeline).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文