Last active
March 17, 2022 17:05
-
-
Save jramsahai/2560966138cfd69d9ea6 to your computer and use it in GitHub Desktop.
A slight modification to this: https://gist.github.com/jramsahai/040be6747bf60f207337. This one will allow you to load multiple players in different locations on the page on demand.
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
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | |
<script type="text/javascript"> | |
// Generate and return embed code for a given player UUID | |
function getEmbedCode(uuid) { | |
var script=document.createElement('script'); | |
script.type='text/javascript'; | |
script.id='vidyard_embed_code_'+uuid; | |
script.src='//play.vidyard.com/'+uuid+'.js?v=3.1.1&type=inline&autoplay=0'; | |
return script; | |
} | |
function loadPlayer(modalid,uuid) { | |
document.getElementById(modalid).innerHTML = ""; | |
// Get embed code and embed and execute it in the right spot on the page | |
$("#"+modalid).append(getEmbedCode(uuid)); | |
} | |
function unloadPlayer(uuid) { | |
$("#vidyard_iframe_"+uuid).remove(); | |
$("#vidyard_span_"+uuid).remove(); | |
$("#vidyard_"+uuid).remove(); | |
$("#vidyard_embed_code_"+uuid).remove(); | |
} | |
</script> | |
</head> | |
<body> | |
<div style="height: 360px;"> | |
<div id="video_container01"></div> | |
</div> | |
<a href="javascript:void(0);" onclick="loadPlayer('video_container01','CzRrg-_qv1UX6EVcc9nO6w');">Load Video</a><br /> | |
<a href="javascript:void(0);" onclick="unloadPlayer('CzRrg-_qv1UX6EVcc9nO6w');">Destroy Video</a> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment