Your IP : 3.137.198.0


Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/fileman/player/
Upload File :
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/fileman/player/fileman_player.min.js

(function(){BX.namespace("BX.Fileman");if(window.BX.Fileman.PlayerManager){return}BX.Fileman.PlayerManager={isStarted:false,players:[],playing:false,slider:null,addPlayer:function(t){this.players.push(t);this.bindPlayerEvents(t);if(t.autostart||t.lazyload){this.init()}},init:function(){if(this.isStarted){return}this.isStarted=true;BX.ready(BX.proxy(function(){BX.bind(window,"scroll",BX.throttle(BX.Fileman.PlayerManager.onScroll,300,BX.Fileman.PlayerManager));setTimeout(BX.delegate(BX.Fileman.PlayerManager.onScroll,BX.Fileman.PlayerManager),50);if(window!==window.top){if(BX.getClass("top.BX.SidePanel.Instance")){var t=top.BX.SidePanel.Instance.getSliderByWindow(window);if(t){this.slider=t;BX.addCustomEvent("SidePanel.Slider:onCloseComplete",BX.proxy(function(t){if(t.getSlider()===this.slider){for(var e in this.players){this.players[e].pause()}}},this))}}}},this))},bindPlayerEvents:function(t){var e=t.getEventList();if(e){for(var i=0;i<e.length;i++){BX.addCustomEvent(t,e[i],BX.proxy(function(t,e){BX.onCustomEvent(BX.Fileman.PlayerManager,"PlayerManager."+e,[t])},this))}}},onScroll:function(){if(this.players.length==0){return}var t=false;var e=false;for(var i in this.players){var s=this.players[i];if(!BX(s.id)){this.players.splice(i,1);continue}if(s.lazyload&&!s.inited){if(this.isVisibleOnScreen(s.id,2)){s.init()}}if(!s.autostart){continue}if(s.active){continue}if(s.isEnded()){continue}if(this.isVisibleOnScreen(s.id,1)){if(t===false){t=s}}else{if(s.isPlaying()){s.pause()}}if(s.isPlaying()){e=true}}if(e){return}if(t!==false){if(!t.inited){t.autostart=true}else if(t.isReady()&&!t.isEnded()){t.mute(true);BX.addCustomEvent(t,"Player:onClick",BX.proxy(t.disableMute,t));t.play()}}},getElementCoords:function(t){var e=.25;var i=BX(t).getBoundingClientRect();var s=i.bottom-i.top;var a=i.top+e*s;var r=i.bottom-e*s;var n=i.right-i.left;var o=i.left+e*n;var l=i.right-e*n;coords={top:a+window.pageYOffset,bottom:r+window.pageYOffset,left:o+window.pageXOffset,right:l+window.pageXOffset,originTop:a,originLeft:o,originBottom:r,originRight:l};return coords},isVisibleOnScreen:function(t,e){var i,s=false;var a=this.getElementCoords(t);var r=document.documentElement.clientHeight;var n=window.pageYOffset||document.documentElement.scrollTop;var o=n+r;if(e){e=parseInt(e)}if(e>1){n-=r*(e-1);o+=r*(e-1)}var l=a.top>n&&a.top<o;var h=a.bottom<o&&a.bottom>n;i=l||h;if(i&&e>1){return true}if(!i){return false}var y=BX(t);var u=a.originLeft+(a.originRight-a.originLeft)/2;var f=a.originTop+(a.originBottom-a.originTop)/2+20;var p=document.elementFromPoint(u,f);if(!!p){if(p===y||p.parentNode===y||p.parentNode.parentNode===y){s=true}}return i&&s},getPlayerById:function(t){if(!t){return null}for(var e in this.players){if(this.players[e].id===t){return this.players[e]}}return null}};BX.Fileman.Player=function(t,e){this.inited=false;this.id=t;this.hasStarted=false;this.fillParameters(e);BX.Fileman.PlayerManager.addPlayer(this);this.fireEvent("onCreate");BX.bind(BX(this.id),"click",BX.proxy(this.onClick,this));BX.bind(BX(this.id),"keydown",BX.proxy(this.onKeyDown,this))};BX.Fileman.Player.prototype.onClick=function(){var t=BX.findChildByClassName(this.getElement(),"vjs-play-control");if(t){t.focus()}this.active=true;this.fireEvent("onClick")};BX.Fileman.Player.prototype.isPlaying=function(){if(this.vjsPlayer){return this.vjsPlayer.isReady_&&!this.vjsPlayer.paused()}return false};BX.Fileman.Player.prototype.pause=function(){try{this.vjsPlayer.pause()}catch(t){}this.fireEvent("onPause")};BX.Fileman.Player.prototype.isEnded=function(){if(this.vjsPlayer){return this.vjsPlayer.ended()}return false};BX.Fileman.Player.prototype.isReady=function(){return this.vjsPlayer.isReady_};BX.Fileman.Player.prototype.play=function(){this.setPlayedState();this.hasStarted=true;try{this.vjsPlayer.play()}catch(t){}this.fireEvent("onPlay")};BX.Fileman.Player.prototype.setPlayedState=function(){var t=this.__getStorageHash();if(BX.localStorage){BX.localStorage.set(t,"played",1209600)}};BX.Fileman.Player.prototype.isPlayed=function(){var t=this.__getStorageHash();if(BX.localStorage){return BX.localStorage.get(t)==="played"}return true};BX.Fileman.Player.prototype.__getStorageHash=function(){var t=this.id;if(this.params.sources&&BX.type.isArray(this.params.sources)&&this.params.sources[0].src){t=this.params.sources[0].src}return"player_"+t};BX.Fileman.Player.prototype.getElement=function(){return BX(this.id)};BX.Fileman.Player.prototype.createElement=function(){var t=this.getElement();if(t){return t}if(!this.id){return null}var e="video";var i="video-js vjs-big-play-centered";if(this.isAudio){e="audio";i="video-js vjs-has-started"}if(this.skin){i+=" "+this.skin}var s={id:this.id,className:i,width:this.width,height:this.height,controls:true};if(this.muted){s["muted"]=true}t=BX.create(e,{attrs:s});if(this.params.sources){if(BX.type.isArray(this.params.sources)){for(var a in this.params.sources){if(!this.params.sources[a].src||!this.params.sources[a].type){continue}var r=BX.create("source",{attrs:{src:this.params.sources[a].src,type:this.params.sources[a].type}});BX.append(r,t)}}}return t};BX.Fileman.Player.prototype.fillParameters=function(t){this.autostart=t.autostart||false;this.hasFlash=t.hasFlash||false;if(t.playbackRate&&!t.hasFlash){t.playbackRate=parseFloat(t.playbackRate);if(t.playbackRate!=1){if(t.playbackRate<=0){t.playbackRate=1}if(t.playbackRate>3){t.playbackRate=3}}if(t.playbackRate!=1){this.playbackRate=t.playbackRate}}this.volume=t.volume||.8;this.playlistParams=t.playlistParams||false;this.startTime=t.startTime||0;this.wmvConfig=t.wmvConfig||false;this.onInit=t.onInit;this.lazyload=t.lazyload;this.skin=t.skin||"";this.isAudio=t.isAudio||false;t.width=t.width||400;if(this.isAudio){t.height=t.height||30}else{t.height=t.height||300}this.width=t.width;this.height=t.height;this.duration=t.duration||null;this.params=t;this.active=this.isPlayed()};BX.Fileman.Player.prototype.onKeyDown=function(t){if(t.which==32){this.onClick();if(this.isPlaying()){this.pause()}else{this.play()}t.preventDefault();t.stopPropagation();return false}this.fireEvent("onKeyDown")};BX.Fileman.Player.prototype.setSource=function(t){if(!t){return false}this.vjsPlayer.src(t);this.fireEvent("onSetSource")};BX.Fileman.Player.prototype.getSource=function(){return this.vjsPlayer.src()};BX.Fileman.Player.prototype.init=function(){this.fireEvent("onBeforeInit");if(videojs.players[this.id]){delete videojs.players[this.id]}this.vjsPlayer=videojs(this.id,this.params);this.vjsPlayer.on("error",BX.proxy(function(){if(BX.type.isArray(this.params.sources)&&this.params.sources.length>1){for(var t in this.params.sources){if(this.params.sources.hasOwnProperty(t)){if(this.getAbsoluteURL(this.params.sources[t].src)===this.getSource()&&this.params.sources.length>t+1&&this.previousTrack!==this.getSource()){this.previousTrack=this.getSource();this.setSource(this.params.sources[parseInt(t+1)]);return}}}}this.fireEvent("onError");if(!this.isFlashErrrorShown&&this.hasFlash){this.isFlashErrrorShown=true;var e=this.vjsPlayer.error();if(e&&e.code===4){e.message=e.message+". "+BX.message("PLAYER_FLASH_CHECK");this.vjsPlayer.errorDisplay.content(e.message)}}},this));if(this.hasFlash){setTimeout(BX.proxy(function(){if(!this.inited){this.vjsPlayer.error(BX.message("PLAYER_FLASH_REQUIRED"));this.inited=true}},this),3e3)}this.vjsPlayer.ready(BX.proxy(function(){var t=BX.findChildByClassName(BX(this.id),"vjs-play-control");if(t){t.addEventListener("click",BX.proxy(this.onClick,this))}this.vjsPlayer.volume(this.volume);if(this.duration>0){this.vjsPlayer.one("loadedmetadata",BX.proxy(function(){this.vjsPlayer.duration(this.duration)},this))}this.vjsPlayer.one("play",BX.proxy(function(){if(this.playbackRate!=1){this.vjsPlayer.playbackRate(this.playbackRate)}if(this.volume){this.vjsPlayer.volume(this.volume)}if(this.startTime>0){try{this.vjsPlayer.currentTime(this.startTime);var t=BX.findChild(BX(this.id),{class:"vjs-loading-spinner"},false);if(t){t.remove()}}catch(t){}}this.vjsPlayer.on("volumechange",BX.proxy(function(){this.active=true},this))},this));if(this.playlistParams){this.vjsPlayer.playlist(this.playlistParams)}if(this.wmvConfig){this.vjsPlayer.wmvConfig=this.wmvConfig}this.inited=true;if(BX.type.isFunction(this.onInit)){this.onInit(this)}this.fireEvent("onAfterInit");this.proxyEvents();if(this.autostart&&!this.lazyload){setTimeout(BX.proxy(function(){if(!this.hasStarted){this.play()}},this),200)}},this),true)};BX.Fileman.Player.prototype.getEventList=function(){return["Player:onBeforeInit","Player:onAfterInit","Player:onCreate","Player:onSetSource","Player:onKeyDown","Player:onPlay","Player:onPause","Player:onClick","Player:onError","Player:onEnded"]};BX.Fileman.Player.prototype.fireEvent=function(t){if(BX.type.isNotEmptyString(t)){t="Player:"+t;BX.onCustomEvent(this,t,[this,t])}};BX.Fileman.Player.prototype.mute=function(t){return this.vjsPlayer.muted(t)};BX.Fileman.Player.prototype.disableMute=function(){BX.removeCustomEvent(this,"Player:onClick",BX.proxy(this.disableMute,this));setTimeout(BX.proxy(function(){this.mute(false)},this),100)};BX.Fileman.Player.prototype.proxyEvents=function(){if(!this.inited){return}this.vjsPlayer.on("play",BX.proxy(function(){this.fireEvent("onPlay");this.hasStarted=true},this));this.vjsPlayer.on("pause",BX.proxy(function(){this.fireEvent("onPause")},this));this.vjsPlayer.on("ended",BX.proxy(function(){this.fireEvent("onEnded")},this))};BX.Fileman.Player.prototype.getAbsoluteURL=function(t){if(!t.match(/^https?:\/\//)){var e=document.createElement("div");e.innerHTML='<a href="'+t+'">x</a>';t=e.firstChild.href}return t}})(window);
//# sourceMappingURL=fileman_player.map.js