-
-
Save basvandorst/1398018 to your computer and use it in GitHub Desktop.
WebM fallback for Vimeo with jQuery
This file contains 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
<html> | |
<head> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
var video = document.createElement("video"); | |
var playerVersion = swfobject.getFlashPlayerVersion(); | |
var iframeVideo = '<iframe src="http://player.vimeo.com/video/32377917?byline=0&portrait=0&color=ffffff" height="400" width="600">'; | |
if ( video.canPlayType( "video/mp4;") != '' || playerVersion.major > 9 ) { | |
$('video').before(iframeVideo); | |
$('video').detach(); | |
} | |
}); | |
</script> | |
</head> | |
<body> | |
<video controls> | |
<source src="video.webm" type='video/webm; codecs="vp8.0, vorbis"'> | |
<p>You can <a href="video.webm">download the movie right here</a>.</p> | |
</video> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment