mediacms/static/js/media.js

1 line
156 KiB
JavaScript
Raw Normal View History

!function(){var e,t={3683:function(e,t,n){"use strict";var r=n(92541),a=(n(62322),n(49268),n(79006),n(55090),n(25101),n(13080),n(52004),n(28407),n(56394),n(38288),n(55677),n(92129),n(24655),n(35466)),i=n(43613),o=n(98578);function l(){return a.createElement("div",{className:"player-container viewer-attachment-container"},a.createElement("div",{className:"player-container-inner"},a.createElement("span",null,a.createElement("span",null,a.createElement("i",{className:"material-icons"},"insert_drive_file")))))}var s=n(3074),u=n.n(s),c=n(18009),d=n.n(c),m=n(80473),f=n(20541),p=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 r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}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,r,l,s=(r=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(r);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 r=(0,m.formatInnerLink)(n.original_media_url,i.SiteContext._currentValue.url);t.videoSources=[{src:r,type:y(r)}],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 a=new p.MediaDurationInfo;return a.update(o.MediaPageStore.get("media-data").duration),t.durationISO8601=a.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 p.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 p.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:"componentWillUnmou