For those running the PlayTube script you may have noticed that autoplay on mobile does not work. It’s currently an issue with the Mediaelementjs framework that PlayTube script uses. I’ve come up with a simple solution to resolve the autoplay issue with Mediaelementjs that works with all major mobile browsers. The only issue is with Facebook Webview which appears to be a limitation of the webview. I am still trying different methods as a work around, but I am open to ideas. If you have any, feel free to comment below.

Mobile autoplay fix is for the Playtube script, but can be easily adapted to any use of Mediaelementjs.

In /themes/default/layout/container.html find

 

Below Add

 

What does this do?

Basically it simulates a click on the play button element. While there are some browsers that do not support this type of behavior, I found it works for major browsers on mobile and doesn’t affect any desktop browser I have tested. Facebook Webview is the only one affected, which is either a limitation of their built in browser or was intentionally blocked to avoid any auto clicking of like buttons or other elements that Facebook deems unnecessary.

You May Also Like

PlayTube Progressive Web Application

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *