Not autoplay video html

I spent quite a lot of time trying lớn figure out why đoạn Clip embedded lượt thích here:

<đoạn Clip height="256" loop autoplay muted controls id="vid">

starts playing automatically once the page is loaded in FireFox but cannot vì autoplay in Webkit based browsers. This only happened on some random pages. So far I was unable khổng lồ find the cause. I suspect some unclosed tags or extensive JS created by CMS editors.

Bạn đang xem: Html video autoplay not working


javascript html google-chrome safari webkit
Share
Improve sầu this question
Follow
edited Sep trăng tròn "18 at 9:01
Adam Bubela
asked Aug 1 "13 at 12:53
Adam BubelaAdam Bubela
6,705 3 3 gold badges 24 24 silver badges 30 30 bronze badges
4
is it working sometimes ? or not working at all... here is an example w3schools.com/tags/tryit.asp?filename=tryhtml5_video_autoplay that i kiểm tra with chrome, and it works. tanaydin Aug 1 "13 at 12:56
On some pages it is not working at all Adam Bubela Aug 1 "13 at 13:01
Facing the same issue, worked fine a week ago & without any change it just stopped working. Maybe it's a browser update, very annoying khổng lồ have to lớn manually play all the video clip tags via javascript bingeScripter May 4 "18 at 8:21
Not working for me in Chrome. Bob the Builder Sep 17 "18 at 14:55
Add a bình luận |

25 Answers 25


Active Oldest Votes
325

The best fix I could get was adding this code just after the

...not pretty but somehow works.

Xem thêm: R&Amp;B Là Gì - R (Programming Language)

UPDATE Recently many browsers can only autoplay the videos with sound off, so you"ll need khổng lồ add muted attribute to lớn the đoạn Clip tag too

...
Share
Improve sầu this answer
Follow
edited Sep 20 "18 at 9:10
answered Aug 1 "13 at 12:53
Adam BubelaAdam Bubela
6,705 3 3 gold badges 24 24 silver badges 30 30 bronze badges
7
1
Or you can code with jQuery $("videoID").get(0).play(); darkedeneurope.com/questions/4646998/ Penguin Oct 6 "15 at 4:26
9
Or lượt thích this: $("video").each(function()); Martin Jan 9 "18 at 20:27
4
still problem if its not muted developers.google.com/web/updates/2017/09/ dovid May 9 "18 at 9:14
6
this won't work anymore without user interaction AFAIK webkit May 17 "18 at 14:11
1
see this darkedeneurope.com/questions/43570460/ Leandro H Agostinho Feb 1 "19 at 11:43
| Show 2 more comments
101

After using jQuery play() or DOM maniupulation as suggested by the other answers, it was not still working (Video wasn"t autoplaying) in the Chrome for Android (Version 56.0).

As per this post in developers.google.com, From Chrome 53, the autoplay option is respected by the browser, if the video is muted.

So using autoplay muted attributes in đoạn phim tag enables the đoạn phim khổng lồ be autoplayed in Chrome browsers from version 53.

Excerpt from the above link:

Muted autoplay for video clip is supported by Chrome for Android as of version 53. Playbachồng will start automatically for a Clip element once it comes into view if both autoplay và muted are set<...>

Muted autoplay is supported by Safari on iOS 10 and later. Autoplay, whether muted or not, is already supported on Android by Firefox & UC Browser: they vì not bloông chồng any kind of autoplay.