I am trying to make mp4 video autoplay to work on my website on mobile. I have applied same technique to do it on both of my websites and it is not working only on one of them which is very strange! I feel like I am running out of ideas!
Here is the first website where it does not work: https://wearepharos.com/ pw:pharos123
It is hosted on Shopify.
Here is another website where I do same thing but somehow it is working on mobile:
https://sebastianwalach.com/
I am using this script to add playsinline to the video which does the job on the second website:
<script>
setTimeout(
function(){
var mobilevideo = document.getElementsByTagName("video");
var i;
for (i = 0; i < mobilevideo.length; i++) {
mobilevideo[i].setAttribute("playsinline", "");
}
},
3000);
</script>
Please help me!
2
Answers
I didn't find a correct explanation for that issue but instead I applied a "hack" jQuery fix that is actually working just fine. I am posting it as maybe it will be useful for someone:
One reason may be that your mp4 video is using the ‘high’ h.264 profile.
H.264 has different profiles (https://en.wikipedia.org/wiki/Advanced_Video_Coding#Profiles) and not all devices support all profiles.
For example the Android baseline support does not include ‘High’ profile, although some Android devices may support it: https://developer.android.com/guide/topics/media/media-formats
Here is a output from ffprobe for the mp4 version of your video: