Skip to content
Advertisement

HTML5 videos don’t autoplay with tippy js

I use tippy.js and when I add a <video loop muted playsinline autoplay> inside a tooltip using allowHTML: true, the video won’t autoplay on chrome. It works on firefox and safari though.

How can I achieve this?

Here is my js:

JavaScript

And here is my html:

JavaScript

I tried to add

JavaScript

but it doesn’t work eather.

Thanks a lot in advance for your help,

Advertisement

Answer

It is indeed strange that a muted video would not autoplay. You can use setTimeout and then trigger play() using the onShow() event. For some reason onShown() doesn’t ever fire for me.

Here’s a working snippet:

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement