Html5 Video - If Files Do Not Exist, Revert To Swf Fall Back
Solution 1:
I would suggest using a library such as MediaElementJS which will handle all this for you.
Solution 2:
This is the solution we have gone with. Cross browser and Cross device compliant.
We did not want to use an external library, although mediaelementsjs and the others out their are good alternatives, this is the best solution for us.
1 - Check the user has Flash, if they do, play the SWF version of the video
2 - If the user has no Flash, check if they have HTML5 enabled.
3 - If they have HTML5, play the mp4 first (must supported browser playback)
4 - If they have HTML5 but on Firefox or a phone, example play the .ogv
5 - Lastly play the webm failing all the above
6 - If they have none of these features, we simply include a blank div. This triggers the video play button on the site not to show the video feature at all.
No PHP, a litte jQuery and the rest is valid HTML5. This is the best solution we found as it works on all devices including the iPad. We also have an IF CONDITIONAL
for older Internet Explorer drawback - this too has helpled for IE playback.
The results we have seen are excellent, the file works on every customer device and browser we have for our demographic. We use GetClicky and they have an API, adding <video title="video name"
gives the HTML5 and SWF playback trackable.
<divclass="videobox showorhide"id="videoisonbox"><objectwidth="294"height="530"align="middle"id="product2a"classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"><paramvalue="http://cdn.com/718_blacklep/718_blacklep.swf"name="movie"><paramvalue="best"name="quality"><paramvalue="#ffffff"name="bgcolor"><paramvalue="true"name="play"><paramvalue="true"name="loop"><paramvalue="transparent"name="wmode"><paramvalue="showall"name="scale"><paramvalue="true"name="menu"><paramvalue="false"name="devicefont"><paramvalue=""name="salign"><paramvalue="sameDomain"name="allowScriptAccess"><!--[if !IE]>--><objectwidth="294"height="530"data="http://cdn.com/718_blacklep/718_blacklep.swf"type="application/x-shockwave-flash"><paramvalue="http://cdn.com/718_blacklep/718_blacklep.swf"name="movie"><paramvalue="best"name="quality"><paramvalue="#ffffff"name="bgcolor"><paramvalue="true"name="play"><paramvalue="true"name="loop"><paramvalue="transparent"name="wmode"><paramvalue="showall"name="scale"><paramvalue="true"name="menu"><paramvalue="false"name="devicefont"><paramvalue=""name="salign"><paramvalue="sameDomain"name="allowScriptAccess"><!--<![endif]--><videotitle="718 Black Lep Dress"width="294"height="530"looppreload="false"autoplayid="GCFlashAlt"controlstabindex="0"><sourcetype="video/mp4"src="http://cdn.com/718_blacklep/718_blacklep.mp4"></source><sourcetype="video/ogg"src="http://cdn.com/718_blacklep/718_blacklep.ogv"></source><sourcetype="video/webm"src="http://cdn.com/718_blacklep/718_blacklep.webm"></source></video><divclass="blank"class="enabled disable detect"id="isvideooncheck"><!-- jQuery Update for disabling video --></div><!--[if !IE]>--></object><!--<![endif]--></object></div>
Solution 3:
The check for whether the HTML5 video files exist should be made on the server side. For example if you are using PHP on the server you could use something like this:
<?phpif (file_exists($html5videofile)) { ?><video...><source...><source...><source...><object...></video><?php } else { ?><object...><?php } ?>
Post a Comment for "Html5 Video - If Files Do Not Exist, Revert To Swf Fall Back"