简体   繁体   English

Android上的HTML5 <video>元素无法播放

[英]HTML5 <video> element on Android does not play

Video tags like below plays fine with iPhone, but not Android: 像iPhone这样的视频标签适用于iPhone,但不适用于Android:

<video id="video" width="320" height="240" poster="video/placeholder.jpg" autobuffer controls>
  <source src="pr6.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
  <source src="pr6.ogv" type='video/ogg; codecs="theora, vorbis"'>
</video>

With the above code, Android can't even click the clip. 使用上面的代码,Android甚至无法点击剪辑。 It would just see the poster image. 它只会看到海报图像。

Video tag like below however works with Android: 但是,如下所示的视频标签适用于Android:

<video src="vpr6.mp4" poster="video/placeholder.jpg" onclick="this.play();"/>

However, I still need to multiple sources capability (for Firefox ogv support…). 但是,我仍然需要多个源功能(对于Firefox ogv支持...)。 Below code does not work (nor do they work if I stick the javascript into the source tags): 下面的代码不起作用(如果我将javascript粘贴到源代码中,它们也不起作用):

<video id="video" width="320" height="240" autobuffer controls onclick="this.play();">
  <source src="pr6.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
  <source src="pr6.ogv" type='video/ogg; codecs="theora, vorbis"'>
</video>

With above code, the clip is clickable in Android, but still does nothing. 使用上面的代码,剪辑可以在Android中单击,但仍然无效。

Can anyone help? 有人可以帮忙吗?

Try to remove the codecs from the source listings.. It might be that the codecs you're listing are not present on Android, so it's choking. 尝试从源列表中删除编解码器。可能是您列出的编解码器不在Android上,因此它很窒息。

If you use the src attribute, it'll auto-detect the codec, so it's using something else :) 如果你使用src属性,它会自动检测编解码器,所以它正在使用别的东西:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM