$j(function() { if($j("div.player-placeholder").length > 0) { MTVN.LitePlayer.init(); MTVN.LitePlayer.applyClick(); } }); MTVN.LitePlayer = new function(){ this.imageServer = "mtv.mtvnimages.com"; this.videoUriPrefix = "mgid:uma:video:mtv.com:"; this.playlistUriPrefix = "mgid:uma:videolist:mtv.com:"; this.imageServerUri = ""; this.affilatedHost = ""; this.active = false; this.playerUrl = "PLAYER_URL_NOT_SET"; this.configUrl = "CONFIG_URL_NOT_SET"; this.width = "240"; this.height = "211"; this.playerArgs = ""; var _this = this; var initPlayer = function(){ $j("div.player-placeholder").each(function(i){ $this = $j(this); var playerArgs = _this.playerArgs; var flashVars; var configParams = ""; if (this.id) { configParams = this.id.replace(/\./g, "&").replace(/:/g,"="); if( $this.attr("flashVars") ) { configParams += '&' + $this.attr("flashVars"); } } else { if ($this.attr("flashVars").length > 0) { configParams = $this.attr("flashVars"); } } if (playerArgs.length > 0) { playerArgs += "&"; } playerArgs += configParams; var paramsFromId = {}; var params = configParams.split("&"); var uri; var imageUri = ""; $j.each(params, function() { var pair = this.split("="); paramsFromId[pair[0]] = pair[1]; }); if(typeof paramsFromId.vid != "undefined") { uri = _this.videoUriPrefix + paramsFromId.vid; if(_this.imageServerUri != "") { imageUri = _this.imageServerUri + paramsFromId.vid; } } else { if (typeof paramsFromId.id != "undefined") { uri = _this.playlistUriPrefix + paramsFromId.id; if(_this.imageServerUri != "") { imageUri = _this.imageServerUri + paramsFromId.id; } } } if(imageUri == "") { imageUri = uri; } if(typeof paramsFromId.freewheelId != "undefined") flashVars = "sid=" + paramsFromId.freewheelId + "&configParams=" + escape(playerArgs); else flashVars = "configParams=" + escape(playerArgs); var width = (typeof $this.attr("width") == 'undefined') ? _this.width: $this.attr("width"); var height = (typeof $this.attr("height") == 'undefined') ? _this.height: $this.attr("height"); this.innerHTML = _this.generatePreloadHTML("playerPlaceholder", width, height, uri, flashVars, imageUri.replace("videolist", "content"), paramsFromId.freewheelId); // Fix for IE breaking when leaving a page where a player has been loaded with litePlayer (function(){var s=function(){__flash__removeCallback=function(i,n){if(i)i[n]=null;};window.setTimeout(s,10);};s();})(); }); this.init = function(){}; } this.init = initPlayer; this.generatePreloadHTML = function(className, width, height, playerUri, flashVars, imageServerUri, freewheelId){ var playButtonCenterX = Math.floor(width / 2) - 46; var playButtonCenterY = Math.floor(height / 2) - 36; var controlBarTop = height - 31; var html = '
'; html += ''; html += ''; html += ''; html += '
'; html += '
'; return html; } this.applyClick = function() { var h = 0; var w = 0; var bgcolor = "#000000"; var hostname = window.location.href; if (hostname.indexOf(".mtvi.com") > -1) hostname = "http://media.mtvnservices-q.mtvi.com"; else hostname = "http://media.mtvnservices.com"; $j(".playerPlaceholder").one("click", function() { var $this = $j(this); var id = this.id; var flashVars = $this.attr("flashVars"); var fwId = $this.attr("fwId"); if (h == 0){ h = $this.attr("height"); w = $this.attr("width"); } if (fwId == null || fwId == "") { if (typeof(freeWheelSSID) != 'undefined') fwId = freeWheelSSID; else fwId = "MTV_Videos"; } var embed = ""; embed += '