0

I have a problem with a HTML5 <video> on the iPad Pro.

It displays in portrait but doesn't display in landscape.

Does anyone have any ideas? I am really stuck here, so your help would be really appreciated.

I have included the video code below.

 <video autoplay poster="<?=$this->getThemePath() ?>/images/video-poster.jpg" id="bgvid" class="hidden-xs hidden-sm hidden-md" onended="run()">display: block;
        <source  type="video/mp4">
    </video>

    <script>        
        video_count = getRandomizer( 1, 7 );            
        videoPlayer = document.getElementById("bgvid");

        window.onload = function () { 
        run();
        }

        function getRandomizer(min, max) {
        return Math.floor(Math.random() * (max - min)) + min;
        }

        function run(){
        // alert (video_count);
        video_count++;
        if (video_count == 9) video_count = 1;
        var nextVideo = "/doodles/"+video_count+".mp4";
        videoPlayer.src = nextVideo;
        videoPlayer.play();
        };

        $('#bgvid').click(function(){
        this.paused?this.play():this.pause();
        });
    </script>

    <script type="text/javascript">
        function vidplay() {
           var video = document.getElementById("bgvid");
           var button = document.getElementById("pause");
           if (video.paused) {
              video.play();
              button.html("<i class='fa fa-play'></i>");
           } else {
              video.pause();
              button.html("<i class='fa fa-pause'></i>");
           }
        }  
    </script>

    <div id="controls">
        <ul>
            <li><button onclick="run()"><i class="fa fa-step-forward"></i></button></li>
            <li><button id="#pause" onclick="vidplay()"><i class="fa fa-pause"></i></button></li>
        <ul>
    </div>

Added media query:

    /*** Disable animations on mobile/tablet portrait ***/

@media only screen and (max-width : 768px) {
  .animated {
    /*CSS transitions*/
    -o-transition-property: none !important;
    -moz-transition-property: none !important;
    -ms-transition-property: none !important;
    -webkit-transition-property: none !important;
    transition-property: none !important;
    /*CSS transforms*/
    -o-transform: none !important;
    -moz-transform: none !important;
    -ms-transform: none !important;
    -webkit-transform: none !important;
    transform: none !important;
    /*CSS animations*/
    -webkit-animation: none !important;
    -moz-animation: none !important;
    -o-animation: none !important;
    -ms-animation: none !important;
    animation: none !important;
  }

  .ani-not-visible {
    visibility: visible !important;
  }

}

Just found these:

    @media (max-width: 993px){
  video {
    display: none;
  }
}


video {
  width: 100% !important;
  height: auto !important;
}
Tristan
  • 215
  • 1
  • 2
  • 11
  • May be a silly question but, do you have any CSS `@media` queries that may be hiding it? – lukehillonline Feb 17 '16 at 10:02
  • Hmm, well I do have it disabled for mobile/tablet portrait, does it affect iPad Pro? I have updated my post with the media query. – Tristan Feb 17 '16 at 10:11
  • Looks like you are using Bootstrap, I haven't used it for a while but I can see you have the following classes on your `video` element: `hidden-xs hidden-sm hidden-md`, I am not exactly sure what pixel size `xs`, `sm`, and `md` are but maybe you should also look into this. I have a strong feeling this is a CSS issue. – lukehillonline Feb 17 '16 at 10:13
  • Your media query will only effect elements with the classes `.animated` and `.ani-not-visible`. Your `video` element does not have these classes so it will not be effected by your `@media` query, also your media query does not have any code to hide an element. Do you know what the pixel dimensions of an iPad Pro are? – lukehillonline Feb 17 '16 at 10:18
  • Yeah, the iPad Pro has a 2732 x 2048 resolution – Tristan Feb 17 '16 at 10:20
  • I am assuming it as a pixel density of 2, meaning that when it comes to your CSS `@media` queries it will be affected when Landscape at 1366px or when portrait 1024px. Although I would check what the pixel density is first. I feel perhaps we are going off track, you need to test the media queries, unless written for specific devices they should work the same on your PC screen so try resizing your browser and test if the video gets hidden – lukehillonline Feb 17 '16 at 10:24
  • I just tested it that way, and it doesn't disappear at all when re-sizing. – Tristan Feb 17 '16 at 10:26
  • Have a look at this: http://getbootstrap.com/css/#responsive-utilities-classes - try removing the hidden classes and seeing if that fixes. Also I have noticed the first line of your code example is malformed with `display: block;` hanging on the end and not in a style tag – lukehillonline Feb 17 '16 at 10:29
  • I don't know how that got there, but it isn't in my actual code. I have also tried removing the classes and that didn't do anything. – Tristan Feb 17 '16 at 10:31
  • I just found more media queries for the video, I have put it in the post. – Tristan Feb 17 '16 at 10:33
  • Nice that will be it! – lukehillonline Feb 17 '16 at 10:33
  • Are you sure that's it? – Tristan Feb 17 '16 at 10:35
  • without knowing the pixel density of an iPad Pro and knowing its affected dimensions i cannot say 100% but I am pretty sure that your media query at `993px` is causing your problem. This is definitely a CSS issue, just a matter of finding the code that is causing the problem. – lukehillonline Feb 17 '16 at 10:36
  • Sadly removing that had no effect. The pixel density of the iPad Pro is 264 ppi. – Tristan Feb 17 '16 at 10:40
  • Ok so this website helped me confirm iPad Pro details: http://dpi.lv/ – lukehillonline Feb 17 '16 at 11:22
  • This means that the `993px` media query is not going to effect the iPad Pro. Is your code live? Do you have a link to it? At this stage I can only encourage you to keep studying the code for media queries which may effect this. – lukehillonline Feb 17 '16 at 11:23
  • Hey, did you manage to find a solution on this? – lukehillonline Feb 17 '16 at 15:59

0 Answers0