@vouchfor/embeds 0.0.0-experiment.4e05d59 → 0.0.0-experiment.6d362ba
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/iife/embeds.iife.js
CHANGED
@@ -1260,7 +1260,7 @@ var embeds=function(nt){"use strict";var mm=Object.defineProperty;var vm=(nt,Et,
|
|
1260
1260
|
vmp-captions.hiddenControls {
|
1261
1261
|
transform: translateY(calc(var(--space-small) * -1));
|
1262
1262
|
}
|
1263
|
-
`],Ue([N({type:Boolean})],Re.prototype,"loading",2),Ue([N({type:Boolean})],Re.prototype,"playing",2),Ue([N({type:Number})],Re.prototype,"volume",2),Ue([N({type:Boolean})],Re.prototype,"muted",2),Ue([N({type:Number})],Re.prototype,"currentTime",2),Ue([N({type:Number})],Re.prototype,"duration",2),Ue([N({type:Array,attribute:!1})],Re.prototype,"levels",2),Ue([N({type:Number})],Re.prototype,"level",2),Ue([N({type:Number})],Re.prototype,"playbackRate",2),Ue([N({type:String})],Re.prototype,"caption",2),Ue([N({type:Array})],Re.prototype,"buffer",2),Ue([N({type:Boolean})],Re.prototype,"captions",2),Ue([N({type:Boolean})],Re.prototype,"fullscreen",2),Ue([N({type:Array})],Re.prototype,"controls",2),Ue([Ne()],Re.prototype,"showControls",2),Re=Ue([Fe("vmp-player-overlay")],Re);var hp=Object.defineProperty,up=Object.getOwnPropertyDescriptor,Ie=(r,e,t,i)=>{for(var s=i>1?void 0:i?up(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&hp(e,t,s),s};let xe=class extends le{constructor(){super(...arguments),this.parts=[],this.resolution=1080,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.burnCaptions=!1,this.frameRate=30,this.transitionDuration=1/3,this.compilation=Yt,this.sceneGenerator=ro,this._sceneController=new bg(this),this._videoController=new Tg(this),this._drawController=new Ag(this),this._wasPlaying=!1,this._manualMute=this.muted,this._seekerRAF=null,this._lastWaiting=!1,this._lastTimestamp=null,this._lastTimeUpdate=null,this._playerRef=Ze(),this._canvasRef=Ze(),this.processing=!0,this._aspectRatio=this.propAspectRatio,this._waiting=!1,this._stalled=!1,this._seeking=!1,this._captions=!1,this._fullscreen=!1,this._paused=!0,this._playbackRate=1,this._volume=null,this._muted=null,this._videoResolution=-1,this._handleContainerResize=()=>{this._playerRef.value&&(this.propAspectRatio||(this._aspectRatio=this._playerRef.value.offsetWidth/this._playerRef.value.offsetHeight))},this._handleCanvasResize=()=>{this.draw()},this._syncCurrentTime=()=>{this.videos&&this.scene.video&&(this._drawController.currentTime=this.scene.start+(this.videos[this.scene.video.id].video.currentTime-this.scene.video.start))},this._seeker=r=>{this.scenes.length>0&&(this._waiting=this._drawController.activeScenes.some(({id:e,video:t})=>{var i;if(t){const s=(i=this._videoController.videoState)==null?void 0:i[e];return!s||!s.initialised||s.waiting}}),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),!this.stalled&&r-(this._lastTimestamp??0)>1e3/this.frameRate&&(this._drawController.currentTime=this._drawController.currentTime+(r-(this._lastTimestamp??r))/1e3*this.playbackRate,this._lastTimestamp=r),this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))),this.paused||(this.scene.video?this._lastTimeUpdate&&r-this._lastTimeUpdate>1e3&&(this._stalled=!0):this._stalled=!1,this._seekerRAF=requestAnimationFrame(this._seeker))},this._handleFullscreenChange=()=>{document.fullscreenElement?this._fullscreen=!0:this._fullscreen=!1}}get aspectRatio(){return this._aspectRatio}get waiting(){return!this.paused&&this._waiting}get stalled(){return this._stalled}get seeking(){return this._seeking}get captions(){return this._captions}get fullscreen(){return this._fullscreen}get duration(){return this._sceneController.duration}get scene(){return this._drawController.activeScenes[this._drawController.activeScenes.length-1]}get scenes(){return this._sceneController.scenes??[]}get videos(){return this._videoController.videos}get videoState(){return this._videoController.videoState}set paused(r){r!==this._paused&&(this._paused=r,this.requestUpdate(),this.dispatchEvent(new CustomEvent(r?"pause":"play")))}get paused(){return this._paused}set playbackRate(r){r!==this._playbackRate&&(this._playbackRate=r,Object.keys(this.videos??{}).forEach(e=>{this.videos&&(this.videos[e].video.playbackRate=r)}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:r})))}get playbackRate(){return this._playbackRate}set volume(r){const e=Math.min(1,Math.max(0,r));e!==this._volume&&(Object.keys(this.videos??{}).forEach(t=>{this.videos&&(this.videos[t].video.volume=e)}),localStorage.setItem("vmp-player-volume",e.toString()),this._volume=e,e>0&&(this.muted=!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:r})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(r){Object.keys(this.videos??{}).forEach(e=>{this.videos&&(this.videos[e].video.muted=r)}),r!==this._muted&&(this._muted=r,localStorage.setItem("vmp-player-muted",r.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:r?0:this.volume})))}get muted(){return this._muted??(this._muted=localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(r){r!==this._videoResolution&&(this._videoResolution=r,Object.keys(this.videos??{}).forEach(e=>{if(this.videos){const t=this.videos[e].hls;if(t){const i=t==null?void 0:t.levels.findIndex(s=>Math.min(s.height,s.width)===r);t.currentLevel=i??-1}}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(r){r!==this._drawController.currentTime&&(this._drawController.currentTime=r,this._videoController.setVideosCurrentTime(r))}get currentTime(){return this._drawController.currentTime}reset(r=0,e=!1){this._lastTimestamp=null,this._drawController.currentTime=r,this._videoController.setVideosCurrentTime(r),e?this.play():this.pause()}clear(){this._drawController.clear()}play(){this.paused=!1,this._lastTimestamp=null,this.duration>0&&this._drawController.currentTime>=this.duration&&this.reset(0,!0),this._seekerRAF||(this._seekerRAF=requestAnimationFrame(this._seeker))}pause(){this._seekerRAF&&(cancelAnimationFrame(this._seekerRAF),this._seekerRAF=null),this.paused=!0,Object.keys(this.videos??{}).forEach(r=>{this.videos&&this.videos[r].video.pause()})}draw(r){return this._drawController.draw(r)}setScene(r){var e;const t=(e=this.scenes)==null?void 0:e[r];if(!t)return this.dispatchEvent(new ErrorEvent("error",new Error(`No scene at index: ${r}`)));this.reset(t.start+this.transitionDuration,!this.paused)}toggleFullscreen(r){r??this.fullscreen?Sg():this._playerRef.value&&Eg(this._playerRef.value)}connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this._handleFullscreenChange),this.addEventListener("video:timeupdate",r=>{this._stalled=!1,this._lastTimeUpdate=r.timeStamp,this._syncCurrentTime()})}willUpdate(r){this.propAspectRatio&&(this._aspectRatio=this.propAspectRatio),r.has("parts")&&(this.clear(),this.processing=!0),r.has("processing")&&!this.processing&&this.autoplay&&this.play(),r.has("transitionDuration")&&fc()&&(this.transitionDuration=0)}updated(r){r.has("_stalled")&&this.stalled&&this.dispatchEvent(new CustomEvent("stalled")),r.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange)}render(){var r,e,t,i,s,n;const o=this.loading||this.processing||this.duration<=0,{height:a,width:l}=Mi({resolution:this.resolution,aspectRatio:this.aspectRatio}),c=Object.keys(this._videoController.videoState??{}).reduce((p,m)=>{var A;return p.concat(((A=this._videoController.videoState)==null?void 0:A[m].buffered)??[])},[...this._drawController.fakeBufferSegments]),d=o?[]:(r=this.controls??Qs)==null?void 0:r.filter(p=>!(p==="fullscreen"&&fc()||p==="navigation"&&(!this.scenes||this.scenes.length<=1))),h=(((e=this.scenes)==null?void 0:e.length)??0)-1,u=((t=this.scenes)==null?void 0:t.findIndex(p=>p===this._drawController.activeScenes[0]))??0,f=(i=this._drawController.activeScenes[0])==null?void 0:i.id,g=(n=(s=this.videos)==null?void 0:s[f])==null?void 0:n.hls;return te`
|
1263
|
+
`],Ue([N({type:Boolean})],Re.prototype,"loading",2),Ue([N({type:Boolean})],Re.prototype,"playing",2),Ue([N({type:Number})],Re.prototype,"volume",2),Ue([N({type:Boolean})],Re.prototype,"muted",2),Ue([N({type:Number})],Re.prototype,"currentTime",2),Ue([N({type:Number})],Re.prototype,"duration",2),Ue([N({type:Array,attribute:!1})],Re.prototype,"levels",2),Ue([N({type:Number})],Re.prototype,"level",2),Ue([N({type:Number})],Re.prototype,"playbackRate",2),Ue([N({type:String})],Re.prototype,"caption",2),Ue([N({type:Array})],Re.prototype,"buffer",2),Ue([N({type:Boolean})],Re.prototype,"captions",2),Ue([N({type:Boolean})],Re.prototype,"fullscreen",2),Ue([N({type:Array})],Re.prototype,"controls",2),Ue([Ne()],Re.prototype,"showControls",2),Re=Ue([Fe("vmp-player-overlay")],Re);var hp=Object.defineProperty,up=Object.getOwnPropertyDescriptor,Ie=(r,e,t,i)=>{for(var s=i>1?void 0:i?up(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&hp(e,t,s),s};let xe=class extends le{constructor(){super(...arguments),this.parts=[],this.resolution=1080,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.burnCaptions=!1,this.frameRate=30,this.transitionDuration=1/3,this.compilation=Yt,this.sceneGenerator=ro,this._sceneController=new bg(this),this._videoController=new Tg(this),this._drawController=new Ag(this),this._wasPlaying=!1,this._manualMute=this.muted,this._seekerRAF=null,this._lastWaiting=!1,this._lastTimestamp=null,this._lastTimeUpdate=null,this._playerRef=Ze(),this._canvasRef=Ze(),this.processing=!0,this._aspectRatio=this.propAspectRatio,this._waiting=!1,this._stalled=!1,this._seeking=!1,this._captions=!1,this._fullscreen=!1,this._paused=!0,this._playbackRate=1,this._volume=null,this._muted=null,this._videoResolution=-1,this._handleContainerResize=()=>{this._playerRef.value&&(this.propAspectRatio||(this._aspectRatio=this._playerRef.value.offsetWidth/this._playerRef.value.offsetHeight))},this._handleCanvasResize=()=>{this.draw()},this._syncCurrentTime=()=>{this.videos&&this.scene.video&&(this._drawController.currentTime=this.scene.start+(this.videos[this.scene.video.id].video.currentTime-this.scene.video.start))},this._seeker=r=>{this.scenes.length>0&&(this._waiting=this._drawController.activeScenes.some(({id:e,video:t})=>{var i;if(t){const s=(i=this._videoController.videoState)==null?void 0:i[e];return!s||!s.initialised||s.waiting}}),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),!this.stalled&&r-(this._lastTimestamp??0)>1e3/this.frameRate&&(this._drawController.currentTime=this._drawController.currentTime+(r-(this._lastTimestamp??r))/1e3*this.playbackRate,this._lastTimestamp=r),this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))),this.paused||(this.scene.video?this._lastTimeUpdate&&r-this._lastTimeUpdate>1e3&&(this._stalled=!0):(this._stalled=!1,this._lastTimeUpdate=r),this._seekerRAF=requestAnimationFrame(this._seeker))},this._handleFullscreenChange=()=>{document.fullscreenElement?this._fullscreen=!0:this._fullscreen=!1}}get aspectRatio(){return this._aspectRatio}get waiting(){return!this.paused&&this._waiting}get stalled(){return this._stalled}get seeking(){return this._seeking}get captions(){return this._captions}get fullscreen(){return this._fullscreen}get duration(){return this._sceneController.duration}get scene(){return this._drawController.activeScenes[this._drawController.activeScenes.length-1]}get scenes(){return this._sceneController.scenes??[]}get videos(){return this._videoController.videos}get videoState(){return this._videoController.videoState}set paused(r){r!==this._paused&&(this._paused=r,this.requestUpdate(),this.dispatchEvent(new CustomEvent(r?"pause":"play")))}get paused(){return this._paused}set playbackRate(r){r!==this._playbackRate&&(this._playbackRate=r,Object.keys(this.videos??{}).forEach(e=>{this.videos&&(this.videos[e].video.playbackRate=r)}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:r})))}get playbackRate(){return this._playbackRate}set volume(r){const e=Math.min(1,Math.max(0,r));e!==this._volume&&(Object.keys(this.videos??{}).forEach(t=>{this.videos&&(this.videos[t].video.volume=e)}),localStorage.setItem("vmp-player-volume",e.toString()),this._volume=e,e>0&&(this.muted=!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:r})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(r){Object.keys(this.videos??{}).forEach(e=>{this.videos&&(this.videos[e].video.muted=r)}),r!==this._muted&&(this._muted=r,localStorage.setItem("vmp-player-muted",r.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:r?0:this.volume})))}get muted(){return this._muted??(this._muted=localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(r){r!==this._videoResolution&&(this._videoResolution=r,Object.keys(this.videos??{}).forEach(e=>{if(this.videos){const t=this.videos[e].hls;if(t){const i=t==null?void 0:t.levels.findIndex(s=>Math.min(s.height,s.width)===r);t.currentLevel=i??-1}}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(r){r!==this._drawController.currentTime&&(this._drawController.currentTime=r,this._videoController.setVideosCurrentTime(r))}get currentTime(){return this._drawController.currentTime}reset(r=0,e=!1){this._lastTimestamp=null,this._drawController.currentTime=r,this._videoController.setVideosCurrentTime(r),e?this.play():this.pause()}clear(){this._drawController.clear()}play(){this.paused=!1,this._lastTimestamp=null,this.duration>0&&this._drawController.currentTime>=this.duration&&this.reset(0,!0),this._seekerRAF||(this._seekerRAF=requestAnimationFrame(this._seeker))}pause(){this._seekerRAF&&(cancelAnimationFrame(this._seekerRAF),this._seekerRAF=null),this.paused=!0,Object.keys(this.videos??{}).forEach(r=>{this.videos&&this.videos[r].video.pause()})}draw(r){return this._drawController.draw(r)}setScene(r){var e;const t=(e=this.scenes)==null?void 0:e[r];if(!t)return this.dispatchEvent(new ErrorEvent("error",new Error(`No scene at index: ${r}`)));this.reset(t.start+this.transitionDuration,!this.paused)}toggleFullscreen(r){r??this.fullscreen?Sg():this._playerRef.value&&Eg(this._playerRef.value)}connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this._handleFullscreenChange),this.addEventListener("video:timeupdate",r=>{this._stalled=!1,this._lastTimeUpdate=r.timeStamp,this._syncCurrentTime()})}willUpdate(r){this.propAspectRatio&&(this._aspectRatio=this.propAspectRatio),r.has("parts")&&(this.clear(),this.processing=!0),r.has("processing")&&!this.processing&&this.autoplay&&this.play(),r.has("transitionDuration")&&fc()&&(this.transitionDuration=0)}updated(r){r.has("_stalled")&&this.stalled&&this.dispatchEvent(new CustomEvent("stalled")),r.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange)}render(){var r,e,t,i,s,n;const o=this.loading||this.processing||this.duration<=0,{height:a,width:l}=Mi({resolution:this.resolution,aspectRatio:this.aspectRatio}),c=Object.keys(this._videoController.videoState??{}).reduce((p,m)=>{var A;return p.concat(((A=this._videoController.videoState)==null?void 0:A[m].buffered)??[])},[...this._drawController.fakeBufferSegments]),d=o?[]:(r=this.controls??Qs)==null?void 0:r.filter(p=>!(p==="fullscreen"&&fc()||p==="navigation"&&(!this.scenes||this.scenes.length<=1))),h=(((e=this.scenes)==null?void 0:e.length)??0)-1,u=((t=this.scenes)==null?void 0:t.findIndex(p=>p===this._drawController.activeScenes[0]))??0,f=(i=this._drawController.activeScenes[0])==null?void 0:i.id,g=(n=(s=this.videos)==null?void 0:s[f])==null?void 0:n.hls;return te`
|
1264
1264
|
<div
|
1265
1265
|
${Je(this._playerRef)}
|
1266
1266
|
${_s(this._handleContainerResize)}
|