Created
September 23, 2010 13:41
-
-
Save imathis/593617 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var flashPlayerLocation = "/assets/jwplayer/player.swf"; | |
| var flashPlayerSkin = "/assets/jwplayer/glow/glow.xml"; | |
| window.addEvent('domready', function() { | |
| html5toFlash(); | |
| }); | |
| function html5toFlash(){ | |
| var videos = $$('video'); | |
| if(!videos){return} | |
| videos.each(function(video){ | |
| source = video.getElement('source').get('src'); | |
| if(!source.contains('mp4') || !Modernizr.video.h264){ | |
| flashvid = new Element('object', { | |
| 'width': video.get('width').toInt() + 'px', | |
| 'height': video.get('height').toInt() + 19 + 'px', | |
| 'type': 'application/x-shockwave-flash', | |
| 'data': flashPlayerLocation | |
| }); | |
| flashvid.adopt([ | |
| new Element('param', { | |
| 'name':'movie', 'value' : source | |
| }), | |
| new Element('param', { | |
| 'name':'allowfullscreen', 'value':'true' | |
| }), | |
| new Element('param', { | |
| 'name':'flashvars', 'value' : "file="+source+"&skin="+flashPlayerSkin | |
| }) | |
| ]) | |
| flashvid.inject(video, 'after'); | |
| video.dispose(); | |
| } | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment