如何获得以H.264编码的视频流以在"WebView"中播放? [英] How to get a video stream encoded in H.264 to play in a "WebView"?

查看:115
本文介绍了如何获得以H.264编码的视频流以在"WebView"中播放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有html5视频播放器的远程托管网页,该播放器可流式传输H.264编码的视频.我需要将此页面(而不是在浏览器中外部打开)嵌入到我的Android活动中.最新的Android系统Webview(版本63.0)不支持H.264编码,也不支持Crosswalk的Webview(与我的硬件体系结构匹配).我有什么选择?

I have a remotely hosted webpage with an html5 video player that streams H.264-encoded video. I need to embed this page (not open externally in a browser) in my Android Activity. The latest Android System Webview (ver 63.0) doesn't support H.264 encoding nor does Crosswalk's Webview (matching my hardware architecture). What are my options?

推荐答案

更新后的答案

经过一番挖掘,看来Android中的Webview确实确实存在支持h.264的问题.这是因为它基于Chromium,默认情况下不包含h.264支持(涉及专利等的悠久历史).

After some digging, it seems that the webview in Android does indeed have issues supporting h.264. This is because it is based on Chromium which does not include h.264 support by default (long history involving patents etc).

目前最常见的建议似乎是构建自己的Chromium Web视图,并使用包含h.264的构建选项/标志.

The most common recommendation at the moment appears to be to build your own Chromium web view, with the build options/flags to include h.264.

这是Chrome的一个已知限制,在撰写本文时,这里列出了一个未解决的错误:

This is a know limitation with Chrome and there is an open bug listed here at the time of writing:

Chrome和Chromium之间的差异在其他地方已得到充分证明,但是在这种情况下的关键点之一是Chromium是完全开源的,因此避免包含专有组件,这就是为什么不包括许可的H.264编解码器的原因.

The differences between Chrome and Chromium are well documented elsewhere, but one of the key points in this context is that Chromium is completely open source so avoids including proprietary components, and this is why the licensed H.264 codec is not included.

带更正的原始答案

[除非有所更改,否则标准的Android Web视图应支持] Android设备,Android chrome浏览器通常支持h.264视频(只要配置文件和设置在设置范围内)设备支持-最初使用基线配置文件进行测试是一种安全的开始方式).但是,基于Chromium的Android Webview在撰写本文时不支持h.264.

[Unless something has just changed, the standard Android web view should support] Android devices and the Android chrome browser generally support h.264 video (so long as the profile and settings are within the set the device supports - testing with baseline profile initially is a safe way to start). However, the Android Webview, which is Chromium based, does not support h.264 at the time of writing.

此处提供了默认的支持视频格式集: https://developer.android.com/guide/topics/media/media-formats.html#video-formats

The default set of supported video formats is available here: https://developer.android.com/guide/topics/media/media-formats.html#video-formats

Android Web视图中存在已知/已报告的WebRTC和h.264问题,但共识是这与webRTC相关,AFAIK -请参阅:

There are known/reported WebRTC and h.264 issues in Android web views but the consensus is that this is webRTC related, AFAIK - see: https://groups.google.com/a/chromium.org/forum/#!topic/android-webview-dev/hVZdHK6MKfI

这篇关于如何获得以H.264编码的视频流以在"WebView"中播放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆