skip to Main Content

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


  1. Chosen as BEST ANSWER

    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:

    function playVid() { 
      $('video').get(0).play();
    } 
              setTimeout(playVid, 3000);
    

  2. 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:

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/.../Downloads/VICIS_2_-_HIGHLIGHTS (1).mp4':
      Metadata:
        major_brand     : mp42
        minor_version   : 0
        compatible_brands: isommp42
        creation_time   : 2019-11-11T00:35:32.000000Z
        encoder         : Google
      Duration: 00:00:49.46, start: 0.000000, bitrate: 1955 kb/s
        Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1824 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
        Metadata:
          creation_time   : 2019-11-11T00:35:32.000000Z
          handler_name    : ISO Media file produced by Google Inc. Created on: 11/10/2019.
        Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
        Metadata:
          creation_time   : 2019-11-11T00:35:32.000000Z
          handler_name    : ISO Media file produced by Google Inc. Created on: 11/10/2019.
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search