5的自动播放谷歌浏览器的Andr​​oid不打

5的自动播放谷歌浏览器的Andr​​oid不打

本文介绍了HTML 5的自动播放谷歌浏览器的Andr​​oid不打的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自动播放,当用户打开网页浏览器的视频。在我的笔记本电脑自动播放适用于所有的浏览器,但在Android上它doesn't工作的谷歌浏览器和iPhone它不工作在Safari。我已经做了搜索和谷歌Chrome浏览器在Android不支持HTML5视频标签,所以我用了一些JavaScript,但它不工作了。为什么?我该怎么办?这是我的code

 <视频ID =视频自动播放自动缓冲控制=控制的allowFullScreen>
<信源SRC =video.mp4TYPE =视频/ MP4>
<信源SRC =video.webmTYPE =视频/ W​​EBMwebView.mediaPlaybackRequiresUserAction = NO;>
<信源SRC =video.theora.ogvTYPE =视频/ OGG>
<信源SRC =video.flvTYPE =视频/ FLV>
<信源SRC =video.vobTYPE =视频/ VOB>
<信源SRC =video.movTYPE =视频/ MOV>
< /视频>
<脚本类型=文/ JavaScript的>
VAR视频=的document.getElementById('视频'); video.addEventListener('视频',函数(){
video.play();
});

                                video.addEventListener(domready中功能(){video.play();
});

                                video.addEventListener(结束,函数(){
了window.location =htt​​p://www.google.com
});
< / SCRIPT>
 

解决方案

我也试图自动播放Android上的镀铬视频,发现这样的:

在Android,HTML5视频自动播放属性不能正常工作

显然,这是故意的。

I'm trying to play automatically a video when the user open the page on browser. On my laptop autoplay works on all browsers, but on android it doesn´t work on Google Chrome and in Iphone it doesn't works in safari. I already did a search and google chrome in android doesn't support html5 video tag so i used some javascript but it doesn't work too.Why? What should i do?Here's my code

<video id="video" autoplay autobuffer controls="controls" allowFullScreen >
<source src="video.mp4" type="video/mp4">
<source src="video.webm" type="video/webm" webView.mediaPlaybackRequiresUserAction = NO;>
<source src="video.theora.ogv" type="video/ogg">
<source src="video.flv" type="video/flv">
<source src="video.vob" type="video/vob">
<source src="video.mov" type="video/mov">
</video>
<script type="text/javascript">
var video = document.getElementById('video');                           video.addEventListener('video',function(){
video.play();
});

                                video.addEventListener("domready", function(){                                              video.play();
});

                                video.addEventListener("ended", function(){
window.location = "http://www.google.com"
});
</script>
解决方案

I was also trying to autoplay videos on android chrome and found this:

On Android, html5 video autoplay attribute does not work

Apparently it's intentional.

这篇关于HTML 5的自动播放谷歌浏览器的Andr​​oid不打的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 19:06