Skip to content

Instantly share code, notes, and snippets.

@daveyjones
Last active May 5, 2016 17:02
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 daveyjones/1a19b3b357ffb01bf0154ebcabf994d8 to your computer and use it in GitHub Desktop.
Save daveyjones/1a19b3b357ffb01bf0154ebcabf994d8 to your computer and use it in GitHub Desktop.
Injecting a Wistia video after encoding has finished
var interval = setInterval(function() {
$.ajax({
url: "https://api.wistia.com/v1/medias/" + HASHED_ID + ".json?api_password=" + WISTIA_API_TOKEN,
success: function(data) {
// Update the encoding progress bar
$(".progress .bar").css("width", Math.round(100 * data.progress) + "%");
// Inject the video when ready
if (data.status == "ready") {
$("#container").append($("<div/>").addClass("wistia_embed wistia_async_" + HASHED_ID));
clearInterval(interval);
}
}
});
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment