HTML5 Video > Dont not work in IE 9.0.8, but works ok in IE 9.0.8 #209

Closed
dilrajahdan opened this Issue Aug 1, 2012 · 1 comment

Comments

Projects
None yet
1 participant

Any ideas? It looks like the IE9 Update Version 9.0.8 is not loading the vids. Update version 9.0.1 is ok. Trippy!

Video Format: MP4 / H.264.

Mime type: video/mp4

HTML:
< video id="video_1262" class="video-js vjs-default-skin" controls preload="none"
poster="/media/4165/puzzle.jpg" data-setup="{}">
< source src="/media/6221/video.mp4" type='video/mp4' />
< /video>

Javascript:

function initVideos(){

if ($('video').length) {

$('video').each(function(){

  _V_( $(this).attr('id') ).ready(function(){  

      var myPlayer = this;  // Store the video object
      var aspectRatio = 9/16; // Make up an aspect ratio

      function resizeVideoJS(){
            // Get padding 
            var paddingL = parseInt($('#'+myPlayer.id).parent().css('padding-left')),
                paddingR = parseInt($('#'+myPlayer.id).parent().css('padding-right'))                

            // Get the parent element's actual width
            var width = document.getElementById(myPlayer.id).parentElement.offsetWidth;

            // Recalculate width to include padding
            width = width - (paddingL + paddingR);
            myPlayer.width(width).height( width * aspectRatio ); // Set width to fill parent element, Set height 
      }

      resizeVideoJS(); // Initialize resizeVideoJS()
      window.onresize = resizeVideoJS; // Call resizeVideoJS() on window.resize();
  });// ready

});// each

}// if

}// function

Solution/Hack:

I got videos working in IE 9.0.8 (albeit via Flash and not HTML5 video) by:

1 - Updating Modernizr from 2.5.3 to 2.6.1
2 - Adding the following script BEFORE initialising the videos

< !-- Video JS for IE 9 - Force Flash mode. -->
< !--[if IE 9]>
< script type="text/javascript">
jQuery(document).ready(function($) {
V.options.techOrder = ["flash", "html5", "links"]; });
< /script>
< ![endif]-->

note: Remove spaces were required

dilrajahdan closed this Aug 2, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment