Created
May 18, 2011 03:01
-
-
Save mmhan/977920 to your computer and use it in GitHub Desktop.
CWPlayer, Comwerks' Silverlight Videoplayer using http://slvideoplayer.codeplex.com/
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
(function($){ | |
$.fn.CwPlayer = function(options){ | |
var settings = { | |
'thumbs' : 'cwVidThumb', | |
'width' : 640, | |
'height' : 360, | |
'source' : '' | |
}; | |
function getVideoTemplate(url, options){ | |
return "<div id=\"CwPlayerGenerated\">" + | |
"<object data=\"data:application/x-silverlight-2,\" type=\"application/x-silverlight-2\" width=\""+ options.width +"\" height=\"" + options.height + "\">" + | |
"<param name=\"source\" value=\"" + options.source + "\"/>" + | |
"<param name=\"background\" value=\"white\" />" + | |
"<param name=\"initParams\" value=\"m="+ url +"\" />" + | |
"<param name=\"minruntimeversion\" value=\"2.0.31005.0\" />" + | |
"<a href=\"http://go.microsoft.com/fwlink/?LinkId=124807\" style=\"text-decoration: none;\">" + | |
"<img src=\"http://go.microsoft.com/fwlink/?LinkId=108181\" alt=\"Get Microsoft Silverlight\" style=\"border-style: none\"/>" + | |
"</a></object></div>"; | |
} | |
return this.each(function(){ | |
if(options){ | |
$.extend(settings, options); | |
} | |
var videoContainer = this; | |
$('.' + options['thumbs']).click(function(e){ | |
e.preventDefault(); | |
var vidUrl = $(this).attr('href'); | |
var str = getVideoTemplate(vidUrl, settings); | |
$(videoContainer).html(str); | |
}).first().click(); | |
}); | |
} | |
})(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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Video Player</title> | |
</head> | |
<body> | |
<div id="CWPlayer"></div> | |
<ul> | |
<li><a class="cwVidThumb" href="http://example.com/a.WMV">Video A</a></li> | |
<li><a class="cwVidThumb" href="http://example.com/CallofDutyFirstStrike.WMV">COD First Strike (Medium)</a></li> | |
<li><a class="cwVidThumb" href="http://example.com/Homefront_Torchlight_part2.WMV">Homefront Torchlight (Big)</a></li> | |
</ul> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
<script src="js/cw_player.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
$('#CWPlayer').CwPlayer({ | |
thumbs: 'cwVidThumb', | |
source: "VideoPlayer.xap" //URL relative/absolute to videoplayer.xap | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment