Last active
January 12, 2019 17:05
-
-
Save jamesmundy/acf1ec14089223c96c2ebefed421a510 to your computer and use it in GitHub Desktop.
Code to play videos and swap with Wistia
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
var currentVideo = ""; | |
var introVideo = "1wzvri8wjy"; | |
var video1a = "zgg2swo8hg"; | |
var video1b = "vnsh8ysowe"; | |
var video1c = "jrvtava20v"; | |
var video2a = "zu3hb0cgsg"; | |
var video2b = "ax6wlnb9jr"; | |
var video2c = "1wqp1t1yqv"; | |
window._wq = window._wq || []; | |
$(document).ready(function() { | |
}); | |
function replaceVideo(file) { | |
console.log("Replacing " + currentVideo._hashedId); | |
currentVideo.replaceWith(file, { transition: "crossfade" }); | |
currentVideo.time(0); | |
} | |
_wq.push({ | |
id: "_all", | |
onEmbedded: function(video) { | |
console.log("embedded " + video.name()); | |
if (video._hashedId !== introVideo) { | |
video.play(); | |
} | |
}, | |
onReady: function(video) { | |
currentVideo = video; | |
console.log("ready " + video.name()); | |
video.volume(1.0); | |
video.bind("end", | |
function () { | |
alert("Demo Over. Refresh to go again."); | |
} | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment