Last active
September 29, 2016 13:45
-
-
Save jramsahai/a1cf80fdf0e9116b79da to your computer and use it in GitHub Desktop.
[DEPRECATED] This is no longer necessary as the javascript player embed will now read the custom ID.
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> | |
<style type="text/css"> | |
#innerContainer { | |
position: relative; | |
display: block; | |
width: 100% !important; | |
height: 0; | |
padding: 56.25% 0 0 0; /* This should reflect your video aspect ratio */ | |
} | |
#outerContainer { | |
max-height: 360px; /* Set this to the height of your player */ | |
} | |
.vidyard_player { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
max-width: 640px; /* These should be the dimensions of your player */ | |
max-height: 360px; | |
} | |
.vidyard_player > span { | |
width: 100% !important; | |
height: 100% !important; | |
margin: 0 auto !important; | |
} | |
</style> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | |
</head> | |
<body> | |
<div id="outerContainer"> | |
<div id="innerContainer"></div> | |
</div> | |
<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]; | |
} | |
} | |
// Read the custom ID that was merged into the campaign email as a query string parameter | |
// Parameter should be "custom_id" e.g. http://www.landingpage.com?custom_id={merge field value} | |
var videoID = get_parameter_by_name('custom_id'); | |
if (videoID[videoID.length-1] == "/") { | |
videoID = videoID.substring(0,videoID.length-1); | |
} | |
// Replace "nGy2swQ7lw4m8VjtpSpeSw" with the UUID of the personalized player when it is available. | |
// Add "preview=1" to embedScript.src to test the loading of the individual videos | |
var embedScript=document.createElement('script'); | |
embedScript.type='text/javascript'; | |
embedScript.id='vidyard_embed_code_nGy2swQ7lw4m8VjtpSpeSw'; | |
embedScript.src='//play.vidyard.com/nGy2swQ7lw4m8VjtpSpeSw.js?v=3.1.1&type=inline&autoplay=0&custom_id='+videoID; | |
$("#innerContainer").append(embedScript); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment