import{g as e,r as t}from"./vendor-CZtH_kdS.js";import{u as r,a}from"./index-Re8qxHhK.js";function o(e,t){for(var r=0;r<t.length;r++){const a=t[r];if("string"!=typeof a&&!Array.isArray(a))for(const t in a)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(a,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var s=Object.create,n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,p=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty,u=(e,t,r,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of i(t))y.call(e,o)||o===r||n(e,o,{get:()=>t[o],enumerable:!(a=l(t,o))||a.enumerable});return e},d=(e,t,r)=>(((e,t,r)=>{t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),c={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(c,{default:()=>g});var h,m=(h=c,u(n({},"__esModule",{value:!0}),h)),f=((e,t,r)=>(r=null!=e?s(p(e)):{},u(e&&e.__esModule?r:n(r,"default",{value:e,enumerable:!0}),e)))(t),P=r,b=a;class g extends f.Component{constructor(){super(...arguments),d(this,"callPlayer",P.callPlayer),d(this,"mute",()=>{this.setVolume(0)}),d(this,"unmute",()=>{null!==this.props.volume&&this.setVolume(this.props.volume)}),d(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{playing:t,config:r,onError:a,onDuration:o}=this.props,s=e&&e.match(b.MATCH_URL_VIDYARD)[1];this.player&&this.stop(),(0,P.getSDK)("https://play.vidyard.com/embed/v4.js","VidyardV4","onVidyardAPI").then(e=>{this.container&&(e.api.addReadyListener((e,t)=>{this.player||(this.player=t,this.player.on("ready",this.props.onReady),this.player.on("play",this.props.onPlay),this.player.on("pause",this.props.onPause),this.player.on("seek",this.props.onSeek),this.player.on("playerComplete",this.props.onEnded))},s),e.api.renderPlayer({uuid:s,container:this.container,autoplay:t?1:0,...r.options}),e.api.getPlayerMetadata(s).then(e=>{this.duration=e.length_in_seconds,o(e.length_in_seconds)}))},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){window.VidyardV4.api.destroyPlayer(this.player)}seekTo(e,t=!0){this.callPlayer("seek",e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setPlaybackRate(e){this.callPlayer("setPlaybackSpeed",e)}getDuration(){return this.duration}getCurrentTime(){return this.callPlayer("currentTime")}getSecondsLoaded(){return null}render(){const{display:e}=this.props,t={width:"100%",height:"100%",display:e};return f.default.createElement("div",{style:t},f.default.createElement("div",{ref:this.ref}))}}d(g,"displayName","Vidyard"),d(g,"canPlay",b.canPlay.vidyard);const v=o({__proto__:null,default:e(m)},[m]);export{v as V};
