1var _gaq = _gaq || []; 2 3var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}}; 4 5var scriptHost = 'play.webvideocore.net'; 6 7if(document.currentScript) { 8 var src = document.currentScript.src; 9 10 if(src && typeof URL === 'function') { 11 var url = new URL(src); 12 var hostName = url.hostname; 13 14 if(/(streamingvideoprovider\.com|webvideocore\.net|vediostream\.cn)$/.test(hostName)) { 15 scriptHost = hostName; 16 } 17 } 18} 19 20if(typeof SvpSwfObject === "undefined") var SvpSwfObject = { 21 get: function() { 22 if(typeof this.swfobject !== "undefined") return this.swfobject; 23 /*! SWFObject v2.3.20130521 <http://github.com/swfobject/swfobject> 24 is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 25 */ 26 var swfobject=function(){var D="undefined",r="object",T="Shockwave Flash",Z="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",S="SWFObjectExprInst",x="onreadystatechange",Q=window,h=document,t=navigator,V=false,X=[],o=[],P=[],K=[],I,p,E,B,L=false,a=false,m,G,j=true,l=false,O=function(){var ad=typeof h.getElementById!=D&&typeof h.getElementsByTagName!=D&&typeof h.createElement!=D,ak=t.userAgent.toLowerCase(),ab=t.platform.toLowerCase(),ah=ab?/win/.test(ab):/win/.test(ak),af=ab?/mac/.test(ab):/mac/.test(ak),ai=/webkit/.test(ak)?parseFloat(ak.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,aa=t.appName==="Microsoft Internet Explorer",aj=[0,0,0],ae=null;if(typeof t.plugins!=D&&typeof t.plugins[T]==r){ae=t.plugins[T].description;if(ae&&(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&t.mimeTypes[q].enabledPlugin)){V=true;aa=false;ae=ae.replace(/^.*\s+(\S+\s+\S+$)/,"$1");aj[0]=n(ae.replace(/^(.*)\..*$/,"$1"));aj[1]=n(ae.replace(/^.*\.(.*)\s.*$/,"$1"));aj[2]=/[a-zA-Z]/.test(ae)?n(ae.replace(/^.*[a-zA-Z]+(.*)$/,"$1")):0}}else{if(typeof Q.ActiveXObject!=D){try{var ag=new ActiveXObject(Z);if(ag){ae=ag.GetVariable("$version");if(ae){aa=true;ae=ae.split(" ")[1].split(",");aj=[n(ae[0]),n(ae[1]),n(ae[2])]}}}catch(ac){}}}return{w3:ad,pv:aj,wk:ai,ie:aa,win:ah,mac:af}}(),i=function(){if(!O.w3){return}if((typeof h.readyState!=D&&(h.readyState==="complete"||h.readyState==="interactive"))||(typeof h.readyState==D&&(h.getElementsByTagName("body")[0]||h.body))){f()}if(!L){if(typeof h.addEventListener!=D){h.addEventListener("DOMContentLoaded",f,false)}if(O.ie){h.attachEvent(x,function aa(){if(h.readyState=="complete"){h.detachEvent(x,aa);f()}});if(Q==top){(function ac(){if(L){return}try{h.documentElement.doScroll("left")}catch(ad){setTimeout(ac,0);return}f()}())}}if(O.wk){(function ab(){if(L){return}if(!/loaded|complete/.test(h.readyState)){setTimeout(ab,0);return}f()}())}}}();function f(){if(L||!document.getElementsByTagName("body")[0]){return}try{var ac,ad=C("span");ad.style.display="none";ac=h.getElementsByTagName("body")[0].appendChild(ad);ac.parentNode.removeChild(ac);ac=null;ad=null}catch(ae){return}L=true;var aa=X.length;for(var ab=0;ab<aa;ab++){X[ab]()}}function M(aa){if(L){aa()}else{X[X.length]=aa}}function s(ab){if(typeof Q.addEventListener!=D){Q.addEventListener("load",ab,false)}else{if(typeof h.addEventListener!=D){h.addEventListener("load",ab,false)}else{if(typeof Q.attachEvent!=D){g(Q,"onload",ab)}else{if(typeof Q.onload=="function"){var aa=Q.onload;Q.onload=function(){aa();ab()}}else{Q.onload=ab}}}}}function Y(){var aa=h.getElementsByTagName("body")[0];var ae=C(r);ae.setAttribute("style","visibility: hidden;");ae.setAttribute("type",q);var ad=aa.appendChild(ae);if(ad){var ac=0;(function ab(){if(typeof ad.GetVariable!=D){try{var ag=ad.GetVariable("$version");if(ag){ag=ag.split(" ")[1].split(",");O.pv=[n(ag[0]),n(ag[1]),n(ag[2])]}}catch(af){O.pv=[8,0,0]}}else{if(ac<10){ac++;setTimeout(ab,10);return}}aa.removeChild(ae);ad=null;H()}())}else{H()}}function H(){var aj=o.length;if(aj>0){for(var ai=0;ai<aj;ai++){var ab=o[ai].id;var ae=o[ai].callbackFn;var ad={success:false,id:ab};if(O.pv[0]>0){var ah=c(ab);if(ah){if(F(o[ai].swfVersion)&&!(O.wk&&O.wk<312)){w(ab,true);if(ae){ad.success=true;ad.ref=z(ab);ad.id=ab;ae(ad)}}
26else{if(o[ai].expressInstall&&A()){var al={};al.data=o[ai].expressInstall;al.width=ah.getAttribute("width")||"0";al.height=ah.getAttribute("height")||"0";if(ah.getAttribute("class")){al.styleclass=ah.getAttribute("class")}if(ah.getAttribute("align")){al.align=ah.getAttribute("align")}var ak={};var aa=ah.getElementsByTagName("param");var af=aa.length;for(var ag=0;ag<af;ag++){if(aa[ag].getAttribute("name").toLowerCase()!="movie"){ak[aa[ag].getAttribute("name")]=aa[ag].getAttribute("value")}}R(al,ak,ab,ae)}else{b(ah);if(ae){ae(ad)}}}}}else{w(ab,true);if(ae){var ac=z(ab);if(ac&&typeof ac.SetVariable!=D){ad.success=true;ad.ref=ac;ad.id=ac.id}ae(ad)}}}}}X[0]=function(){if(V){Y()}else{H()}};function z(ac){var aa=null,ab=c(ac);if(ab&&ab.nodeName.toUpperCase()==="OBJECT"){if(typeof ab.SetVariable!==D){aa=ab}else{aa=ab.getElementsByTagName(r)[0]||ab}}return aa}function A(){return !a&&F("6.0.65")&&(O.win||O.mac)&&!(O.wk&&O.wk<312)}function R(ad,ae,aa,ac){var ah=c(aa);aa=W(aa);a=true;E=ac||null;B={success:false,id:aa};if(ah){if(ah.nodeName.toUpperCase()=="OBJECT"){I=J(ah);p=null}else{I=ah;p=aa}ad.id=S;if(typeof ad.width==D||(!/%$/.test(ad.width)&&n(ad.width)<310)){ad.width="310"}if(typeof ad.height==D||(!/%$/.test(ad.height)&&n(ad.height)<137)){ad.height="137"}var ag=O.ie?"ActiveX":"PlugIn",af="MMredirectURL="+encodeURIComponent(Q.location.toString().replace(/&/g,"%26"))+"&MMplayerType="+ag+"&MMdoctitle="+encodeURIComponent(h.title.slice(0,47)+" - Flash Player Installation");if(typeof ae.flashvars!=D){ae.flashvars+="&"+af}else{ae.flashvars=af}if(O.ie&&ah.readyState!=4){var ab=C("div");aa+="SWFObjectNew";ab.setAttribute("id",aa);ah.parentNode.insertBefore(ab,ah);ah.style.display="none";y(ah)}u(ad,ae,aa)}}function b(ab){if(O.ie&&ab.readyState!=4){ab.style.display="none";var aa=C("div");ab.parentNode.insertBefore(aa,ab);aa.parentNode.replaceChild(J(ab),aa);y(ab)}else{ab.parentNode.replaceChild(J(ab),ab)}}function J(af){var ae=C("div");if(O.win&&O.ie){ae.innerHTML=af.innerHTML}else{var ab=af.getElementsByTagName(r)[0];if(ab){var ag=ab.childNodes;if(ag){var aa=ag.length;for(var ad=0;ad<aa;ad++){if(!(ag[ad].nodeType==1&&ag[ad].nodeName=="PARAM")&&!(ag[ad].nodeType==8)){ae.appendChild(ag[ad].cloneNode(true))}}}}}return ae}function k(aa,ab){var ac=C("div");ac.innerHTML="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'><param name='movie' value='"+aa+"'>"+ab+"</object>";return ac.firstChild}function u(ai,ag,ab){var aa,ad=c(ab);ab=W(ab);if(O.wk&&O.wk<312){return aa}if(ad){var ac=(O.ie)?C("div"):C(r),af,ah,ae;if(typeof ai.id==D){ai.id=ab}for(ae in ag){if(ag.hasOwnProperty(ae)&&ae.toLowerCase()!=="movie"){e(ac,ae,ag[ae])}}if(O.ie){ac=k(ai.data,ac.innerHTML)}for(af in ai){if(ai.hasOwnProperty(af)){ah=af.toLowerCase();if(ah==="styleclass"){ac.setAttribute("class",ai[af])}else{if(ah!=="classid"&&ah!=="data"){ac.setAttribute(af,ai[af])}}}}if(O.ie){P[P.length]=ai.id}else{ac.setAttribute("type",q);ac.setAttribute("data",ai.data)}ad.parentNode.replaceChild(ac,ad);aa=ac}return aa}function e(ac,aa,ab){var ad=C("param");ad.setAttribute("name",aa);ad.setAttribute("value",ab);ac.appendChild(ad)}function y(ac){var ab=c(ac);if(ab&&ab.nodeName.toUpperCase()=="OBJECT"){if(O.ie){ab.style.display="none";(function aa(){if(ab.readyState==4){for(var ad in ab){if(typeof ab[ad]=="function"){ab[ad]=null}}ab.parentNode.removeChild(ab)}else{setTimeout(aa,10)}}())}else{ab.parentNode.removeChild(ab)}}}function U(aa){return(aa&&aa.nodeType&&aa.nodeType===1)}function W(aa){return(U(aa))?aa.id:aa}function c(ac){if(U(ac)){return ac}var aa=null;try{aa=h.getElementById(ac)}catch(ab){}return aa}function C(aa){return h.createElement(aa)}function n(aa){return parseInt(aa,10)}function g(ac,aa,ab){ac.attachEvent(aa,ab);K[K.length]=[ac,aa,ab]}function F(ac){ac+="";var ab=O.pv,aa=ac.split(".");aa[0]=n(aa[0]);aa[1]=n(aa[1])||0;aa[2]=n(aa[2])||0;return(ab[0]>aa[0]||(ab[0]==aa[0]&&ab[1]>aa[1])||(ab[0]==aa[0]&&ab[1]==aa[1]&&ab[2]>=aa[2]))?true:false}function v(af,ab,ag,ae){var ad=h.getElementsByTagName("head")[0];if(!ad){return}var aa=(typeof ag=="string")?ag:"screen";if(ae){m=null;G=null}if(!m||G!=aa){var ac=C("style");ac.setAttribute("type","text/css");ac.setAttribute("media",aa);m=ad.appendChild(ac);if(O.ie&&typeof h.styleSheets!=D&&h.styleSheets.length>0){m=h.styleSheets[h.styleSheets.length-1]}G=aa}if(m){if(typeof m.addRule!=D){m.addRule(af,ab)}else{if(typeof h.createTextNode!=D){m.appendChild(h.createTextNode(af+" {"+ab+"}"))}}}}function w(ad,aa){if(!j){return}var ab=aa?"visible":"hidden",ac=c(ad);if(L&&ac){ac.style.visibility=ab}
26else{if(typeof ad==="string"){v("#"+ad,"visibility:"+ab)}}}function N(ab){var ac=/[\\\"<>\.;]/;var aa=ac.exec(ab)!=null;return aa&&typeof encodeURIComponent!=D?encodeURIComponent(ab):ab}var d=function(){if(O.ie){window.attachEvent("onunload",function(){var af=K.length;for(var ae=0;ae<af;ae++){K[ae][0].detachEvent(K[ae][1],K[ae][2])}var ac=P.length;for(var ad=0;ad<ac;ad++){y(P[ad])}for(var ab in O){O[ab]=null}O=null;for(var aa in swfobject){swfobject[aa]=null}swfobject=null})}}();return{registerObject:function(ae,aa,ad,ac){if(O.w3&&ae&&aa){var ab={};ab.id=ae;ab.swfVersion=aa;ab.expressInstall=ad;ab.callbackFn=ac;o[o.length]=ab;w(ae,false)}else{if(ac){ac({success:false,id:ae})}}},getObjectById:function(aa){if(O.w3){return z(aa)}},embedSWF:function(af,al,ai,ak,ab,ae,ad,ah,aj,ag){var ac=W(al),aa={success:false,id:ac};if(O.w3&&!(O.wk&&O.wk<312)&&af&&al&&ai&&ak&&ab){w(ac,false);M(function(){ai+="";ak+="";var an={};if(aj&&typeof aj===r){for(var aq in aj){an[aq]=aj[aq]}}an.data=af;an.width=ai;an.height=ak;var ar={};if(ah&&typeof ah===r){for(var ao in ah){ar[ao]=ah[ao]}}if(ad&&typeof ad===r){for(var am in ad){if(ad.hasOwnProperty(am)){var ap=(l)?encodeURIComponent(am):am,at=(l)?encodeURIComponent(ad[am]):ad[am];if(typeof ar.flashvars!=D){ar.flashvars+="&"+ap+"="+at}else{ar.flashvars=ap+"="+at}}}}if(F(ab)){var au=u(an,ar,al);if(an.id==ac){w(ac,true)}aa.success=true;aa.ref=au;aa.id=au.id}else{if(ae&&A()){an.data=ae;R(an,ar,al,ag);return}else{w(ac,true)}}if(ag){ag(aa)}})}else{if(ag){ag(aa)}}},switchOffAutoHideShow:function(){j=false},enableUriEncoding:function(aa){l=(typeof aa===D)?true:aa},ua:O,getFlashPlayerVersion:function(){return{major:O.pv[0],minor:O.pv[1],release:O.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(ac,ab,aa){if(O.w3){return u(ac,ab,aa)}else{return undefined}},showExpressInstall:function(ac,ad,aa,ab){if(O.w3&&A()){R(ac,ad,aa,ab)}},removeSWF:function(aa){if(O.w3){y(aa)}},createCSS:function(ad,ac,ab,aa){if(O.w3){v(ad,ac,ab,aa)}},addDomLoadEvent:M,addLoadEvent:s,getQueryParamValue:function(ad){var ac=h.location.search||h.location.hash;if(ac){if(/\?/.test(ac)){ac=ac.split("?")[1]}if(ad==null){return N(ac)}var ab=ac.split("&");for(var aa=0;aa<ab.length;aa++){if(ab[aa].substring(0,ab[aa].indexOf("="))==ad){return N(ab[aa].substring((ab[aa].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var aa=c(S);if(aa&&I){aa.parentNode.replaceChild(I,aa);if(p){w(p,true);if(O.ie){I.style.display="block"}}if(E){E(B)}}a=false}},version:"2.3"}}(); 27 28 this.swfobject = swfobject; 29 30 return this.swfobject; 31 }, 32 destroy: function() { 33 delete this.swfobject; 34 } 35}; 36if(typeof SvpPlayerInstances === "undefined") var SvpPlayerInstances = { 37 instances: {}, 38 registerInstance: function(id, instance) { 39 this.instances[id] = instance; 40 }, 41 getInstance: function(id) { 42 return this.instances[id]; 43 }, 44 getPlayerInstance: function(playerId) { 45 for(var key in this.instances) { 46 var instance = this.instances[key]; 47 if(instance.vars.clip_id == playerId) return instance; 48 } 49 return null; 50 }, 51 removeInstance: function(id) { 52 delete this.instances[id]; 53 } 54}; 55if(typeof SvpPlayerIndexes === "undefined") var SvpPlayerIndexes = 0; 56if(typeof svpHashTicketCode === "undefined") { 57 var hash=window.location.hash; 58 if(hash.indexOf('ticket=') !== -1) { 59 var params = hash.split('&'); 60 var svpHashTicketCode = params[0].replace('#ticket=', ''); 61 var clip = params[1] !== undefined ? params[1] : ''; 62 if(clip.indexOf('clip=') !== -1) { 63 var clipKey = clip.replace('clip=', ''); 64 window.location.hash='#clip='+clipKey; 65 } 66 } 67} 68 69if(!document.getElementById('sticky-module')) { 70 var StickyPlayerContainer = {}; 71 var stickyModule = document.createElement('script'); 72 73 stickyModule.setAttribute('id', 'sticky-module'); 74 stickyModule.type = 'text/javascript'; 75 stickyModule.async = true; 76 stickyModule.src = 'https://' + scriptHost + '/js/sticky_player.js'; 77 78 document.head.appendChild(stickyModule); 79 80 stickyModule.onload = function() { 81 StickyPlayerContainer = new StickyPlayer(); 82 StickyPlayerContainer.fireSticky(); 83 } 84} 85 86function SVPHTML5Player(dplayer) { 87 var html5_url = typeof dplayer.vars.html5_url !== 'undefined' ? dplayer.vars.html5_url : dplayer.site_root + 'html5.html'; 88 89 this.url = html5_url + '?p=' + encodeURIComponent(window.location.href) + '&clipId=' + dplayer.vars.clip_id + (dplayer.staticCache === false ? '&v=' + (new Date().getTime()) : ''); 90 this.vars = dplayer.translateVars(); 91 this.id = dplayer.player_id; 92 this.width = dplayer.player_width; 93 this.height = dplayer.player_height; 94 this.callback = dplayer.onSuccessEmbed; 95 this.dplayer = dplayer; 96 97 this.isReady = false;
98 this.isPlaying = false; 99 this.isComplete = false; 100 this.isLive = false; 101 this.currentSecond = 0; 102 this.duration = 0; 103 this.volume = 0; 104 this.videoID = this.vars.clipId; 105 106 this.initGetters(); 107 this.build(); 108} 109 110SVPHTML5Player.prototype.initGetters = function() { 111 Object.defineProperty(this, 'style', { 112 get: function() { 113 return this.iframe.style; 114 } 115 }); 116 117 Object.defineProperty(this, 'scrollLeft', { 118 get: function() { 119 return this.iframe.scrollLeft; 120 } 121 }); 122 123 Object.defineProperty(this, 'scrollTop', { 124 get: function() { 125 return this.iframe.scrollTop; 126 } 127 }); 128 129 Object.defineProperty(this, 'offsetLeft', { 130 get: function() { 131 return this.iframe.offsetLeft; 132 } 133 }); 134 135 Object.defineProperty(this, 'offsetTop', { 136 get: function() { 137 return this.iframe.offsetTop; 138 } 139 }); 140 141 Object.defineProperty(this, 'offsetParent', { 142 get: function() { 143 return this.iframe.offsetParent; 144 } 145 }); 146 147 Object.defineProperty(this, 'parentNode', { 148 get: function() { 149 return this.iframe.parentNode; 150 } 151 }); 152}; 153 154SVPHTML5Player.prototype.build = function() { 155 var element = document.getElementById(this.id); 156 157 if(element === null) { 158 return; 159 } 160 161 this.iframe = document.createElement('iframe'); 162 163 this.iframe.setAttribute('src', this.url); 164 this.iframe.setAttribute('style', 'width: 100%; height: 100%; position: absolute; left: 0; top: 0;'); 165 this.iframe.setAttribute('allowfullscreen', true); 166 this.iframe.setAttribute('allowtransparency', true); 167 this.iframe.setAttribute('frameborder', 0); 168 this.iframe.setAttribute('id', this.id); 169 this.iframe.setAttribute('name', this.id); 170 171 this.onMessageListener = this.onMessage.bind(this); 172 173 window.addEventListener('message', this.onMessageListener, false); 174 175 if(this.vars.sleekPlayer) { 176 var holder = this.vars.isPopin ? this.iframe : element.parentElement; 177 178 holder.style.boxShadow = '0 20px 22px -8px rgba(48,48,48,.4)'; 179 holder.style.borderRadius = '4px'; 180 holder.style.overflow = 'hidden'; 181 } 182 183 element.parentNode.replaceChild(this.iframe, element); 184 185 this.triggerReady(); 186}; 187 188SVPHTML5Player.prototype.remove = function() { 189 if(this.dplayer.isStickyExist() && this.dplayer.isStickyPlayer()) { 190 delete StickyPlayerContainer.remove(this.vars.rid); 191 } 192 193 window.removeEventListener('message', this.onMessageListener); 194 delete this.onMessageListener; 195 196 this.iframe.parentNode.removeChild(this.iframe); 197 198 delete this.iframe; 199 delete this.vars; 200 delete this.dplayer; 201 delete this.callback; 202 203 if(typeof this.destroyCallback !== 'undefined') { 204 this.destroyCallback(); 205 } 206 207 delete this.destroyCallback; 208}; 209 210SVPHTML5Player.prototype.destroy = function(destroyCallback) { 211 this.iframe.style.display = 'none'; 212 213 this.sendMessage('destroy'); 214 215 if(typeof destroyCallback === 'function') { 216 this.destroyCallback = destroyCallback; 217 } 218}; 219 220SVPHTML5Player.prototype.onMessage = function(event) { 221 if(event.source !== this.iframe.contentWindow) { 222 return; 223 } 224 225 var key = event.message ? 'message' : 'data'; 226 var details = event[key]; 227 var message = details.message; 228 var data = details.data; 229 230 this.processMessage(message, data); 231}; 232 233SVPHTML5Player.prototype.processMessage = function(message, data) { 234 switch(message) { 235 case 'init': { 236 this.init(); 237 break; 238 } 239 case 'ready': { 240 this.ready(data); 241 break; 242 } 243 case 'fireEvent': { 244 this.fireEvent(data); 245 break; 246 } 247 case 'closePlayer': { 248 this.dplayer.stop(); 249 window.ClosePlayer(data.rid); 250 break; 251 } 252 case 'isPlaying': 253 case 'isComplete': { 254 this.dplayer.manageMessagePlayerActions(message, data); 255 break; 256 } 257 case 'isLive': { 258 this.isLive = data; 259 break; 260 } 261 case 'currentSecond': { 262 this.currentSecond = data; 263 break; 264 } 265 case 'volume': { 266 this.volume = data; 267 break; 268 } 269 case 'reinitialize': { 270 if(!this.isReady) { 271 this.triggerReady(); 272 } 273 274 this.dplayer.reinitialize(data); 275 break; 276 } 277 case 'destroy': { 278 this.remove(); 279 break; 280 } 281 } 282}; 283 284SVPHTML5Player.prototype.init = function() { 285 this.sendMessage('init', this.vars); 286}; 287 288SVPHTML5Player.prototype.triggerReady = function() { 289 this.isReady = true; 290 this.callback({ 291 success: true, 292 ref: this 293 }); 294}; 295 296SVPHTML5Player.prototype.ready = function(data) { 297 if(typeof window.SvpDestroySlide === 'function') { 298 window.SvpDestroySlide(this.videoID); 299 } 300 301 var floatingPlayerDirection = this.vars.floating_player; 302 303 if(this.dplayer.isForSticky() && this.dplayer.floatingDirections.indexOf(floatingPlayerDirection) > -1) { 304 var replacedIframe = document.getElementById(this.id); 305 var stickyPlayerContainer = replacedIframe.parentElement.getAttribute('data-initialized') ? replacedIframe.parentElement : replacedIframe.parentElement.parentElement; 306 307 stickyPlayerContainer.setAttribute('animation', floatingPlayerDirection); 308 309 StickyPlayerContainer.addInstance(this.vars.rid, this.dplayer); 310 StickyPlayerContainer.onScroll(); 311 } 312 313 this.isLive = data.isLive; 314 this.duration = data.duration; 315 this.volume = data.volume; 316 317 this.registerJSEvent = this.doRegisterJSEvent; 318 this.playerLoadVideo = this.doPlayerLoadVideo; 319 this.playerSetVolume = this.doPlayerSetVolume; 320 this.playerSeekToAndPause = this.doPlayerSeekToAndPause; 321 this.playerSeekToAndPlay = this.doPlayerSeekToAndPlay; 322 this.playerCommand = this.doPlayerCommand; 323 this.executeCommand = this.doExecuteCommand; 324}; 325 326SVPHTML5Player.prototype.getContext = function(handler) { 327 var chunks = handler.split('.'); 328 329 chunks.pop(); 330 chunks = chunks.join('.'); 331 332 return eval(chunks); 333}; 334 335SVPHTML5Player.prototype.fireEvent = function(data) { 336 var handler = data.handler; 337 338 eval(handler).call(this.getContext(handler), data.data); 339}; 340 341SVPHTML5Player.prototype.sendMessage = function(message, data) { 342 this.iframe.contentWindow.postMessage({ 343 message: message, 344 data: data 345 }, '*'); 346}; 347 348SVPHTML5Player.prototype.doRegisterJSEvent = function(name, handler) { 349 this.sendMessage('registerJSEvent', { 350 name: name, 351 handler: handler 352 }); 353}; 354 355// PUBLIC API 356 357// Player control methods 358 359SVPHTML5Player.prototype.doExecuteCommand = function(command) { 360 this.sendMessage('executeCommand', command); 361}; 362 363SVPHTML5Player.prototype.doPlayerCommand = function(command) { 364 this.sendMessage('playerCommand', command); 365}; 366 367// Setters 368 369SVPHTML5Player.prototype.doPlayerSeekToAndPlay = function(seconds) { 370 this.sendMessage('seekToAndPlay', seconds); 371}; 372 373SVPHTML5Player.prototype.doPlayerSeekToAndPause = function(seconds) { 374 this.sendMessage('seekToAndPause', seconds); 375}; 376 377SVPHTML5Player.prototype.doPlayerSetVolume = function(volume) { 378 this.sendMessage('setVolume', volume); 379}; 380 381SVPHTML5Player.prototype.doPlayerLoadVideo = function(videoID) { 382 this.videoID = videoID; 383 384 this.sendMessage('loadVideo', videoID); 385}; 386 387// Getters 388 389SVPHTML5Player.prototype.get_isPlaying = function() { 390 return this.isPlaying; 391}; 392 393SVPHTML5Player.prototype.get_isPaused = function() { 394 return !this.isPlaying; 395}; 396 397SVPHTML5Player.prototype.get_isComplete = function() { 398 return this.isComplete; 399}; 400 401SVPHTML5Player.prototype.get_isMuted = function() { 402 return this.volume === 0; 403}; 404 405SVPHTML5Player.prototype.get_isLive = function() { 406 return this.isLive; 407}; 408 409SVPHTML5Player.prototype.get_videoID = function() { 410 return this.videoID; 411}; 412 413SVPHTML5Player.prototype.get_streamTime = function() { 414 return this.currentSecond; 415}; 416 417SVPHTML5Player.prototype.get_streamDuration = function() { 418 return this.duration; 419}; 420 421SVPHTML5Player.prototype.get_volume = function() { 422 return this.volume; 423}; 424 425function SVPDynamicPlayer(id, url, width, height, internal_params, vars, params) { 426 //Player variables 427 this.player_object_id = id; 428 this.player_url = url; 429 this.player_width = width; 430 this.player_height = height; 431 this.min_player_width = 320; 432 this.min_player_height = 240; 433 this.def_player_width = 400; 434 this.def_player_height = 341; 435 this.def_big_player_width = 800; 436 this.def_big_player_height = 450; 437 this.def_player_skin = 0; 438 this.def_player_controls_height = 19; 439 this.player_align = 'NONE'; //Available values: TL, TC, TR, ML, MC, MR, BL, BC, BR, NONE 440 this.player_offset_x = 0; 441 this.player_offset_y = 0; 442 this.player_offset_left = undefined; 443 this.player_offset_top = undefined; 444 this.is_ssl = true; 445 this.site_root = (this.is_ssl ? 'https:' : 'http:') + '//' + scriptHost + '/'; 446 this.services_entry = this.is_ssl ? "https://service.webvideocore.net/" : "http://service.webvideocore.net/"; 447 this.confirm_entry = this.is_ssl ? "https://service.webvideocore.net/" : "http://service.webvideocore.net/"; 448 this.logs_entry = this.is_ssl ? "https://flashlogs.webvideocore.net/" : "http://flashlogs.webvideocore.net/"; 449 this.staticCache = true; 450 451 this.player_instance = null; 452 this.html5_player_instance = null; 453 this.back_player_instance = null; 454 this.backup_player_id = null; 455 this.player_in_fs_mode = false;
456 this.player_fullscreen_mode = 'DOUBLE'; //Available values: DOUBLE, FILL, FIXED, NATIVE, NONE 457 this.player_fs_width = 0; 458 this.player_fs_height = 0; 459 this.player_background_color = ''; 460 this.player_background_transparency = 0; //in percents 461 this.player_keep_state_on_scroll = false; 462 this.player_keep_state_on_resize = false; 463 this.auto_show = true; 464 this.is_responsive = false; 465 this.flashActive = true; 466 this.floatingDirections = ['left', 'right']; 467 468 this.getIEVersion = function() { 469 var search = 'MSIE'; 470 var agent = navigator.userAgent; 471 var index = agent.indexOf(search); 472 473 return index === -1 ? 0 : parseFloat(agent.substring(index + search.length + 1)); 474 }; 475 this.getIOSVersion = function() { 476 if(/iP(hone|od|ad)/.test(navigator.platform)) { 477 var match = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/); 478 479 return parseInt(match[1], 10); 480 } 481 482 return 0; 483 }; 484 485 this.vars = typeof vars != "undefined" ? vars : {}; 486 this.params = typeof params != "undefined" ? params : {}; 487 this.internal_params = typeof internal_params != "undefined" ? internal_params : {}; 488 this.iEVersion = this.getIEVersion(); 489 this.iOSVersion = this.getIOSVersion(); 490 this.isIE = this.iEVersion > 0; 491 this.isIOS = this.iOSVersion > 0; 492 this.isOpera = typeof window.opera !== 'undefined'; 493 this.isAndroid = navigator.userAgent.toLowerCase().indexOf('android') > -1; 494 this.visibilityInterval = null; 495 this.visibilityDelay = 250; 496 this.baseZindex = 10000; 497 this.isMobile = false; 498 this.isPPV = false; 499 this.ticketsShown = false; 500 this.twoFactorPassEmailShown = false; 501 this.twoFactorNoMoreDevicesPageShown = false; 502 this.twoFactorWaitPageShown = false; 503 this.twoFactorCodePageShown = false; 504 this.isDownloadable = false; 505 this.documentAppend = false; 506 507 var playButton = this.vars.play_button; 508 var playButtonStyle = this.vars.play_button_style; 509 var isPlayButtonEnabled = playButton !== '1' && !parseInt(this.vars.no_controls, 10) && playButtonStyle !== 'static'; 510 511 this.vars.play_button = isPlayButtonEnabled || playButton === '1' ? '1' : playButton; 512 this.vars.play_button_style = isPlayButtonEnabled ? 'static' : playButtonStyle; 513 this.vars.sleek_player = this.vars.sleek_player || '0'; 514 515 // TRACKING VARIABLES 516 this.clipName = ''; 517 this.gaTrackingEnabled = false; 518 this.gaTrackingCode = ''; 519 this.refCode = ''; 520 // END OF TRACKING VARIABLES 521 522 //Internal variables 523 this._d = document; 524 this._w = window; 525 this.player_id = null; 526 this.defaultEventListeners = ['TIMELINE.PPV', 'TIMELINE.DOWNLOAD', 'TIMELINE.GA', 'PLAYER.INITIALIZED', 'PLAYHEAD.START', 'CONFIRM.RESULT', 'PPV.RESIZE', 'PPV.DESTROY', 'DOWNLOAD.DESTROY']; 527 this.flash_version = '9.0.0'; 528 this.express_install = 'expressInstall.swf'; 529 this.player_content_html = 530 '<a href="http://get.adobe.com/flashplayer/" target="_blank" class="svp_no_flash" style="width:100%;position:absolute;left:0;top:0;height:100%;background: #000;text-align:center;-webkit-transform-style: preserve-3d;-moz-transform-style:preserve-3d;transform-style:preserve-3d;">'+ 531 '<div id="svp_no_flash_layer'+this.vars.clip_id+'" style="position:relative; display:inline-block; color:#fff; overflow:hidden; margin:auto 10px; text-align:center; font-size:11px; font-family:Arial, Helvetica, sans-serif; top: 50%;transform: translateY(-50%);-moz-transform: translateY(-50%);-webkit-transform: translateY(-50%);">'+ 532 '<p align="left" style="color:#fff;margin:0;padding:0;font-size:12px;line-height16px;">'+ 533 '<img border="0" src="'+this.site_root+'img/flash_icon.png" style="float:left; margin-right:11px;width:20vmin; max-width:80px;"/>'+ 534 '<b style="font-size:14px;">ADOBE FLASH PLAYER</b><br />'+ 535 'You must activate <b>ADOBE Flash Player</b> to watch this video.<br /><br />'+ 536 '<span style="color:#3ac9f8; text-decoration:none; font-size:11px; font-weight:bold;" >Activate Flash</span>'+ 537 '</p>'+ 538 '</div>'+ 539 '</a>'; 540 this.offlineDefaultBackground = '<g id="Layer_1"><rect x="0" fill="#F6F6F8" width="14.285%" height="100%"/><rect x="14.285%" fill="#ECE922" width="14.285%" height="100%"/><rect x="28.57%" fill="#64CAD8" width="14.285%" height="100%"/><rect x="42.855%" fill="#76C043" width="14.285%" height="100%"/><rect x="57.14%" fill="#B64D9F" width="14.285%" height="100%"/><rect x="71.425%" fill="#EE1D23" width="14.285%" height="100%"/><rect x="85.71%" fill="#37509D" width="14.285%" height="100%"/></g><g id="Layer_2"><rect x="0" y="70%" fill="#384EA9" width="14.285%" height="10%"/><rect x="14.285%" y="70%" fill="#010003" width="14.285%" height="10%"/><rect x="28.57%" y="70%" fill="#B6509C" width="14.285%" height="10%"/><rect x="42.855%" y="70%" fill="#010101" width="14.285%" height="10%"/><rect x="57.14%" y="70%" fill="#64C8D8" width="14.285%" height="10%"/><rect x="71.425%" y="70%" fill="#020403" width="14.285%" height="10%"/><rect x="85.71%" y="70%" fill="#EFEFEF" width="14.285%" height="10%"/></g><g id="Layer_3"><rect x="0" y="80%" fill="#013D59" width="16.6%" height="20%"/><rect x="16.6%" y="80%" fill="#F5F6F8" width="16.6%" height="20%"/><rect x="33.3%" y="80%" fill="#28246E" width="16.6%" height="20%"/><rect x="49.8%" y="80%" fill="#000201" width="16.6%" height="20%"/><rect x="66.4%" y="80%" fill="#3B3B3D" width="16.6%" height="20%"/><rect x="83%" y="80%" fill="#010101" width="16.9%" height="20%"/></g>';
541 this.offlineCustomBackground = '<image preserveAspectRatio="none" xlink:href="data:image/jpg;base64,%imageBase64%" width="%width%px" height="%height%px" x="%x%" y="%y%"/>'; 542 this.offlineBox = '<rect width="%boxWidth%" height="%boxHeight%" x="%boxX%" y="%boxY%" rx="10" ry="10" fill="#000000" style="fill-opacity:0.6"/><text y="%titleY%" text-anchor="middle" x="50%" stroke="none" fill="#ffffff" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); text-anchor: middle; font-style: normal; font-variant: normal; font-weight: normal; font-size: 32px; line-height: normal; font-family: Arial;"><tspan>%title%</tspan></text><text y="%subtitleY%" text-anchor="middle" x="50%" stroke="none" fill="#ffffff" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); text-anchor: middle; font-style: normal; font-variant: normal; font-weight: normal; font-size: 17px; line-height: normal; font-family: Arial;"><tspan>%description%</tspan></text>'; 543 this.posterSVG = '<svg style="overflow: hidden; position: relative;" version="1.1" id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 %width% %height%" preserveAspectRatio="none">%offlineBackground%%offlineBox%</svg>'; 544 545 this.isHTML5Player = typeof window.MediaSource !== 'undefined' || this.iOSVersion > 9; 546 547 this.transformInputParameters = function(params) { 548 var out_params = []; 549 for(var x in params) { 550 out_params[x] = eval('(typeof(' + params[x] + ') != "undefined");') ? eval(params[x]) : undefined; 551 } 552 return out_params; 553 }; 554 this.getWindowSize = function() { 555 return [ 556 this._w.innerWidth || this._d.documentElement.clientWidth, 557 this._w.innerHeight || this._d.documentElement.clientHeight 558 ]; 559 }; 560 this.getDocumentSize = function() { 561 var documentWidth = Math.max( 562 Math.max(this._d.body.scrollWidth, this._d.documentElement.scrollWidth), 563 Math.max(this._d.body.offsetWidth, this._d.documentElement.offsetWidth), 564 Math.max(this._d.body.clientWidth, this._d.documentElement.clientWidth) 565 ); 566 var documentHeight = Math.max( 567 Math.max(this._d.body.scrollHeight, this._d.documentElement.scrollHeight), 568 Math.max(this._d.body.offsetHeight, this._d.documentElement.offsetHeight), 569 Math.max(this._d.body.clientHeight, this._d.documentElement.clientHeight) 570 ); 571 return [documentWidth, documentHeight]; 572 }; 573 this.getWindowScrollXY = function() { 574 var windowScrollX = 0, windowScrollY = 0; 575 if(typeof(window.pageYOffset) == 'number') { 576 //Netscape compliant 577 windowScrollY = window.pageYOffset; 578 windowScrollX = window.pageXOffset; 579 } 580 else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) { 581 //DOM compliant 582 windowScrollY = document.body.scrollTop; 583 windowScrollX = document.body.scrollLeft; 584 } 585 else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { 586 //IE6 standards compliant mode 587 windowScrollY = document.documentElement.scrollTop; 588 windowScrollX = document.documentElement.scrollLeft; 589 } 590 return [windowScrollX, windowScrollY]; 591 }, 592 this.getObject = function(id) { 593 var object = null; 594 if(this._d.getElementById) { 595 object = this._d.getElementById(id); 596 } 597 else if(this._d.layers) { 598 object = this._d.layers[id]; 599 } 600 else if(this._d.all) { 601 object = this._d.all[id]; 602 } 603 return object; 604 }, 605 this.createElement = function(nodeName, name, id, style) { 606 var node; 607 try { 608 var attributes = ''; 609 if(typeof name != "undefined") attributes += ' name="' + name + '"'; 610 if(typeof id != "undefined") attributes += ' id="' + id + '"'; 611 if(typeof style != "undefined") attributes += ' style="' + style + '"'; 612 node = this._d.createElement('<' + nodeName + attributes + '>'); 613 614 } catch (e) { 615 node = this._d.createElement(nodeName); 616 if(typeof name != "undefined") node.setAttribute('name', name); 617 if(typeof id != "undefined") node.setAttribute('id', id); 618 if(typeof style != "undefined") node.setAttribute('style', style); 619 } 620 return node; 621 }, 622 this.getElementPosition = function(element) { 623 var x = 0, y = 0; 624 if(typeof element.x !== "undefined" && typeof element.y !== "undefined") { 625 x += element.x; 626 y += element.y; 627 } 628 else { 629 do { 630 x += element.offsetLeft; 631 y += element.offsetTop; 632 element = element.offsetParent; 633 } 634 while(element !== null); 635 } 636 return [x,y]; 637 }, 638 this.parseVars = function(vars) { 639 this.checkParsedVars(this.transformInputParameters(vars)); 640 }, 641 this.checkParsedVars = function(vars) { 642 //Required variables 643 this.vars.clip_id = (typeof vars.clip_id === "undefined") ? 0 : vars.clip_id; 644 645 //Optional variables
646 this.vars.color = (typeof vars.player_color === "undefined") ? "#9C9EA4" : vars.player_color; 647 this.vars.color1 = (typeof vars.player_color1 === "undefined") ? "#FCF6FC" : vars.player_color1; 648 if(this.vars.colorHighlight) this.vars.color1 = this.vars.colorHighlight; 649 if(this.vars.colorBase) this.vars.color2 = this.vars.colorBase; 650 this.vars.color_ratio = (typeof vars.player_color_ratio === "undefined") ? "0.6" : vars.player_color_ratio; 651 this.vars.is_ssl = typeof vars.is_ssl !== 'undefined' ? vars.is_ssl : this.is_ssl; 652 this.vars.inlineIPhone = (typeof vars.inlineIPhone === "undefined") ? false : Boolean(vars.inlineIPhone); 653 this.vars.aspect_ratio = (typeof vars.aspect_ratio === "undefined") ? '' : vars.aspect_ratio; 654 655 var alpha = (typeof vars.alpha === "undefined") ? false : vars.alpha; 656 var stretch_video = (typeof vars.stretch_video === "undefined") ? 0 : vars.stretch_video; 657 var pause = (typeof vars.pause === 'undefined') ? true : vars.pause != '0'; 658 var repeat = (typeof vars.repeat === "undefined" || vars.repeat == '0') ? false : vars.repeat; 659 660 this.vars.autoHide = (typeof vars.auto_hide === "undefined" || vars.auto_hide === '') ? '0' : vars.auto_hide; 661 this.vars.brandNW = (typeof vars.brand_new_window === "undefined" || vars.brand_new_window === '') ? '1' : vars.brand_new_window; 662 if(pause) this.vars.autoStart = "0"; 663 else this.vars.autoStart = "1"; 664 665 var start_img = (typeof vars.start_img === "undefined") ? 0 : vars.start_img; 666 if(start_img) this.vars.start_img = start_img; 667 668 var start_volume = (typeof vars.start_volume === "undefined") ? '' : vars.start_volume; 669 if(start_volume) this.vars.start_volume = start_volume; 670 671 var transparent = (typeof vars.transparent === "undefined") ? true : vars.transparent; 672 if(transparent === "false") transparent = false; 673 674 var direct = (typeof vars.direct === "undefined") ? false : vars.direct; 675 if(direct === "false") direct = false; 676 this.direct = direct; 677 678 no_fullscreen = (typeof vars.no_fullscreen === "undefined" || vars.no_fullscreen == '0') ? false : vars.no_fullscreen; 679 no_fs = (typeof vars.no_fs === "undefined" || vars.no_fs == '0') ? false : vars.no_fs; 680 no_controls = (typeof vars.no_controls === "undefined") ? 0 : parseInt(vars.no_controls, 10); 681 true_fullscreen = (typeof vars.fs_mode === "undefined") ? false : vars.fs_mode == '1'; 682 native_fullscreen = (typeof vars.fs_mode === "undefined") ? false : vars.fs_mode == '2'; 683 this.only_fs = (typeof vars.only_fs === "undefined") ? false : vars.only_fs; 684 if(no_controls === 1) { 685 no_fullscreen = true; 686 } 687 688 if(this.internal_params.skin == '3') { 689 var no_fs = typeof vars.no_fs === "undefined" || parseInt(vars.no_fs, 10) === 1; 690 var no_fullscreen = typeof vars.no_fullscreen === "undefined" || parseInt(vars.no_fullscreen, 10) === 1; 691 692 if(no_fs && no_fullscreen && vars.fs_mode !== '2') { 693 vars.fs_mode = '0'; 694 } else { 695 vars.fs_mode = '2'; 696 } 697 } 698 699 if(no_fullscreen) this.player_fullscreen_mode = 'NONE'; 700 this.player_keep_state_on_resize = true; 701 702 if(!this.only_fs) { 703 this.params.quality = "high"; 704 705 if(direct) { 706 this.params.wmode = "direct"; 707 } 708 else if(transparent) { 709 this.params.wmode = "transparent"; 710 } 711 else if(native_fullscreen) { 712 this.params.wmode = "window"; 713 } 714 else { 715 this.params.wmode = "opaque"; 716 } 717 if(native_fullscreen) { 718 this.params.allowFullScreen = "true"; 719 this.vars.native_fs = "1"; 720 } 721 722 if(alpha) this.vars.alphaPlayer = "1"; 723 if(repeat) this.vars.repeatVideo = "1"; 724 if(stretch_video) this.vars.stretch_video = "1"; 725 if(no_fullscreen) this.vars.no_fs = "1"; 726 727 if(!no_fullscreen) { 728 if(typeof vars.fs_mode == "undefined") { 729 this.player_fullscreen_mode = 'NONE'; 730 } 731 else if(!vars.fs_mode) { 732 this.player_fullscreen_mode = 'FIXED'; 733 if(!isNaN(this.player_width) && !isNaN(this.player_height) && vars.force_size === 'true') { 734 this.player_fs_height = parseInt(this.player_height, 10); 735 this.player_fs_width = parseInt(this.player_width, 10); 736 } 737 else { 738 this.player_fs_height = this.def_big_player_height; 739 this.player_fs_width = this.def_big_player_width; 740 } 741 } 742 else if(vars.fs_mode == "1") { 743 this.player_fullscreen_mode = 'FILL'; 744 this.params.wmode = 'transparent'; 745 } 746 else { 747 this.player_fullscreen_mode = 'NATIVE'; 748 } 749 } 750 if(no_controls === 1) {
751 this.vars.noControls = no_controls; 752 } 753 } 754 else { 755 this.vars.fullscreen = "1"; 756 if(typeof vars.fs_mode == "undefined" || !vars.fs_mode || this.vars.fs_popin === '1') { 757 this.player_fullscreen_mode = 'FIXED'; 758 if(!isNaN(this.player_width) && !isNaN(this.player_height) && vars.force_size === 'true') { 759 this.player_fs_height = parseInt(this.player_height, 10); 760 this.player_fs_width = parseInt(this.player_width, 10); 761 } 762 else { 763 this.player_fs_height = this.def_big_player_height; 764 this.player_fs_width = this.def_big_player_width; 765 } 766 } 767 else { 768 this.player_fullscreen_mode = 'FILL'; 769 this.params.wmode = 'transparent'; 770 } 771 } 772 if(typeof vars.bg_color !== "undefined") this.player_background_color = vars.bg_color; 773 var location = ''; 774 try { 775 location = self.location.href; 776 } 777 catch(e) {} 778 this.vars.page = typeof this.vars.page !== 'undefined' ? this.vars.page : encodeURIComponent(location); 779 if(typeof vars.player_align !== "undefined" && vars.player_align !== "" && vars.player_align !== "NONE") { 780 this.player_align = vars.player_align; 781 this.player_keep_state_on_scroll = true; 782 } 783 if(typeof vars.offset_x !== "undefined" && vars.offset_x !== "") this.player_offset_x = vars.offset_x; 784 if(typeof vars.offset_y !== "undefined" && vars.offset_y !== "") this.player_offset_y = vars.offset_y; 785 if(typeof vars.bg_transp !== "undefined" && vars.bg_transp !== "") this.player_background_transparency = vars.bg_transp; 786 if(typeof vars.prebuffer !== "undefined" && vars.prebuffer !== "") this.vars.preLoad = vars.prebuffer; 787 if(typeof vars.rid !== "undefined") this.vars.rid = vars.rid; 788 if(typeof vars.ext !== "undefined") this.vars.ext = vars.ext; 789 if(typeof vars.referer !== "undefined") this.vars.referer = encodeURIComponent(vars.referer); 790 if(typeof vars.preview !== "undefined") this.vars.is_preview = vars.preview; 791 if(typeof vars.start_volume !== "undefined" && vars.start_volume !== "") this.vars.start_volume = vars.start_volume; 792 if(typeof vars.close_button !== "undefined" && vars.close_button !== "") this.vars.close_button = vars.close_button; 793 if(typeof vars.debug === 'undefined' || vars.debug === 'false') vars.debug = 0; 794 if(vars.debug === 'true') vars.debug = 1; 795 this.vars.debug = Number(vars.debug); 796 this.vars.noHlsBilling = "1"; 797 this.params.allowScriptAccess = "always"; 798 this.params.allowNetworking = "all"; 799 this.params.LOOP = "false"; 800 this.params.swLiveConnect = "true"; 801 this.params.bgcolor = '#000000'; 802 if(typeof vars.pbgcolor != "undefined") this.params.bgcolor = vars.pbgcolor; 803 this.is_responsive = (typeof vars.is_responsive !== 'undefined' && vars.is_responsive === 'true'); 804 if(this.is_responsive) { 805 var container = document.getElementById(this.internal_params.use_div); 806 if(container.getAttribute('data-initialized') !== null) { 807 return; 808 } 809 810 container.style.width = '100%'; 811 812 if(this.vars.aspect_ratio === 'adaptive') { 813 container.style.height = '100%'; 814 815 return; 816 } 817 818 var width = container.offsetWidth, height = container.offsetHeight; 819 var attributes = this.vars.aspect_ratio.split(':'); 820 if(height === 0) { 821 if(width === 0) width = 16; 822 height = width / (16 / 9); 823 } 824 if(attributes.length === 2) { 825 width = parseInt(attributes[0], 10); 826 height = parseInt(attributes[1], 10); 827 } 828 829 container.style.height = 'auto'; 830 container.style.paddingTop = (height / width * 100) + '%'; 831 } 832 833 var autoPlay = Number(this.vars.auto_play); 834 var autoPlayType = this.vars.auto_play_type; 835 836 if(autoPlay > 0 && autoPlayType === 'mute') { 837 this.vars.pause = '0'; 838 this.vars.autoStart = '1'; 839 this.vars.start_volume = '0'; 840 } 841 842 if(autoPlay === 1) { 843 this.vars.pause = '0'; 844 this.vars.autoStart = '1'; 845 } 846 }; 847 this.parseInternalParams = function(internal_params) { 848 this.checkParsedInternalParams(this.transformInputParameters(internal_params)); 849 }, 850 this.checkParsedInternalParams = function(internal_params) { 851 if(typeof this.player_height == "undefined" || !this.player_height) { 852 this.player_height = (typeof internal_params.player_height == "undefined") ? this.def_player_height : internal_params.player_height; 853 } 854 if(typeof this.player_width == "undefined" || !this.player_width) { 855 this.player_width = (typeof internal_params.player_width == "undefined") ? this.def_player_width : internal_params.player_width; 856 } 857 var skin = (typeof internal_params.skin == "undefined") ? this.def_player_skin : internal_params.skin; 858 if(typeof this.player_object_id == "undefined" || !this.player_object_id) { 859 this.player_object_id = (typeof internal_params.use_div == "undefined") ? '' : internal_params.use_div; 860 } 861 this.player_url = this.site_root + 'player' + skin + '.swf'; 862 this.player_controls_height = (typeof internal_params.player_controls_height == "undefined") ? this.def_player_controls_height : internal_params.player_controls_height;
863 if(typeof internal_params.auto_show != "undefined" && internal_params.auto_show == "false") this.auto_show = false; 864 }; 865 this.init = function() { 866 var player_content = null; 867 this.use_existing_div = true; 868 if(typeof this.player_object_id === "undefined" || !this.player_object_id) { 869 this.use_existing_div = false; 870 this.player_id = 'svp_' + (typeof this.vars.clip_id == "undefined" ? Math.floor(Math.random() * 100000000001) : this.vars.clip_id); 871 } 872 else if(this.need_new_layer) { 873 this.player_id = this.player_align != 'NONE' ? this.player_object_id : 'svp_' + this.player_object_id; 874 } 875 else { 876 this.player_id = 'svp_' + this.player_object_id; 877 var player_wrapper = null; 878 var width = isNaN(this.player_width) ? this.player_width : this.player_width + 'px'; 879 var height = isNaN(this.player_height) ? this.player_height : this.player_height + 'px'; 880 if(!this.is_responsive) { 881 var style = 'position:relative;width:' + width + ';' + 'height:' + height + ';'; 882 883 if(this.vars.sleek_player !== '0') { 884 style += 'box-shadow:0 20px 22px -8px rgba(48,48,48,.4);border-radius:4px;overflow:hidden'; 885 } 886 887 player_wrapper = this.createElement('div', 'wrapper_' + this.player_id, 'wrapper_' + this.player_id, style); 888 } 889 player_content = this.createElement('div', this.player_id, this.player_id, 'width:100%;height:100%;position:absolute;left:0;top:0;'); 890 var object = this.getObject(this.player_object_id); 891 if(object !== null) { 892 if(object.getAttribute('data-initialized') !== null) { 893 return; 894 } 895 object.setAttribute('data-initialized', 'true'); 896 player_content.innerHTML = object.innerHTML; 897 object.innerHTML = ''; 898 if(!this.is_responsive) { 899 player_wrapper.appendChild(player_content); 900 object.appendChild(player_wrapper); 901 } 902 else { 903 object.appendChild(player_content); 904 } 905 } 906 } 907 if(typeof this.vars.rid === "undefined") this.vars.rid = new Date().getTime() + Math.floor(Math.random() * 100000000001); 908 909 this.attributes = { 910 id: this.player_id, 911 name: this.player_id, 912 style: 'position: absolute; top: 0; left: 0;' 913 }; 914 //create player div layer 915 if(!this.only_fs && this.need_new_layer) { 916 if(this.player_align !== 'NONE') { 917 player_content = this.getObject(this.player_object_id); 918 } 919 else { 920 player_content = this.createElement('div', this.player_id, this.player_id); 921 } 922 if(this.player_keep_state_on_scroll) { 923 this.static_div = this.createElement('div', 'static_' + this.player_id, 'static_' + this.player_id, 'width:' + this.player_width + 'px' + ';' + 'height:' + this.player_height + 'px' + ';'); 924 this.static_div.style.position = 'fixed'; 925 this.static_div.style.zIndex = ++SvpPlayerIndexes + this.baseZindex; 926 927 this.static_div.appendChild(player_content); 928 this._d.body.insertBefore(this.static_div, this._d.body.childNodes[0]); 929 } 930 else { 931 this._d.body.appendChild(player_content); 932 } 933 } 934 if(this.use_existing_div && this.need_new_layer && this.player_align === 'NONE') { 935 var params = this.getElementPosition(this.getObject(this.player_object_id)); 936 this.player_offset_left = params[0]; 937 this.player_offset_top = params[1]; 938 } 939 940 SvpPlayerInstances.registerInstance(this.vars.rid, this); 941 if(!this.auto_show) { 942 this.getObject(this.player_id).style.display = 'none'; 943 if(this.static_div) this.static_div.style.display = 'none'; 944 } 945 else if(!this.only_fs) this.embedPlayer(); 946 this.executePlayerEvent('PLAYER.INIT', true); 947 }; 948 this.onResize = (function(self) { 949 return function(e) { 950 self.resize(e); 951 }; 952 })(this); 953 this.bindPlayerEvents=function(events){ 954 var i = 0; 955 var length = events.length; 956 for(; i < length; i++) { 957 this.addPlayerEventListener(events[i], this.onPlayerEvent); 958 } 959 }; 960 this.sendGaEvent = function() { 961 if(typeof window._gaq._getAsyncTracker !== 'undefined') { 962 _gaq.push(['_setAccount', this.gaTrackingCode]); 963 _gaq.push(['_trackEvent', 'Videos Played', this.refCode, this.clipName]); 964 } 965 else { 966 var that = this; 967 setTimeout(function() { 968 that.sendGaEvent(); 969 }, 50); 970 } 971 }; 972 this.onPlayerEvent = function(event,object,type) { 973 if(type==='TIMELINE.GA') { 974 var eventData = event.split(','); 975 if(eventData[0].length > 0) { 976 object.gaTrackingEnabled = true; object.gaTrackingCode = eventData[0]; object.clipName = eventData[1]; object.refCode = eventData[2]; 977 (function() { 978 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 979 ga.src = (object.is_ssl ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 980 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 981 })(); 982 } 983 } else if(type==='PLAYHEAD.START' && object.gaTrackingEnabled === true) { 984 object.sendGaEvent(); 985 } else if(type === 'TIMELINE.PPV' || type === 'TIMELINE.DOWNLOAD') { 986 var r=(object.staticCache===false?'?v='+(new Date().getTime()):'');
987 var eventParams = event.split(','); 988 var eventCat = type.split('.')[1]; 989 svpJSLoader.JS.load(object.site_root+'js/dplayerUtils.js',r,function(){ 990 svpDplayerUtils.SETTINGS.cache=object.staticCache; 991 svpDplayerUtils.CORE.init(object.site_root,function(){ 992 var params = {}; 993 if(eventCat==='PPV'){ 994 params.layout = parseInt(eventParams[0], 10); 995 if(object.html_playlist !== true) params.layout = 1; 996 if(object.params.wmode !== "transparent" && object.html5_player_locked !== true) params.hide_bg = 1; 997 if(object.html5_player_locked === true && object.html_playlist !== true) params.close = 0; 998 params.is_live = typeof eventParams[1] !== "undefined" ? parseInt(eventParams[1], 10) : 0; 999 params.bg_image = typeof eventParams[2] !== "undefined" ? eventParams[2] : false; 1000 params.tmode = typeof eventParams[3] !== "undefined" ? parseInt(eventParams[3], 10) : 0; 1001 svpDplayerUtils.PPV.init(params,object); 1002 }else if(eventCat==='DOWNLOAD'){ 1003 svpDplayerUtils.DL.init(params,object,''); 1004 object.isDownloadable = true; 1005 } 1006 },function(e){alert('There is a problem with initialization of utils library. Please try again in a few minutes.'+e);}); 1007 },function(e){alert('There is a problem with loading of utils library. Please try again in a few minutes.'+e);}); 1008 } else if(type === 'CONFIRM.RESULT') { 1009 var att=event.split(':'), 1010 s=typeof att[0]!=='undefined'?unescape(att[0]):'', 1011 ed=typeof att[1]!=='undefined'?unescape(att[1]).replace(/&/g, '&').split(';'):'', 1012 m=typeof att[2]!=='undefined'?unescape(att[2]):''; 1013 var d = {}; 1014 for(var i=0;i<ed.length;i++){ 1015 var val=ed[i].split('='); 1016 var idx=val.shift(); 1017 d[idx]=val.join('='); 1018 } 1019 if(d.code==='PPV')svpDplayerUtils.PPV.confirmResponse(object,d.code,s,m); 1020 else if(d.code==='DL'){ 1021 var iframe = document.createElement('iframe'); 1022 iframe.style.display = 'none'; 1023 document.body.appendChild(iframe); 1024 iframe.src = d.storage_link; 1025 } 1026 } else if(type === 'PPV.RESIZE' && typeof svpDplayerUtils !== 'undefined' && object.isPPV) { 1027 svpDplayerUtils.PPV.resize(object); 1028 } else if(type === 'PPV.DESTROY' && typeof svpDplayerUtils !== 'undefined' && object.isPPV) { 1029 svpDplayerUtils.PPV.destroy(object); 1030 } else if(type === 'DOWNLOAD.DESTROY' && typeof svpDplayerUtils !== 'undefined' && object.isDownloadable) { 1031 svpDplayerUtils.DL.destroy(object); 1032 } 1033 }; 1034 this.addListener = function(elem, evt, func) { 1035 if(elem === this._w && evt === 'load' && document.readyState === 'complete') { 1036 func(); 1037 return true; 1038 } 1039 if(elem.addEventListener) { //W3C DOM 1040 elem.addEventListener(evt, func, false); 1041 return true; 1042 } 1043 else if(elem.attachEvent) { //IE DOM 1044 var r = elem.attachEvent("on" + evt, func); 1045 return r; 1046 } 1047 return false; 1048 }; 1049 this.removeListener = function(elem, evt, func) { 1050 if(elem.removeEventListener) { //W3C DOM 1051 elem.removeEventListener(evt, func, false); 1052 return true; 1053 } 1054 else if(elem.detachEvent) { //IE DOM 1055 var r = elem.detachEvent("on" + evt, func); 1056 return r; 1057 } 1058 return false; 1059 }; 1060 this.createCSS = function(css) { 1061 this.style = this._d.createElement('style'); 1062 this.style.setAttribute("type", "text/css"); 1063 this.style.setAttribute("media", "screen"); 1064 this.style.setAttribute("id", 'svp_style_sheet_' + this.player_id); 1065 var valid = true; 1066 if(this.style.styleSheet) { //IE 1067 try { 1068 this.style.styleSheet.cssText = css; 1069 } 1070 catch(e) { 1071 valid = false; 1072 } 1073 } 1074 else { //the world 1075 var styleText = this._d.createTextNode(css); 1076 try { 1077 this.style.appendChild(styleText); 1078 } 1079 catch(e) { 1080 valid = false; 1081 } 1082 } 1083 if(valid) { 1084 this.head = this._d.getElementsByTagName('head')[0]; 1085 this.head.appendChild(this.style); 1086 } 1087 }; 1088 this.removeCSS = function() { 1089 if(typeof this.head !== "undefined") { 1090 this.head.removeChild(this.style); 1091 } 1092 }; 1093 this.openFullscreen = function() { 1094 //cache current values 1095 this.player_in_fs_mode = true; 1096 this.cached_width = this.player_width; 1097 this.cached_height = this.player_height; 1098 this.cached_align = this.player_align; 1099 this.cached_offset_left = this.player_offset_left; 1100 this.cached_offset_top = this.player_offset_top; 1101 this.cached_overflow = this._d.body.style.overflow; 1102 1103 var windowSizes = null; 1104 var windowScrolling = this.getWindowScrollXY(); 1105 this.cached_scroll_x = windowScrolling[0]; 1106 this.cached_scroll_y = windowScrolling[1]; 1107 1108 this._d.body.style.overflow = "hidden"; 1109 1110 if((this.player_fullscreen_mode === 'FIXED' || this.player_fullscreen_mode === 'FILL') && (this.isIE || this.isOpera)) { 1111 this.createCSS("html {overflow:hidden;}"); 1112 } 1113 1114 this.background_id = 'player_background_' + this.player_id; 1115 var popPlayerContainer = document.getElementById(this.background_id); 1116 1117 if(!popPlayerContainer && this.player_background_color !== '' && this.player_fullscreen_mode !== 'FILL') { 1118 windowSizes = this.getWindowSize(); 1119 windowWidth = windowSizes[0]; 1120 windowHeight = windowSizes[1]; 1121 var sizes = this.getWindowScrollXY(); 1122 var transparency = this.player_background_transparency; 1123 if(transparency > 100) transparency = 100; 1124 if(transparency < 0) transparency = 0; 1125 transparency = 100 - transparency; 1126 if(this.isIE) transparency_string = "filter:alpha(opacity=" + transparency + ");opacity:"+transparency / 100; 1127 else transparency_string = "opacity:" + transparency / 100; 1128 // var z = ++SvpPlayerIndexes + this.baseZindex; 1129 var z= this.player_instance.style.zIndex ? this.player_instance.style.zIndex - 1 : ++SvpPlayerIndexes + this.baseZindex; 1130 this.background_content = this.createElement('div', this.background_id, this.background_id, "margin:0;
1130width:" + windowWidth + "px;height:" + windowHeight + "px;top:" + sizes[1] + "px;left:" + sizes[0] + "px;z-index:" + z + ";overflow:hidden;position:absolute;background-color:" + this.player_background_color + ";" + transparency_string + ";"); 1131 this._d.body.appendChild(this.background_content); 1132 var thisObject = this; 1133 1134 if(this.player_fullscreen_mode === 'FIXED' && this.vars.fs_popin == '1') { 1135 this.background_content.onclick = function() { 1136 ClosePlayer(thisObject.vars.rid); 1137 }; 1138 } 1139 } 1140 1141 if(this.player_fullscreen_mode == 'DOUBLE') { 1142 this.player_width *= 2; 1143 this.player_height *= 2; 1144 this.player_align = 'MC'; 1145 this.player_offset_left = undefined; 1146 this.player_offset_top = undefined; 1147 } 1148 else if(this.player_fullscreen_mode == 'FIXED') { 1149 this.defineFixedSizes(); 1150 this.player_align = 'MC'; 1151 this.player_offset_left = undefined; 1152 this.player_offset_top = undefined; 1153 } 1154 else if(this.player_fullscreen_mode == 'FILL') { 1155 this.player_align = 'NONE'; 1156 this.player_offset_left = undefined; 1157 this.player_offset_top = undefined; 1158 1159 windowSizes = this.getWindowSize(); 1160 windowWidth = windowSizes[0]; 1161 windowHeight = windowSizes[1]; 1162 this.player_width = windowWidth; 1163 this.player_height = windowHeight; 1164 this._w.scrollTo(0, 0); 1165 } 1166 if(this.flashActive) this.positionPlayer(); 1167 }; 1168 this.closeFullscreen = function() { 1169 this.player_in_fs_mode = false;
1170 1171 if(this.player_background_color !== '' && this.player_fullscreen_mode !== 'FILL' && this.background_content) { 1172 this._d.body.removeChild(this.background_content); 1173 delete this.background_content; 1174 } 1175 if((this.player_fullscreen_mode === 'FILL' || this.player_fullscreen_mode === 'FIXED') && (this.isIE || this.isOpera)) this.removeCSS(); 1176 if(this.player_fullscreen_mode === 'FILL') this._w.scrollTo(this.cached_scroll_x, this.cached_scroll_y); 1177 1178 this._d.body.style.overflow = this.cached_overflow; 1179 this.player_width = this.cached_width; 1180 this.player_height = this.cached_height; 1181 this.player_align = this.cached_align; 1182 this.player_offset_left = this.cached_offset_left; 1183 this.player_offset_top = this.cached_offset_top; 1184 1185 this.positionPlayer(); 1186 }; 1187 this.execute = function() { 1188 this.need_new_layer = this.player_align !== 'NONE' || (this.player_fullscreen_mode !== 'NONE' && this.player_fullscreen_mode !== 'NATIVE'); 1189 if(!this.need_new_layer) { 1190 this.init(); 1191 } 1192 else { 1193 if(!this.auto_show) { 1194 this.getObject(this.internal_params.use_div).style.display = 'none'; 1195 } 1196 this.addListener(this._w, 'load', this.onLoad); 1197 } 1198 }; 1199 this.onLoad = (function(self) { 1200 return function(e) { 1201 self.init(); 1202 }; 1203 })(this); 1204 this.defineFixedSizes = function() { 1205 var windowSizes = this.getWindowSize(); 1206 windowWidth = windowSizes[0]; 1207 windowHeight = windowSizes[1]; 1208 1209 var proportion = this.player_fs_width / this.player_fs_height; 1210 this.player_width = this.player_fs_width; 1211 this.player_height = this.player_fs_height; 1212 1213 if(this.player_width > windowWidth) { 1214 this.player_width = windowWidth; 1215 this.player_height = Math.floor(this.player_width / proportion); 1216 } 1217 if(this.player_height > windowHeight) { 1218 this.player_height = windowHeight; 1219 this.player_width = Math.floor(this.player_height * proportion); 1220 } 1221 }; 1222 this.resize = function(e) { 1223 var windowSizes = null; 1224 if(this.player_instance !== null) { 1225 if(this.player_in_fs_mode === true) { 1226 if(this.player_fullscreen_mode === 'FILL') { 1227 windowSizes = this.getWindowSize(); 1228 windowWidth = windowSizes[0]; 1229 windowHeight = windowSizes[1]; 1230 this.player_width = windowWidth; 1231 this.player_height = windowHeight; 1232 } 1233 else if(this.player_fullscreen_mode === 'FIXED') { 1234 this.defineFixedSizes(); 1235 windowSizes = this.getWindowSize(); 1236 windowWidth = windowSizes[0]; 1237 windowHeight = windowSizes[1]; 1238 this.background_content.style.width = windowWidth + 'px'; 1239 this.background_content.style.height = windowHeight + 'px'; 1240 } 1241 } 1242 else { 1243 if(this.player_align == 'NONE') { 1244 if(this.player_object_id) { 1245 var pos = this.getElementPosition(this.getObject(this.player_object_id)); 1246 this.player_offset_left = pos[0]; 1247 this.player_offset_top = pos[1]; 1248 } 1249 } 1250 } 1251 this.positionPlayer(); 1252 } 1253 }; 1254 this.positionPlayer = function() { 1255 var offsetLeft = 0, offsetTop = 0; 1256 1257 if(typeof this.player_offset_left !== "undefined" && typeof this.player_offset_top !== "undefined") { 1258 offsetLeft = this.player_offset_left; 1259 offsetTop = this.player_offset_top; 1260 } 1261 else if(this.player_align !== 'NONE') { 1262 var windowSizes = this.getWindowSize(); 1263 var documentSizes = this.getDocumentSize(); 1264 var windowWidth = Math.min(documentSizes[0], windowSizes[0]); 1265 var windowHeight = Math.min(documentSizes[1], windowSizes[1]); 1266 1267 if(this.player_align === 'TL' || this.player_align === 'ML' || this.player_align === 'BL') { 1268 offsetLeft = 0 + Math.floor(this.player_offset_x); 1269 } 1270 else if(this.player_align === 'TC' || this.player_align === 'MC' || this.player_align === 'BC') { 1271 offsetLeft = Math.floor(( Math.floor(windowWidth) - Math.floor(this.player_width)) / 2) + Math.floor(this.player_offset_x); 1272 } 1273 else { 1274 offsetLeft = Math.floor(windowWidth) - Math.floor(this.player_width) - Math.floor(this.player_offset_x); 1275 } 1276 1277 if(this.player_align === 'TL' || this.player_align === 'TC' || this.player_align === 'TR') { 1278 offsetTop = 0 + Math.floor(this.player_offset_y); 1279 } 1280 else if(this.player_align === 'ML' || this.player_align === 'MC' || this.player_align === 'MR') { 1281 offsetTop = (Math.floor(windowHeight) - Math.floor(this.player_height)) / 2 + Math.floor(this.player_offset_y); 1282 } 1283 else { 1284 offsetTop = Math.floor(windowHeight) - Math.floor(this.player_height) - Math.floor(this.player_offset_y); 1285 } 1286 1287 if(this.player_fullscreen_mode === 'FIXED' && this.player_align !== 'NONE') { 1288 var windowScrolling = this.getWindowScrollXY(); 1289 offsetLeft += windowScrolling[0]; 1290 offsetTop += windowScrolling[1]; 1291 } 1292 } 1293 1294 if(this.player_keep_state_on_scroll) { 1295 if(this.isIE && this.iEVersion <= 6) { 1296 var style = " {position:absolute;top:expression(0+((e=document.documentElement.scrollTop)?e:document.body.scrollTop)+'px');left: expression(0+((e=document.documentElement.scrollLeft)?e:document.body.scrollLeft)+'px');}"; 1297 this.createCSS("#" + this.player_instance.id + style); 1298 this.createCSS("#" + this.static_div.id + style); 1299 1300 this.static_div.style.top = offsetTop + 'px'; 1301 this.static_div.style.left = offsetLeft + 'px'; 1302 this.static_div.style.position = 'absolute'; 1303 } 1304 else { 1305 this.static_div.style.top = offsetTop + 'px'; 1306 this.static_div.style.left = offsetLeft + 'px'; 1307 } 1308 } 1309 else { 1310 if(this.player_instance !== null) { 1311 this.player_instance.style.position = 'absolute'; 1312 this.player_instance.style.left = offsetLeft + 'px'; 1313 this.player_instance.style.top = offsetTop + 'px'; 1314 1315 this.player_instance.style.width = this.player_width + 'px'; 1316 this.player_instance.style.height = this.player_height + 'px'; 1317 } 1318 1319 if(this.html5_player_instance !== null) { 1320 this.html5_player_instance.style.width = this.player_width + 'px'; 1321 this.html5_player_instance.style.height = this.player_height + 'px'; 1322 } 1323 } 1324 this.executePlayerEvent('PLAYER.POSITION_CHANGED', true); 1325 }; 1326 this.embedPlayer = function() { 1327 if(this.only_fs && !document.getElementById('svp_player-container')) { 1328 var player_content = this.createElement('div', this.player_id, this.player_id); 1329 player_content.innerHTML = this.player_content_html; 1330 this._d.body.appendChild(player_content); 1331 } 1332 if(this.vars.fs_popin==='1'){ 1333 delete this.vars.only_fs; 1334 if(!this.direct) this.params.wmode='window'; 1335 else this.params.wmode='direct'; 1336 this.params.allowFullScreen='true'; 1337 delete this.vars.fullscreen; 1338 } 1339 if(this.isHTML5Player) { 1340 var player = new SVPHTML5Player(this); 1341 1342 return; 1343 } 1344 this.vars.testHttpURL='http://socket.webvideocore.net:82/'; 1345 SvpSwfObject.get().embedSWF(this.player_url, this.player_id, '100%', '100%', this.flash_version, this.express_install, this.vars, this.params, this.attributes, this.onSuccessEmbed); 1346 }; 1347 this.translateVars = function() { 1348 return { 1349 servicesEntry: this.services_entry, 1350 confirmEntry: this.confirm_entry, 1351 logsEntry: this.logs_entry, 1352 staticRoot: this.site_root, 1353 isPopin: Number(this.vars.fs_popin) === 1, 1354 autoplay: this.vars.autoStart === '1', 1355 autoHideControls: this.vars.autoHide === '1', 1356 brandNewWindow: this.vars.brandNW === '1', 1357 closeButton: this.vars.close_button === '1', 1358 clipId: this.vars.clip_id, 1359 rid: this.vars.rid,
1360 colorBase: this.vars.colorBase, 1361 colorHover: this.vars.colorHighlight, 1362 colorText: this.vars.colorIcon, 1363 bgColor1: this.vars.bg_color1, 1364 bgColor2: this.vars.bg_color2, 1365 shareOptions: this.vars.share_options || '', 1366 opacity: this.vars.skinAlpha / 100, 1367 fullscreenToggle: parseInt(this.vars.fs_mode, 10) === 2, 1368 controls: this.vars.no_controls !== '1', 1369 playButton: this.vars.play_button !== '0', 1370 playButtonStyle: this.vars.play_button_style, 1371 sleekPlayer: this.vars.sleek_player !== '0', 1372 loop: this.vars.repeat === '1', 1373 volume: parseInt(this.vars.start_volume, 10), 1374 stretch: this.vars.stretch_video === '1', 1375 minViewers: parseInt(this.vars.viewers_limit, 10), 1376 threeColorsMode: true, 1377 preview: this.vars.is_preview, 1378 params: this.vars.params, 1379 page: this.vars.page, 1380 floating_player: this.vars.floating_player, 1381 debug: this.vars.debug, 1382 disabledTimedPPV: this.isIOS && this.iOSVersion < 12, 1383 livePosterOptions: { 1384 offlineDefaultBackground: this.offlineDefaultBackground, 1385 offlineCustomBackground: this.offlineCustomBackground, 1386 offlineBox: this.offlineBox, 1387 posterSVG: this.posterSVG 1388 } 1389 }; 1390 }; 1391 this.iPlatformVideoData = function(videoID) { 1392 var head = this._d.getElementsByTagName('head')[0]; 1393 var script = this._d.createElement('script'); 1394 var id = typeof videoID !== "undefined" ? videoID : this.vars.clip_id; 1395 script.id = 'ajax_video_path'; 1396 script.src = this.services_entry + 'index.php?l=info&a=ajax_video_info&file=' + id + '&rid=' + this.vars.rid + '&page=' + this.vars.page + '&preview=' + this.vars.is_preview; 1397 head.appendChild(script); 1398 }; 1399 this.confirmClose = function() { 1400 if(this.html5_player_locked === true) this.buildVideoTag(this.services_entry + 'index.php?l=info&a=404', this.real_image_src); 1401 }; 1402 this.confirmComplete = function() { 1403 if(this.html5_player_locked === true) this.buildVideoTag(this.real_video_src, this.real_image_src); 1404 }; 1405 this.buildVideoTag = function(video_src, image_src) { 1406 var width = 0, height = 0; 1407 if(this.only_fs) { 1408 if(this.player_fullscreen_mode === 'FILL') { 1409 var windowSizes = this.getWindowSize(); 1410 width = windowSizes[0]; 1411 height = windowSizes[1]; 1412 } 1413 else { 1414 width = this.player_width; 1415 height = this.player_height; 1416 } 1417 } 1418 else { 1419 width = this.player_width; 1420 height = this.player_height; 1421 } 1422 1423 var html5_video_id = 'html5_video_' + this.vars.clip_id; 1424 var src = ' src="' + video_src + '"'; 1425 var type = ' type="video/flv"'; 1426 var autoplay = this.vars.pause != '1' ? ' autoplay="autoplay"' : ''; 1427 var loop = this.vars.repeat == '1' ? ' loop="loop"' : ''; 1428 var muted = this.vars.start_volume == '0' || this.vars.auto_play_type === 'mute' ? ' muted="muted"' : ''; 1429 //var poster = this.vars.pause == '1' && this.vars.start_img == '1' ? ' poster="' + image_src + '"' : ''; 1430 var poster = ' poster="' + image_src + '"'; 1431 //var controls = this.vars.no_controls != '1' ? ' controls="controls"' : ''; 1432 var controls = ' controls="controls"'; 1433 var preload = this.vars.prebuffer == '1' ? ' preload="auto"' : ''; 1434 var style = ' style="top: 0;left: 0;width: 100%;height: 100%;position: absolute;"'; 1435 var playsinline = this.isIOS ? ' playsinline' : ''; 1436 1437 var tag = '<video id="' + html5_video_id + '"' + src + autoplay + loop + muted + poster + controls + preload + playsinline + style + '><source' + src + type + '/>Your browser does not support the video tag.</video>'; 1438 if(this.only_fs || this.player_align != 'NONE') tag = '<a href="#" onclick="ClosePlayer(\'' + this.vars.rid + '\');return false;" style="position:absolute;display:block;width:20px;height:20px;text-align:center;line-height:20px;background:#222;color:#fff;top:0;right:0;z-index:1;">X</a>' + tag; 1439 this.player_instance = this.getObject(this.player_id); 1440 this.player_instance.innerHTML = tag; 1441 if(this.player_align != 'NONE') this.positionPlayer(); 1442 1443 this.html5_player_instance = this.getObject(html5_video_id); 1444 this.html5_player_locked = false; 1445 1446 if(this.vars.inlineIPhone === true && this.isIOS && typeof document.head.style.grid === 'undefined') { 1447 var that = this; 1448 var r=(this.staticCache===false?'?v='+(new Date().getTime()):''); 1449 1450 svpJSLoader.JS.load(this.site_root+'js/iphone-inline-video.min.js',r,function(){ 1451 var cssTag = document.createElement('style'); 1452 var css = '#' + html5_video_id + '.IIV::-webkit-media-controls-play-button,'; 1453 css += ' #' + html5_video_id + '.IIV::-webkit-media-controls-start-playback-button {' 1454 css += 'opacity: 0; pointer-events: none; width: 5px; }'; 1455 1456 cssTag.type = 'text/css'; 1457 if(cssTag.styleSheet) { 1458 cssTag.styleSheet.cssText = css; 1459 } else { 1460 cssTag.appendChild(document.createTextNode(css)); 1461 } 1462 1463 that.html5_player_instance.parentNode.insertBefore(cssTag, that.html5_player_instance); 1464 1465 makeVideoPlayableInline(that.html5_player_instance); 1466 1467 that.html5_player_instance.addEventListener('touchstart', function () { 1468 var isPlaying = !!(this.currentTime > 0 && !this.paused && !this.ended && this.readyState > 2); 1469 if(!isPlaying) { 1470 this.play(); 1471 } 1472 else { 1473 this.pause(); 1474 } 1475 }); 1476 },function(){alert('There is a problem with loading of iphone-inline-video library. Please try again in a few minutes.');}); 1477 } 1478 1479 this.executePlayerEvent('PLAYER.INITIALIZED', true); 1480 }; 1481 this.parseTemplate = function(data, template) { 1482 for(var key in data) { 1483 template = template.replace('%' + key + '%', data[key]); 1484 } 1485 return template; 1486 }; 1487 this.videoTagEmbed = function(video_src, image_src, event_data, live_video_data) { 1488 this.eventObject = {}; 1489 this.live_video = live_video_data.live_video === 1; 1490 if(this.live_video && live_video_data.is_started === 0) { 1491 var offlineBox = '';
1492 var offlineBackground = this.offlineDefaultBackground; 1493 1494 if(live_video_data.offline_overlay === 1) { 1495 var titleHeight = 32; 1496 var titleWidth = live_video_data.offline_title.length * titleHeight / 2; 1497 var subTitleHeight = 17; 1498 var subTitleWidth = live_video_data.offline_descr.length * subTitleHeight / 2; 1499 1500 var boxWidth = Math.max(titleWidth, subTitleWidth) + 20; 1501 var boxHeight = titleHeight + subTitleHeight + 30; 1502 var boxX = Math.ceil((this.player_width - boxWidth) / 2); 1503 var boxY = Math.ceil((this.player_height * 20) / 100); 1504 1505 offlineBox = this.parseTemplate({ 1506 boxWidth: boxWidth, 1507 boxHeight: boxHeight, 1508 boxX: boxX, 1509 boxY: boxY, 1510 titleY: boxY + titleHeight + 5, 1511 title: live_video_data.offline_title, 1512 subtitleY: boxY + titleHeight + 15 + subTitleHeight, 1513 description: live_video_data.offline_descr 1514 }, this.offlineBox); 1515 1516 if(image_src !== '') { 1517 var width = live_video_data.image_width; 1518 var height = live_video_data.image_height; 1519 var ratio = width / height; 1520 if(width > this.player_width) { 1521 width = this.player_width; 1522 height = Math.ceil(width / ratio); 1523 } 1524 if(height > this.player_height) { 1525 height = this.player_height; 1526 width = Math.ceil(height * ratio); 1527 } 1528 var x = Math.ceil((this.player_width - width) / 2); 1529 var y = Math.ceil((this.player_height - height) / 2); 1530 1531 offlineBackground = this.parseTemplate({ 1532 imageBase64: live_video_data.image_b64, 1533 width: width, 1534 height: height, 1535 x: x, 1536 y: y 1537 }, this.offlineCustomBackground); 1538 } 1539 } 1540 1541 if(image_src === '' || offlineBox !== '') { 1542 image_src = 'data:image/svg+xml;base64,' + Base64.encode(this.parseTemplate({ 1543 width: this.player_width, 1544 height: this.player_height, 1545 offlineBackground: offlineBackground, 1546 offlineBox: offlineBox 1547 }, this.posterSVG)); 1548 } 1549 } 1550 1551 if(this.vars.inlineIPhone && image_src === '') image_src = this.site_root + 'img/poster.jpg'; 1552 1553 if(event_data) { 1554 var eventDataParams = event_data.split(';'); 1555 for(var i = 0; i < eventDataParams.length; i++) { 1556 var paramData = eventDataParams[i].split('='); 1557 this.eventObject[paramData[0]] = paramData[1]; 1558 } 1559 this.real_video_src = video_src; 1560 this.real_image_src = image_src; 1561 var player_img = '<img src="'+image_src+'" width="'+this.player_width+'" height="'+this.player_height+'" border="0"/>'; 1562 this.getObject(this.player_id).innerHTML = player_img; 1563 this.html5_player_instance = null; 1564 this.html5_player_locked = true; 1565 this.executePlayerEvent('PLAYER.INITIALIZED', true); 1566 this.executePlayerEvent('TIMELINE.PPV', this.eventObject.params); 1567 } 1568 else { 1569 if(this.html5_player_instance !== null) { 1570 this.html5_player_instance.src = video_src; 1571 this.html5_player_instance.poster = image_src; 1572 } 1573 else { 1574 this.buildVideoTag(video_src, image_src); 1575 if(this.live_video && live_video_data.is_started === 1) { 1576 this.buildLiveIcon(); 1577 } 1578 } 1579 } 1580 1581 this.executePlayerEvent('PLAYER.CLIP_CHANGED', true); 1582 }; 1583 this.buildLiveIcon = function() { 1584 var live_icon = this.createElement('div','liveicon', 'liveicon_' + this.player_id, 'position:absolute; top:10px;right:10px;z-index:3;font-size:11px; font-family:Arial, Helvetica, sans-serif;font-weight:bold;text-shadow: 0px 0px 4px #666;color:#fff;'); 1585 1586 var red_dot = this.createElement('div','reddot', 'reddot_' + this.player_id, 'display:inline-block;margin-right:5px;width:9px;height:9px;background:#ff0000;border-radius:50%;box-shadow: 0px 0px 4px #666;'); 1587 1588 var liveText = document.createTextNode("Live"); 1589 1590 live_icon.appendChild(red_dot); 1591 live_icon.appendChild(liveText); 1592 1593 this.player_instance.appendChild(live_icon); 1594 }; 1595 this.setVisibilityInterval = function() { 1596 if(this.visibilityDelay <= 0 || this.visibilityInterval !== null) return false; 1597 var hidden = false; 1598 var thisObject = this; 1599 this.visibilityInterval = setInterval(function() { 1600 var instance = thisObject.back_player_instance !== null ? thisObject.back_player_instance : thisObject.player_instance; 1601 if(instance.parentNode !== null && typeof instance.registerJSEvent !== 'function') {
1602 if(!hidden) hidden = true; 1603 } 1604 else { 1605 if(hidden) { 1606 hidden = false; 1607 thisObject.registerEvents(); 1608 } 1609 } 1610 }, this.visibilityDelay); 1611 }; 1612 this.registerCachedEvents = function() { 1613 if(typeof this.eventStack === 'undefined') return false; 1614 var length = this.eventStack.length; 1615 if(length > 0) this.setVisibilityInterval(); 1616 for(var i = 0; i < length; i++) { 1617 this.registerJSEvent(this.eventStack[i]); 1618 } 1619 }; 1620 this.registerEvents = function() { 1621 for(var event in this.eventHandlers) { 1622 this.registerJSEvent(event); 1623 } 1624 }; 1625 this.initEvents = function() { 1626 var thisObject = this; 1627 this.eventInterval = setInterval(function() { 1628 thisObject.checkRegisterJSEvents(); 1629 }, 5); 1630 }; 1631 this.checkRegisterJSEvents = function() { 1632 if(this.player_instance !== null && typeof this.player_instance.registerJSEvent === 'function') { 1633 clearInterval(this.eventInterval); 1634 1635 this.registerCachedEvents(); 1636 this.executePlayerEvent('PLAYER.STARTED', true); 1637 } 1638 }; 1639 this.registerJSEvent = function(event) { 1640 var active = this.player_instance !== null && typeof this.player_instance.registerJSEvent === 'function'; 1641 if(this.eventHandlers[event].registered || !active) { 1642 return; 1643 } 1644 this.eventHandlers[event].registered = true; 1645 1646 this.player_instance.registerJSEvent(event, 'SvpPlayerInstances.instances[' + this.vars.rid + '].eventHandlers["' + event + '"].fireEvent'); 1647 }; 1648 this.onSuccessEmbed = function(self) { 1649 return function(e) { 1650 self.successEmbed(e); 1651 }; 1652 }(this); 1653 this.successEmbed = function(e) { 1654 this.flashActive = false; 1655 1656 if(e.success === true && typeof e.ref !== "undefined") { 1657 this.player_instance = e.ref; 1658 this.flashActive = true; 1659 } 1660 else { 1661 this.player_instance = this.getObject(this.player_id); 1662 1663 this.isMobile = this.isIOS || this.isAndroid; 1664 1665 if(this.isMobile) { 1666 this.iPlatformVideoData(); 1667 } 1668 else if(this.player_instance !== null) { 1669 this.player_instance.outerHTML = this.player_content_html; 1670 this.executePlayerEvent('PLAYER.INITIALIZED', true); 1671 } 1672 } 1673 1674 if(this.player_keep_state_on_resize && this.need_new_layer) { 1675 this.addListener(this._w, 'resize', this.onResize); 1676 } 1677 1678 if(this.flashActive === true) { 1679 this.initEvents(); 1680 } 1681 1682 if(this.use_existing_div && this.need_new_layer && this.player_align === 'NONE') { 1683 this.getObject(this.player_object_id).innerHTML = ''; 1684 } 1685 this.documentAppend = this.isMobile === false && !this.isIE && !this.isOpera && this.need_new_layer && !this.player_keep_state_on_scroll; 1686 if(this.documentAppend && !this.isHTML5Player) { 1687 this._d.documentElement.appendChild(this.player_instance); 1688 } 1689 1690 if(this.only_fs) { 1691 this.openFullscreen(); 1692 } 1693 else if(this.need_new_layer) { 1694 this.positionPlayer(); 1695 } 1696 if((this.only_fs || this.need_new_layer) && !this.player_keep_state_on_scroll) this.player_instance.style.zIndex = ++SvpPlayerIndexes + this.baseZindex; 1697 }; 1698 this.onDestroy = function(forceFlash) { 1699 this.isHTML5Player = !forceFlash; 1700 this.init(); 1701 if(this.vars.fs_popin === '1') OpenFullScreen(this.vars.rid); 1702 }; 1703 this.reinitialize = function(forceFlash) { 1704 var that = this; 1705 if(this.vars.fs_popin === '1') DoClosePlayer(this.vars.rid, function() { 1706 that.onDestroy(forceFlash); 1707 }); 1708 this.destroy(true, function() { 1709 that.onDestroy(forceFlash); 1710 }); 1711 }; 1712 this.destroy = function(removeInstance, callback) { 1713 if(this.player_instance === null) return; 1714 if(this.isPPV) svpDplayerUtils.PPV.destroy(this); 1715 if(this.isDownloadable) svpDplayerUtils.DL.destroy(this); 1716 1717 this.removeListener(this._w, 'load', this.onLoad); 1718 1719 if(this.player_keep_state_on_resize && this.need_new_layer) { 1720 this.removeListener(this._w, 'resize', this.onResize); 1721 } 1722 for(var event in this.eventHandlers) { 1723 delete this.eventHandlers[event].registered; 1724 } 1725 if(this.visibilityInterval !== null) { 1726 clearInterval(this.visibilityInterval); 1727 this.visibilityInterval = null; 1728 } 1729 if(this.eventInterval !== null) { 1730 clearInterval(this.eventInterval); 1731 this.eventInterval = null; 1732 } 1733 if(this.documentAppend && !this.isHTML5Player) { 1734 this._d.documentElement.removeChild(this.player_instance); 1735 } 1736 if(!this.isHTML5Player) { 1737 if(this.isMobile) this.player_instance.parentNode.removeChild(this.player_instance); 1738 else { 1739 SvpSwfObject.get().removeSWF(this.player_id); 1740 SvpSwfObject.destroy(); 1741 } 1742 } 1743 else { 1744 this.player_instance.destroy(callback); 1745 } 1746 if(this.static_div && this.auto_show) this._d.body.removeChild(this.static_div); 1747 1748 var object = this.getObject(this.player_object_id); 1749 if(object !== null && object.getAttribute('data-initialized') !== null) { 1750 object.removeAttribute('data-initialized'); 1751 } 1752 1753 if(removeInstance !== false) SvpPlayerInstances.removeInstance(this.vars.rid); 1754 this.player_instance = null; 1755 this.html5_player_instance = null; 1756 1757 if(!this.isHTML5Player && typeof callback === 'function') { 1758 callback(); 1759 } 1760 }; 1761 this.show = function() { 1762 if(this.backup_player_id !== null) return false;
1763 var player_object = this.getObject(this.player_id); 1764 player_object.style.display = ''; 1765 if(this.static_div) this.static_div.style.display = ''; 1766 this.backup_player_id = this.player_id; 1767 this.backup_player_content = player_object.innerHTML; 1768 this.player_id = 'layer_' + this.player_id; 1769 this.attributes = { 1770 id: this.player_id, 1771 name: this.player_id 1772 }; 1773 var player_content = this.createElement('div', this.player_id, this.player_id, 'width:' + this.player_width + 'px' + ';' + 'height:' + this.player_height + 'px' + ';'); 1774 player_content.innerHTML = this.backup_player_content; 1775 player_object.innerHTML = ''; 1776 player_object.appendChild(player_content); 1777 this.embedPlayer(); 1778 }; 1779 this.hide = function() { 1780 if(this.backup_player_id === null) return false; 1781 this.player_id = this.backup_player_id; 1782 this.attributes = { 1783 id: this.player_id, 1784 name: this.player_id 1785 }; 1786 var player_object = this.getObject(this.player_id); 1787 player_object.style.display = 'none'; 1788 if(this.static_div) this.static_div.style.display = 'none'; 1789 this.destroy(false); 1790 player_object.innerHTML = this.backup_player_content; 1791 this.backup_player_id = null; 1792 }; 1793 this.playerCommand = function(command) { 1794 if(this.player_instance === null || typeof this.player_instance.playerCommand !== 'function') { 1795 return; 1796 } 1797 1798 this.player_instance.playerCommand(command); 1799 }; 1800 this.playerSet = function(method, value) { 1801 if(this.player_instance === null || typeof this.player_instance[method] !== 'function') { 1802 return false; 1803 } 1804 1805 this.player_instance[method](value); 1806 1807 return true; 1808 }; 1809 this.playerGet = function(method) { 1810 if(this.player_instance === null || typeof this.player_instance[method] !== 'function') { 1811 return; 1812 } 1813 1814 return this.player_instance[method](); 1815 }; 1816 this.play = function() {this.playerCommand('play');}; 1817 this.pause = function() {this.playerCommand('pause');}; 1818 this.stop = function() {this.playerCommand('stop');}; 1819 this.toggle = function() {this.playerCommand('toggle');}; 1820 this.replay = function() {this.playerCommand('replay');};
1821 this.adjust = function() {this.playerCommand('adjust');}; 1822 this.toggleAudio = function() {this.playerCommand('toggle_audio');}; 1823 this.mute = function() {this.playerCommand('mute');}; 1824 this.unMute = function() {this.playerCommand('unmute');}; 1825 this.seekToAndPlay = function(seconds) {this.playerSet('playerSeekToAndPlay', seconds);}; 1826 this.seekToAndPause = function(seconds) {this.playerSet('playerSeekToAndPause', seconds);}; 1827 this.setVolume = function(volume) {this.playerSet('playerSetVolume', volume);}; 1828 this.loadVideo = function(videoID) { 1829 this.vars.clip_id = videoID; 1830 1831 if(this.isMobile) { 1832 this.iPlatformVideoData(videoID); 1833 } 1834 else if(this.getVideoID() !== videoID) { 1835 if(this.isPPV) svpDplayerUtils.PPV.destroy(this); 1836 if(this.isDownloadable) svpDplayerUtils.DL.destroy(this); 1837 if(this.playerSet('playerLoadVideo', videoID)) { 1838 this.executePlayerEvent('PLAYER.CLIP_CHANGED', true); 1839 } 1840 if(!this.isHTML5Player) { 1841 this.reinitialize(false); 1842 } 1843 } 1844 }; 1845 this.isPlaying = function() {return this.playerGet('get_isPlaying');}; 1846 this.isPaused = function() {return this.playerGet('get_isPaused');}; 1847 this.isComplete = function() {return this.playerGet('get_isComplete');}; 1848 this.getVideoID = function() {return this.playerGet('get_videoID');}; 1849 this.getStreamTime = function() {return this.playerGet('get_streamTime');}; 1850 this.getStreamDuration = function() {return this.playerGet('get_streamDuration');}; 1851 this.getVolume = function() {return this.playerGet('get_volume');}; 1852 this.isMuted = function() {return this.playerGet('get_isMuted');}; 1853 this.isLive = function() {return this.playerGet('get_isLive');}; 1854 this.addPlayerEventListener = function(event, eventHandler) { 1855 var registered = false; 1856 if(typeof this.eventHandlers === "undefined") this.eventHandlers = {}; 1857 if(typeof this.eventHandlers[event] === "undefined") this.eventHandlers[event] = {}; 1858 else registered = true; 1859 if(typeof this.eventHandlers[event].listeners === "undefined") this.eventHandlers[event].listeners = []; 1860 1861 this.eventHandlers[event].listeners.push(eventHandler); 1862 var thisEvent = event; 1863 var thisObject = this; 1864 if(typeof this.eventHandlers[event].fireEvent === "undefined") this.eventHandlers[event].fireEvent = function(args) { 1865 thisObject.executePlayerEvent(thisEvent, args); 1866 }; 1867 if(this.player_instance !== null && typeof this.player_instance.registerJSEvent === 'function') { 1868 if(!registered) { 1869 this.registerJSEvent(event); 1870 this.setVisibilityInterval(); 1871 } 1872 } 1873 else { 1874 var exists = false; 1875 if(typeof this.eventStack === "undefined") this.eventStack = []; 1876 for(var i = 0; i < this.eventStack.length; i++) { 1877 if(this.eventStack[i] === event) exists = true; 1878 } 1879 if(exists === false) this.eventStack.push(event); 1880 } 1881 }; 1882 this.removePlayerEventListener = function(event, eventHandler) { 1883 if(typeof this.eventHandlers === "undefined") return; 1884 if(typeof this.eventHandlers[event] === "undefined") return; 1885 if(typeof this.eventHandlers[event].listeners === "undefined") return; 1886 for(var i = 0; i < this.eventHandlers[event].listeners.length; i++) { 1887 if(this.eventHandlers[event].listeners[i] === eventHandler) { 1888 this.eventHandlers[event].listeners.splice(i); 1889 break; 1890 } 1891 } 1892 if(this.eventHandlers[event].listeners.length === 0) delete this.eventHandlers[event]; 1893 var empty = true; 1894 for(var k in this.eventHandlers) { 1895 empty = false; 1896 break; 1897 } 1898 if(empty && this.visibilityInterval !== null) { 1899 clearInterval(this.visibilityInterval); 1900 this.visibilityInterval = null; 1901 } 1902 }; 1903 this.execEvent = function(event, i, args) { 1904 var that = this; 1905 setTimeout(function() { 1906 if(typeof that.eventHandlers[event] !== 'undefined') that.eventHandlers[event].listeners[i](args,that,event); 1907 }, 0); 1908 }; 1909 this.executePlayerEvent = function(event, args) { 1910 if(typeof this.eventHandlers === "undefined") return; 1911 if(typeof this.eventHandlers[event] === "undefined") return; 1912 if(typeof this.eventHandlers[event].listeners === "undefined") return; 1913 for(var i = 0; typeof this.eventHandlers[event] !== 'undefined' && i < this.eventHandlers[event].listeners.length; i++){ 1914 this.execEvent(event,i,args); 1915 } 1916 }; 1917 1918 if(typeof vars !== "undefined") this.checkParsedVars(this.vars); 1919 if(typeof internal_params !== "undefined") this.checkParsedInternalParams(this.internal_params); 1920 this.bindPlayerEvents(this.defaultEventListeners); 1921 1922 if(typeof svpCurrentPage === 'undefined') { 1923 svpCurrentPage = decodeURIComponent(this.vars.page); 1924 } 1925 1926 this.isStickyExist = function() { 1927 return typeof StickyPlayerContainer !== 'undefined'; 1928 }; 1929 1930 this.isForSticky = function() { 1931 return !this.player_instance.vars.isPopin && this.isStickyExist(); 1932 }; 1933 1934 this.isStickyPlayer = function() { 1935 return StickyPlayerContainer.getInstanceById(this.vars.rid); 1936 }; 1937 1938 this.manageMessagePlayerActions = function(message, data) { 1939 this.player_instance[message] = data; 1940 1941 if(this.isForSticky() && this.isStickyPlayer()) { 1942 StickyPlayerContainer.manageMessagePlayerActions(message, data, this); 1943 } 1944 }; 1945} 1946function get_page() { 1947 return this.vars.page; 1948} 1949function OpenFullScreen(id) { 1950 var instance = SvpPlayerInstances.getInstance(id); 1951 if(typeof instance != "undefined") { 1952 if(instance.only_fs) { 1953 instance.embedPlayer(); 1954 } 1955 else { 1956 instance.openFullscreen(); 1957 } 1958 } 1959} 1960function ClosePlayer(id) { 1961 setTimeout(function() { 1962 DoClosePlayer(id); 1963 }, 50); 1964} 1965function DoClosePlayer(id, callback) { 1966 var instance = SvpPlayerInstances.getInstance(id); 1967 instance.executePlayerEvent('PLAYER.CLOSED', true); 1968 if(instance.only_fs) { 1969 var link = instance.getObject('svp_' + id); 1970 instance.closeFullscreen(); 1971 instance.destroy(false, callback); 1972 if(link !== null) link.focus(); 1973 } 1974 else if(typeof instance.vars.close_button !== "undefined" && instance.vars.close_button == 1) { 1975 if(!instance.auto_show) { 1976 instance.hide(); 1977 } 1978 else { 1979 instance.destroy(callback); 1980 } 1981 } 1982 else instance.closeFullscreen(); 1983} 1984function playerInitialize(id) { 1985 var instance = SvpPlayerInstances.getInstance(id); 1986 instance.registerEvents(); 1987} 1988function iPlatformFetchURL(id, video_src, image_src, event_data, live_video_data) { 1989 var instance = SvpPlayerInstances.getInstance(id); 1990 instance.videoTagEmbed(video_src, image_src, event_data, live_video_data); 1991} 1992if(typeof svpJSLoader === "undefined") { 1993 var svpJSLoader={}; 1994 svpJSLoader.JS=(function(){ 1995 var h,stack={},loaded=[],tr=0,mtr=5,tm=3000; 1996 function load(u,r,sC,eC,nt){ 1997 var lock=true; 1998 for(var i=0;i<loaded.length;i++){ 1999 if(loaded[i]===u){ 2000 sC();return false;
2001 } 2002 } 2003 if(nt===1) lock=false; 2004 else{ 2005 if(typeof stack[u]==='undefined'){ 2006 stack[u]=[]; 2007 lock=false; 2008 } 2009 stack[u].push({sC:sC,eC:eC}); 2010 } 2011 if(!lock) { 2012 var s=document.createElement('script'); 2013 s.id='svp_js_'+(new Date().getTime())+Math.floor((Math.random()*1000)); 2014 s.src=u+r; 2015 s.async=true; 2016 s.onload=s.onreadystatechange=function(){ 2017 if(!this.readyState||this.readyState==="loaded"||this.readyState==="complete"){ 2018 loaded.push(u); 2019 clearTimeout(t); 2020 s.onload=s.onreadystatechange=null; 2021 for(var i=0;i<stack[u].length;i++){ 2022 var ob=stack[u][i].sC; 2023 if(typeof ob!=='undefined') ob(); 2024 } 2025 delete stack[u]; 2026 } 2027 }; 2028 var t=setTimeout(function(){ 2029 clearTimeout(t); 2030 h.removeChild(s); 2031 if(tr<mtr){ 2032 tr++; 2033 svpJSLoader.JS.load(u,r,sC,eC,1); 2034 } 2035 else{ 2036 tr=0; 2037 for(var i=0;i<stack[u].length;i++){ 2038 var ob=stack[u][i].eC; 2039 if(typeof ob!=='undefined') ob(''); 2040 } 2041 delete stack[u]; 2042 } 2043 },tm); 2044 if(!h) h=document.getElementsByTagName('head')[0]; 2045 h.appendChild(s); 2046 } 2047 } 2048 return { 2049 load:load 2050 }; 2051 }()); 2052}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.