Resize Media Manager player
by Jhorsman
HTML
<p>
<ul>
<li>The Media Manger player is loaded in a div.</li>
<li>The function setPlayerResizeEvent() resizes the player</li>
</ul>
<p>
<div id='71731aa0-ebaa-4e35-8b99-7c942dc3869f' class="MMHTML5Player"></div>
<script type='text/javascript' language='javascript' src='http://mmdemo.dist.sdlmedia.com/vms/distribution/embed/?o=2A704403-660B-4368-B110-1310E5C05B76&trgt=71731aa0-ebaa-4e35-8b99-7c942dc3869f'></script>
<script type="text/javascript" language="javascript">
$(document).ready(function(){setPlayerResizeEvent(".MMHTML5Player", 378, 238);});
</script>
JavaScript
// before deploying this, remove the following line
var $j = jQuery;
function setPlayerResizeEvent(playerContainerSelector, playerWidth, playerHeight, debug) {
if (playerContainerSelector == "") {
if(debug == true)
console.debug("setPlayerResizeEvent: Invalid argument, playerContainerSelector is not set");
return;
}
if (playerWidth == "" || playerHeight == "") {
if(debug == true)
console.debug("resizeMediaManagerPlayer: Invalid arguments, playerWidth and playerHeight are required; container name: " + playerContainerSelector + "; player width: " + playerWidth + "; player height: " + playerHeight);
return;
}
setContainerDimensions(playerContainerSelector, playerWidth, playerHeight, debug);
$j(playerContainerSelector).bind("player-ready", function() {
resizeMediaManagerPlayer(playerContainerSelector, playerWidth, playerHeight);
showContainter(playerContainerSelector, debug);
});
}
function setContainerDimensions(playerContainerSelector, playerWidth, playerHeight, debug) {
if(debug == true)
console.debug("setContainerDimensions; container name: " + playerContainerSelector + "; player width: " + playerWidth + "; player height: " + playerHeight);
$j(playerContainerSelector).css({'opacity': 0, 'width': playerWidth, 'height': playerHeight});
}
function showContainter(playerContainerSelector, debug) {
if(debug == true)
console.debug("showContainter; container name: " + playerContainerSelector);
$j(playerContainerSelector).fadeTo("fast", 1);
}
function resizeMediaManagerPlayer(playerContainerSelector, playerWidth, playerHeight) {
var mediaManagerPlaceholder = $j(playerContainerSelector).children().last()
var projekktorPlayer = mediaManagerPlaceholder.children().first()
//Rezise the player div, the media manager placeholder and the projekktor player
$j(playerContainerSelector).css({ 'width': playerWidth, 'height': playerHeight });
mediaManagerPlaceholder.css({ 'width': playerWidth, 'height': playerHeight });
projekktorPlayer.css({...