Skip to content

Instantly share code, notes, and snippets.

@christopherhill
Created July 11, 2013 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christopherhill/5979154 to your computer and use it in GitHub Desktop.
Save christopherhill/5979154 to your computer and use it in GitHub Desktop.
Wistia work in progress. Eventually will take the rel attribute of a link and display a fancybox popup.
/* wistiaJQuery(document).bind("wistia-popover", function(event, iframe) {
iframe.wistiaApi.time(30).play();
iframe.wistiaApi.bind("end", function() {
alert("The video ended!");
});
}); */
$(document).ready(function() {
$("a.fancybox").fancybox();
$(".popup").on("click", function(e) {
e.preventDefault();
// $.fancybox.close();
var videoId = $(this).attr('rel');
// var startTime = $(this).attr('startTime');
var iFrameURL = "http://fast.wistia.net/embed/iframe/" + videoId + "?controlsVisibleOnLoad=false&plugin%5BpostRoll-v1%5D%5Blink%5D=http%3A%2F%2Finfo.appdynamics.com%2Ffreetrial.html%3Futm_source%3Dappdynamics%26utm_medium%3Dvideo%26utm_campaign%3Dpromotetrial%26utm_content%3Dedmunds.com%26utm_term%3D&plugin%5BpostRoll-v1%5D%5Bstyle%5D%5BbackgroundColor%5D=%23616161&plugin%5BpostRoll-v1%5D%5Bstyle%5D%5Bcolor%5D=%23ffffff&plugin%5BpostRoll-v1%5D%5Bstyle%5D%5BfontFamily%5D=Gill%20Sans%2C%20Helvetica%2C%20Arial%2C%20sans-serif&plugin%5BpostRoll-v1%5D%5Bstyle%5D%5BfontSize%5D=36px&plugin%5BpostRoll-v1%5D%5Btext%5D=Try%20AppDynamics%20for%20free%21%3Cbr%2F%3EGet%20a%20free%20trial%20of%20AppDynamics%20Pro&version=v1&videoHeight=360&videoWidth=640&wmode=transparent&volumeControl=true";
// $(this).attr('href', iFrameURL);
console.log(iFrameURL);
$.fancybox.open({
/* afterShow: function(startTime) {
$(".fancybox-iframe").attr('id', 'wistia_embed');
$(".fancybox-iframe").addClass('wistia_embed');
var wistiaEmbed = $(".fancybox-iframe")[0].wistiaApi;
console.log(wistiaEmbed);
wistiaEmbed.bind('play', function() {
wistiaEmbed.time(100);
return this.unbind;
})
}, */
type: 'iframe',
width: 620,
height: 320,
href: iFrameURL,
padding: 5
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment