mediacms/static/js/media.js

1 line
209 KiB
JavaScript
Raw Normal View History

!function(){"use strict";var e={3921:function(e,t,n){var i={};n.r(i),n.d(i,{addMediaToPlaylist:function(){return se},addNewPlaylist:function(){return ce},copyEmbedMediaCode:function(){return ne},copyShareLink:function(){return te},createPlaylist:function(){return re},deleteComment:function(){return ae},dislikeMedia:function(){return $},likeMedia:function(){return X},loadMediaData:function(){return K},removeMedia:function(){return ie},removeMediaFromPlaylist:function(){return le},reportMedia:function(){return ee},submitComment:function(){return oe},undislikeMedia:function(){return Q},unlikeMedia:function(){return J}});var o=n(2667),a=(n(5101),n(5466)),r=(n(6116),n(9518)),s=n(3074),l=n.n(s),c=n(920),u=n.n(c),d=n(2276),p=n(2787),f=n(4426),m=n(3811);function h(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}n(2322),n(9268);var y=n(9688),b=n(5793),g=n(6983),v=n(9450);function w(e){return(w="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 _(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function E(e,t){return!t||"object"!==w(t)&&"function"!=typeof t?P(e):t}function P(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}new v.Z;var O=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&&k(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=C(i);if(o){var n=C(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return E(this,e)});function s(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),t=r.call(this,e);var n=d.Z.get("media-data");t.AudioPlayerData={},t.audioStartedPlaying=!1;var i=(0,y.U)(n.original_media_url,f.Z.get("config-site").url);t.videoSources=[{src:i,type:h(i)}],t.videoPoster=n.poster_url,t.videoPoster=t.videoPoster?t.videoPoster:n.thumbnail_url,t.videoPoster=t.videoPoster?(0,y.U)(t.videoPoster,f.Z.get("config-site").url):"",t.updatePlayerVolume=t.updatePlayerVolume.bind(P(t)),t.onAudioEnd=t.onAudioEnd.bind(P(t)),t.onAudioRestart=t.onAudioRestart.bind(P(t)),f.Z.on("switched_media_auto_play",t.onUpdateMediaAutoPlay.bind(P(t))),t.wrapperClick=t.wrapperClick.bind(P(t));var o=new v.Z;return o.update(d.Z.get("media-data").duration),t.durationISO8601=o.ISO8601(),t}return t=s,(n=[{key:"componentDidMount",value:function(){this.videoSources.length||console.warn("Audio DEBUG:","Audio file doesn't exist"),this.recommendedMedia=d.Z.get("media-data").related_media.length?new g.Z(d.Z.get("media-data").related_media,this.refs.AudioElem.parentNode,this.props.inEmbed):null,this.upNextLoaderView=!this.props.inEmbed&&d.Z.get("media-data").related_media.length?new b.Z(d.Z.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