Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jramsahai/7089137 to your computer and use it in GitHub Desktop.
Save jramsahai/7089137 to your computer and use it in GitHub Desktop.
It's incredible how creatively the Vidyard player gets used by our customers. All of the building blocks are there to do really neat things, it's just a matter of picking apart the code we provide. One such request was to allow someone to embed a link in an email message that would direct the mark to a landing page and launch the lightbox player…
<!--
www.mycompany.com - Normal website appears
www.mycompany.com?playvideo=1 - Website appears, Vidyard player launched in lightbox
-->
<html>
<head>
</head>
<body>
<script type="text/javascript">
// Parsing the query string
function get_parameter_by_name(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if (results == null) {
return "";
} else {
return results[1];
}
}
</script>
<script type="text/javascript">
// Determine the value of the playvideo parameter and launch the player if 1
var urlParam = get_parameter_by_name("playvideo");
function videoCheck() {
if (urlParam[0]=="1") {
// Get this from the lightbox embed code below
fn_vidyard_MI_gb2lRkMzODtZq8dLE8Q();
}
}
</script>
<!-- Start lightbox embed code -->
<script type="text/javascript" id="vidyard_embed_code_MI_gb2lRkMzODtZq8dLE8Q" src="//play.vidyard.com/MI_gb2lRkMzODtZq8dLE8Q.js?v=3.1&type=lightbox"></script><div class="outer_vidyard_wrapper"><div class="vidyard_wrapper" onclick="fn_vidyard_MI_gb2lRkMzODtZq8dLE8Q();"><img alt="Dancing V-Bot" src="//play.vidyard.com/MI_gb2lRkMzODtZq8dLE8Q.jpg?" width="360" /><div class="vidyard_play_button"><a href="javascript:void(0);"></a></div></div></div>
<!-- End lightbox embed code -->
<script type="text/javascript">
// On page load, check the playvideo parameter value
window.onload = function () {
videoCheck();
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment