Image placeholder fallback for HTML5 Video

前端 未结 2 738
隐瞒了意图╮
隐瞒了意图╮ 2020-12-05 00:31

I\'m using the following code to implement an HTML5 video on a page

相关标签:
2条回答
  • 2020-12-05 00:47

    The IE7 browser does not supports Video Element. We have to write Fall back code for video tag. Here is my code :)

    <video controls="controls" autoplay="autoplay" 
    poster="#" width="212" height="160">
        <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" type="video/mp4" />
        <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.webm" type="video/webm" />
        <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.ogv" type="video/ogg" />
        <object type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" 
        width="212" height="160">
            <param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
            <param name="allowFullScreen" value="true" />
            <param name="wmode" value="transparent" />
            <param name="flashVars" value="config={'playlist':['http%3A%2F%2Fsandbox.thewikies.com%2Fvfe-generator%2Fimages%2Fbig-buck-bunny_poster.jpg',{'url':'http%3A%2F%2Fclips.vorwaerts-gmbh.de%2Fbig_buck_bunny.mp4','autoPlay':true}]}" />
            <img alt="Big Buck Bunny" src="http://sandbox.thewikies.com/vfe-generator/images/big-buck-bunny_poster.jpg" width="640" height="360" title="No video playback capabilities, please download the video below" />
        </object>
    </video>
    
    0 讨论(0)
  • 2020-12-05 00:55

    After a lot of searching, I found the solution that worked for me back to IE8. Have not tested in IE7.

    How can I display an image if browser does not support HTML5's <video> tag

    The above post, shows a method that seems to work for me. Here is the output based on my above code:

    <video autoplay>
        <source src="/resources/video/product-hero.mp4.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
        <source src="/resources/video/product-hero.webmhd.webm" type='video/webm; codecs="vp8, vorbis"' />
        <img src="/images/product/product-parent-hero.jpg" title="Your browser does not support the <video> tag">
    </video>
    
    0 讨论(0)
提交回复
热议问题