Last active
May 5, 2016 17:02
-
-
Save daveyjones/1a19b3b357ffb01bf0154ebcabf994d8 to your computer and use it in GitHub Desktop.
Injecting a Wistia video after encoding has finished
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 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