Skip to content

Instantly share code, notes, and snippets.

@jamiew
Created September 14, 2011 03:18
Show Gist options
  • Save jamiew/1215779 to your computer and use it in GitHub Desktop.
Save jamiew/1215779 to your computer and use it in GitHub Desktop.
Example of embedding VHX megaplaya and playing Vimeo videos
<!DOCTYPE html>
<html>
<head>
<title>Videos</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>
<script type="text/javascript" src="http://vhx.tv/javascripts/jquery.swfobject-1.1.1.js"></script>
<style type="text/css" media="screen">
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
</style>
</head>
<body>
<script type='text/javascript'>
$(document).ready(function(){
$('#player').flash({
swf: 'http://vhx.tv/embed/megaplaya',
width: '100%',
height: '100%',
allowFullScreen: true,
allowScriptAccess: "always"
});
});
// Megaplaya calls this function when it's ready
var megaplaya = false;
function megaplaya_loaded(){
megaplaya = $('#player').children()[0];
load_videos();
}
function load_videos(){
$.ajax({
type: "GET",
url: "http://vimeo.com/api/v2/vhx/videos.json",
dataType: "jsonp",
success: function(videos, status, ajax) {
if (videos) {
megaplaya.api_playQueue(videos);
}
}
});
}
</script>
<div id="player"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment