gpt4 book ai didi

android - 在 Android Webview 上使用 标签播放 mp4 视频

转载 作者:行者123 更新时间:2023-11-30 04:32:40 25 4
gpt4 key购买 nike

我想在 Webview 上使用标签播放 mp4 视频。对于不使用 HTML5 标签,我没有什么限制。我查看了在 webview 上播放 YouTube 视频的代码。但 YouTube 使用 .flv 格式。我有 .mp4 视频可以播放。

提前致谢。

最佳答案

您可以直接播放视频,无需 WebView:

VideoView videoView = new VideoView(this);
setContentView(videoView);

Bundle extra = getIntent().getExtras();
if (null != extra && extra.containsKey("url")) {
String url = extra.getString("url");
Uri uri = Uri.parse(url);
MediaController mc = new MediaController(this);
videoView.setMediaController(mc);

videoView.setVideoURI(uri);
videoView.start();
}

关于android - 在 Android Webview 上使用 <Embed> 标签播放 mp4 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7426554/

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