(globalThis.webpackChunkacademy=globalThis.webpackChunkacademy||[]).push([[328],{9348:(e,t,a)=>{var r,o=Object.create,s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,l=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,u=(e,t,a,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of i(t))p.call(e,o)||o===a||s(e,o,{get:()=>t[o],enumerable:!(r=n(t,o))||r.enumerable});return e},h=(e,t,a)=>(((e,t,a)=>{t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a})(e,"symbol"!=typeof t?t+"":t,a),a),c={};((e,t)=>{for(var a in t)s(e,a,{get:t[a],enumerable:!0})})(c,{default:()=>g}),e.exports=(r=c,u(s({},"__esModule",{value:!0}),r));var y=((e,t,a)=>(a=null!=e?o(l(e)):{},u(e&&e.__esModule?a:s(a,"default",{value:e,enumerable:!0}),e)))(a(1609)),d=a(5635),m=a(327);class g extends y.Component{constructor(){super(...arguments),h(this,"callPlayer",d.callPlayer),h(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),h(this,"mute",()=>{this.callPlayer("setMuted",!0)}),h(this,"unmute",()=>{this.callPlayer("setMuted",!1)}),h(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{controls:t,config:a,onError:r,playing:o}=this.props,[,s]=e.match(m.MATCH_URL_DAILYMOTION);this.player?this.player.load(s,{start:(0,d.parseStartTime)(e),autoplay:o}):(0,d.getSDK)("https://api.dmcdn.net/all.js","DM","dmAsyncInit",e=>e.player).then(o=>{if(!this.container)return;const n=o.player;this.player=new n(this.container,{width:"100%",height:"100%",video:s,params:{controls:t,autoplay:this.props.playing,mute:this.props.muted,start:(0,d.parseStartTime)(e),origin:window.location.origin,...a.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:e=>r(e)}})},r)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,t=!0){this.callPlayer("seek",e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){const{display:e}=this.props,t={width:"100%",height:"100%",display:e};return y.default.createElement("div",{style:t},y.default.createElement("div",{ref:this.ref}))}}h(g,"displayName","DailyMotion"),h(g,"canPlay",m.canPlay.dailymotion),h(g,"loopOnEnded",!0)}}]);