0

I have a video banner that I am wanting to autoplay. It is working in firefox, but only autoplays in chrome when I click a dud link ("#") on my page. It won't work in chrome when I simply reload either.

I am aware that it has to be muted for autoplay to work, and I also tried the playsinline attribute, setting it to true.

Here is my html.erb

<%= video_tag "type.mp4", mute: true, autoplay: :autoplay, loop: true, playsinline: true, preload: :auto, class: "banner_video", id: 'vid' %>

and here is what it produces

<video mute="true" autoplay="autoplay" loop="loop" playsinline="true" preload="auto" class="banner_video" id="vid" src="/assets/type-09d61a30abad860f1bed67840988a7464a7c88ef1bcf075fabbdb51f0e71dc75.mp4"></video>

This is apparently a common problem based off of other posts on stack overflow, but the muted and playsinline attributes seems to work for everybody else.

Does anybody know what could be keeping the video from autoplaying in chrome???

1 Answers1

1

Chrome will not autoplay videos if not muted, The way you are setting the conditions of the video may be the issue. Try this.

<video class="banner_video" id="vid" 
             autoplay muted loop>
    <source src="(The Source Of Your Video)" type="video/mp4">
</video>
Elitezen
  • 6,551
  • 6
  • 15
  • 29
  • It was because I had "mute" and not "muted" as my attribute. However the video is still not even showing up in safari. Do you happen to know what their browser rules are for html videos? – Michael Villarreal Dec 04 '19 at 01:45
  • This post may help https://stackoverflow.com/questions/27712778/video-plays-in-other-browsers-but-not-safari – Elitezen Dec 04 '19 at 11:58