Aymen Kareem Aymen Kareem - 1 month ago 12
HTML Question

video HTML5 tag didn't work in IE

I have the following html5 code that display video:



<section class="video">
<h2>Video from last year</h2>
<video src="http://ak.channel9.msdn.com/ch9/265b/9a76fccd-941e-4285-ad00-9ea200aa265b/MIX09KEY01_high_ch9.mp4"></video>
<div class="video-controls" style="display: none">
<button class="video-play">Play</button>
<button class="video-pause">Pause</button>
<span class="video-time"></span>
</div>
</section>





I tried it in many pc's with the same spec it worked in all but only in one pc didn't show up. Why?

Answer

When using the <video> tag in `html5' is good practice to:

  • Include width and height attributes, to avoid that the video will flicker while loading.

  • Not every browser is able to use a specific format, so you need to add other formats too.

  • It is also usefull to put some text which will display if the browser is not capable to use the `video' tag.

     <h2>Video from last year</h2>
        <video width="320" height="240" controls>
          <source src="my_video.mp4" type="video/mp4"/>
          <source src="my_video.ogg" type="video/ogg"/>
          <source src="my_video.webm" type="video/webm"/>
          We are sorry but your browser does not support the video tag.
        </video>
    </section>

You can also if you wish display an image as placeholder normally called 'poster'

<video width="320" height="240" controls poster="poster_image.png">

Old browsers do not support the `video' tag at all.

Comments