Search code examples
iosiphonehtmlipadvideo

Video tag not working on iPhone Safari or Chrome and certain iPads


I'm at the end of my rope with a certain issue of my videos not playing on my iPhone 6 browsers (Safari and Chrome) and certain ipads. It works great on desktop browsers, Android Chrome and even my iPad mini in Safari. I've researched this for a while now, including Stack Overflow but everything I've tried still doesn't play the video on my iPhone (only shows the initial frame image). Here is my video test page where I'm making edits, my code below and what I've tried to fix it based on research:

<section id="video-wrap">   
    <video class="video <?php the_field('header_video_class'); ?>" autoplay muted loop>
      <source src="/video/<?php the_field('header_video'); ?>.mp4" type="video/mp4">
      <source src="/video/<?php the_field('header_video'); ?>.ogg" type="video/ogg">
      <source src="/video/<?php the_field('header_video'); ?>.webm" type="video/webm">
    </video><!-- /video -->
    <div id="video-wrapper">
        <div class="video-caption">
            <?php the_title(); ?>
        </div><!-- /content -->
    </div>
</section>
  • I've tried adding the controls parameter back in, no luck
  • I've tried adding the video source within the video tag and removing the additional source tags, no luck
  • I've also compressed the heck out of my video. This test example is currently 640 × 360, H.264, AAC. Still no luck.
  • I've tried removing the video caption overlay in case that was conflicting. No luck.

WHAT AM I MISSING? Thanks in advance for any help!


Solution

  • New Answer (working) :

    Well I somehow missed this one little detail "only shows the initial frame image". I've misread the Question as "video does not even try to work" (because it can happen with some models/brands vs H.264 codec).

    Acoording to this blog aticle : html5 Video Autoplay on iOS and Android...

    Your code should look like (also use low-res MP4 version) :

    <video class="video" playsinline autoplay muted loop>
    

    Finally also check : Webkit policy for video section. Maybe it'll be useful to trick the machne.


    Older Answer :

    • I've also compressed the heck out of my video. This test example is currently 640 × 360, H.264, AAC. Still no luck.

    Your H.264 video is encoded with incompatible Profile : High @ Level 3.0.

    Solution : Re-encode with choosing Main @ level 3.1 (also can try level 4.0).

    Since no iOS hardware here, test these re-encode :

    Main profile @L3.1 : clip-intro-low_v2.mp4

    Baseline profile @L3.0 : clip-intro-low_v3.mp4

    PS: You may have a similar issue to this Question (in case it's useful to you).