Skip to content

Instantly share code, notes, and snippets.

@jramsahai
Created May 31, 2016 15:10
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 jramsahai/1879ebb40e398e0b9c35c9e892c4cc22 to your computer and use it in GitHub Desktop.
Save jramsahai/1879ebb40e398e0b9c35c9e892c4cc22 to your computer and use it in GitHub Desktop.
Here is some code that will allow you to request a Vidyard UUID which can then dynamically load the corresponding player.
<html>
<head>
<!-- please note that the following code is not designed in a responsive manner
and will need to be adjusted to accomodate if desired -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">
//define function to get the embed code based on the uuid
function getEmbedCode(uuid) {
var script=document.createElement('script');
script.type='text/javascript';
script.id='vidyard_embed_code_'+uuid;
script.src='https://play.vidyard.com/'+uuid+'.js?v=3.1&type=inline';
return script;
}
//change currently displayed player in container
function changePlayer(uuid) {
document.getElementById("video_container").innerHTML = "";
$("#video_container").append(getEmbedCode(uuid));
}
//define function to take input and call changePlayer
function testResults (form) {
var User_UUID = form.inputbox.value;
console.log ("You loaded: " + User_UUID);
changePlayer(User_UUID);
}
</script>
</head>
<body>
<!-- add form input box and submit button to pass UUID into functions -->
<div class="player_selector" style="text-align:center">
<form name="add_player" action="" method="GET">Enter Your UUID Here:
<br>
<input type="text" name="inputbox" value="">
<input type="button" name="submit_button" value="Submit" onclick="testResults(this.form)">
</form>
</div>
<br>
<!-- create space for video to embed -->
<div style="height: 400px;">
<div id="video_container"></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment