react-player
Version:
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion
2 lines • 5.57 kB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{30:function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return O}));var r=n(0),o=n.n(r),i=n(3),a=n(1);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function l(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){g(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return p(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function y(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function b(t,e){return(b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(t){var e=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(t){return!1}}();return function(){var n,r=v(t);if(e){var o=v(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return d(this,n)}}function d(t,e){return!e||"object"!==u(e)&&"function"!=typeof e?m(t):e}function m(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function g(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var O=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&b(t,e)}(c,t);var e,n,r,u=h(c);function c(){var t;s(this,c);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return g(m(t=u.call.apply(u,[this].concat(n))),"callPlayer",i.a),g(m(t),"onDurationChange",(function(){var e=t.getDuration();t.props.onDuration(e)})),g(m(t),"mute",(function(){t.callPlayer("setMuted",!0)})),g(m(t),"unmute",(function(){t.callPlayer("setMuted",!1)})),g(m(t),"ref",(function(e){t.container=e})),t}return e=c,(n=[{key:"componentDidMount",value:function(){this.props.onMount&&this.props.onMount(this)}},{key:"load",value:function(t){var e=this,n=this.props,r=n.controls,o=n.config,u=n.onError,c=n.playing,p=f(t.match(a.e),2)[1];this.player?this.player.load(p,{start:Object(i.f)(t),autoplay:c}):Object(i.b)("https://api.dmcdn.net/all.js","DM","dmAsyncInit",(function(t){return t.player})).then((function(n){if(e.container){var a=n.player;e.player=new a(e.container,{width:"100%",height:"100%",video:p,params:l({controls:r,autoplay:e.props.playing,mute:e.props.muted,start:Object(i.f)(t),origin:window.location.origin},o.params),events:{apiready:e.props.onReady,seeked:function(){return e.props.onSeek(e.player.currentTime)},video_end:e.props.onEnded,durationchange:e.onDurationChange,pause:e.props.onPause,playing:e.props.onPlay,waiting:e.props.onBuffer,error:function(t){return u(t)}}})}}),u)}},{key:"play",value:function(){this.callPlayer("play")}},{key:"pause",value:function(){this.callPlayer("pause")}},{key:"stop",value:function(){}},{key:"seekTo",value:function(t){this.callPlayer("seek",t)}},{key:"setVolume",value:function(t){this.callPlayer("setVolume",t)}},{key:"getDuration",value:function(){return this.player.duration||null}},{key:"getCurrentTime",value:function(){return this.player.currentTime}},{key:"getSecondsLoaded",value:function(){return this.player.bufferedTime}},{key:"render",value:function(){var t={width:"100%",height:"100%",display:this.props.display};return o.a.createElement("div",{style:t},o.a.createElement("div",{ref:this.ref}))}}])&&y(e.prototype,n),r&&y(e,r),c}(r.Component);g(O,"displayName","DailyMotion"),g(O,"canPlay",a.m.dailymotion),g(O,"loopOnEnded",!0)}}]);
//# sourceMappingURL=1.app.js.map