-
-
Save labsecrets/2fd6a7c85a645f21bd28 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Wistia Upload Widget via API </title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<style> | |
#wistia { width: 500px; height: 75px; } | |
</style> | |
</head> | |
<body> | |
<div id='wista'></div> | |
<div id="output"><p>Output:</p></div> | |
<script src="http://static.wistia.com/javascripts/upload_widget.js"></script> | |
<script> | |
function output(html){ | |
$('#output').append('<p>'+html+'</p>') | |
} | |
function progress(){ | |
progressMessages += 1 | |
progress_bar_exists = $('#output .progress').size() == 0 | |
if (progress_bar_exists) | |
output('uploadProgress: <span class="progress">1</span>') | |
else | |
$('#output span.progress').html(progressMessages.toString()) | |
} | |
var progressMessages = 0; | |
var widget1 = new wistia.UploadWidget({ | |
divId: 'wista', | |
publicProjectId: 'yomi4cvnsq', | |
buttonText: 'Project Upload', | |
callbacks: { | |
initializationComplete: function() { output('initializationComplete') }, | |
initializationError: function(error) { output('initializationError:'+error) }, | |
fileQueued: function(file) { output('fileQueued:'+file.name); }, | |
uploadProgress: function() { progress() }, | |
uploadSuccess: function(resp) { output('uploadSuccess') }, | |
uploadComplete: function() { output('uploadComplete') }, | |
postUploadFailure: function(error) { output('postUploadFailure:'+error) }, | |
fileQueueError: function(error) { output('fileQueueError:'+error.code) }, | |
uploadError: function(error) { output('uploadError:'+error.code) } | |
} | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment