mediacms/static/js/media.js

1 wiersz
148 KiB
JavaScript
Czysty Zwykły widok Historia

2022-03-23 17:04:59 +00:00
!function(){var e,t={5122:function(e,t,n){"use strict";var a=n(2541),r=(n(2322),n(9268),n(9006),n(5090),n(5101),n(3080),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(5466)),i=n(3613),o=n(8578);function l(){return r.createElement("div",{className:"player-container viewer-attachment-container"},r.createElement("div",{className:"player-container-inner"},r.createElement("span",null,r.createElement("span",null,r.createElement("i",{className:"material-icons"},"insert_drive_file")))))}var s=n(3074),u=n.n(s),c=n(8009),d=n.n(c),m=n(473),p=n(541),f=n(9722);function y(e){var t=null,n=e.split(".");if(n.length)switch(n=n[n.length-1]){case"webm":t="audio/webm";break;case"flac":t="audio/flac";break;case"wave":t="audio/wave";break;case"wav":t="audio/wav";break;case"ogg":case"ogg":t="audio/ogg";break;case"mp3":case"mpeg":t="audio/mpeg"}return t}var h=n(1283);function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?w(e):t}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var P=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(u,e);var t,n,a,l,s=(a=u,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=E(a);if(l){var n=E(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return S(this,e)});function u(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),t=s.call(this,e);var n=o.MediaPageStore.get("media-data");t.AudioPlayerData={},t.audioStartedPlaying=!1;var a=(0,m.formatInnerLink)(n.original_media_url,i.SiteContext._currentValue.url);t.videoSources=[{src:a,type:y(a)}],t.videoPoster=n.poster_url,t.videoPoster=t.videoPoster?t.videoPoster:n.thumbnail_url,t.videoPoster=t.videoPoster?(0,m.formatInnerLink)(t.videoPoster,i.SiteContext._currentValue.url):"",t.updatePlayerVolume=t.updatePlayerVolume.bind(w(t)),t.onAudioEnd=t.onAudioEnd.bind(w(t)),t.onAudioRestart=t.onAudioRestart.bind(w(t)),o.PageStore.on("switched_media_auto_play",t.onUpdateMediaAutoPlay.bind(w(t))),t.wrapperClick=t.wrapperClick.bind(w(t));var r=new f.MediaDurationInfo;return r.update(o.MediaPageStore.get("media-data").duration),t.durationISO8601=r.ISO8601(),t}return t=u,(n=[{key:"componentDidMount",value:function(){this.videoSources.length||h.warn("Audio DEBUG:","Audio file doesn't exist"),this.recommendedMedia=o.MediaPageStore.get("media-data").related_media.length?new f.PlayerRecommendedMedia(o.MediaPageStore.get("media-data").related_media,this.refs.AudioElem.parentNode,this.props.inEmbed):null,this.upNextLoaderView=!this.props.inEmbed&&o.MediaPageStore.get("media-data").related_media.length?new f.UpNextLoaderView(o.MediaPageStore.get("media-data").related_media[0]):null,document.hasFocus()||"visible"===document.visibilityState?this.initPlayerInstance():(this.initPlayerInstance=this.initPlayerInstance.bind(this),window.addEventListener("focus",this.initPlayerInstance),document.addEventListener("visibilitychange",this.initPlayerInstance))}},{key:"componentWillUnmount",value:function(){t