Android - 播放 Mp4
我正在尝试在我的应用程序中播放来自 http url 的视频文件。为什么我的应用程序只播放某些 mp4 文件(我尝试了 512k mp4 并且它有效),而不播放其他一些文件?
这是我的代码片段:
mVideoView.setVideoPath(myVideoURL);
mVideoView.setMediaController(new MediaController(this));
mVideoView.seekTo(currentPosition);
mVideoView.requestFocus();
谢谢 克里斯
I am trying to play video files from http urls in my app. Why is that my app plays only certain mp4 files (I tried 512k mp4 and it worked), and doesn't play some others?
Here's the snippet of my code:
mVideoView.setVideoPath(myVideoURL);
mVideoView.setMediaController(new MediaController(this));
mVideoView.seekTo(currentPosition);
mVideoView.requestFocus();
Thanks
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您的 mp4 未受 DRM 保护,并且宽度不超过 320 像素(videoView 不会为您缩放)。您在 LogCat 中收到任何有用的错误吗?
Make sure your mp4's aren't DRM'd, and that they're not wider than 320 pixels (videoView will not scale them for you). Are you getting any useful errors in LogCat?