javascript - Using Windows Media Player as video fallback for video tag -


getting video play cross platform using example video.js bit of fuss. in days when video should embedded use embed windows media player, work out of box on windows. since it's today old ie on windows doesn't support video tag experimented using windows media player fallback, , work well.

what wonder here is, why haven't else solution? have missed something? code small, there's no flash files, cross domain issues or need of server working. works.

so before develop further , add custom control , subtitles support wonder say.

the code looks this:

<video id="myvideo" style="width:640px; height: 360px;" autoplay data-wimpsource="http://esd.volvocars.com/dc/cdn/video/birds-on-a-wire.mp4">     <source src="http://esd.volvocars.com/dc/cdn/video/birds-on-a-wire.mp4" type="video/mp4" />     <source src="http://esd.volvocars.com/dc/cdn/video/birds-on-a-wire.webm" type="video/webm" /> </video>  function handlevideo(velementid) {     var usevideotag = (typeof(document.createelement('video').canplaytype) != 'undefined'),         velement = document.getelementbyid(velementid),         src = velement.getattribute('data-wimpsource'),         playercode =    '<object id="mediaplayer" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701" standby="loading media player components..." type="application/x-oleobject" width="100%" height="100%">' +                          '<param name="filename" value="' + src + '">' +                          '   <param name="animationatstart" value="true">' +                          '   <param name="transparentatstart" value="true">' +                          '   <param name="autostart" value="true">' +                          '   <param name="showcontrols" value="false">' +                          '   <param name="showstatusbar" value="false">' +                          '   <param name="windowlessvideo" value="true">' +                          '</object>';      if (!usevideotag) {         var newdiv = document.createelement("div");         newdiv.style.width = velement.style.width;         newdiv.style.height = velement.style.height;         velement.parentnode.replacechild(newdiv, velement);         newdiv.innerhtml = playercode     } }  handlevideo('myvideo'); 

here's working demo: http://verodella.se/wimpify.html

and here's jsfiddle: http://jsfiddle.net/arpo/t5jtx/

flash has been used many years industry standard playing video on web (youtube did push in direction). guess 1 part of answer in here.

a couple of things consider:

  • using windows media player work if windows media player installed on target device. ok on windows machine internet explorer guess on firefox or chrome or mac user need install specific plugin. flash has wider adoption rate (95%+) on device not support html5 video.
  • flash allows adaptive bitrate streaming, hd playback decent performance, drm , build custom controls. not sure how goes wmp component (microsoft uses silverlight ... have decided discontinue in favor of html5 video).
  • 80% of browsers support html5 video. main exception ie8. guess effort should go building nice html5 video experience (especially mobile) , provide fallback maybe lesser options (graceful degradation called).

all in use wmp fallback , cover of users (ie 6,7,8 ...) better option opt flash fallback. if want can have @ adobe strobe speed.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -