@voltra/vue-player
Version:
A Vue port of react-player: components for playing a variety of URLs including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, DailyMotion
23 lines (19 loc) • 52.3 kB
JavaScript
(function(g,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue"),require("vue-types")):typeof define=="function"&&define.amd?define(["exports","vue","vue-types"],a):(g=typeof globalThis<"u"?globalThis:g||self,a(g.vuePlayer={},g.Vue,g.VueTypes))})(this,function(g,a,i){"use strict";function Y(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var je=function(t,r,s){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("script");typeof r=="function"&&(s=r,r={}),r=r||{},s=s||function(){},n.type=r.type||"text/javascript",n.charset=r.charset||"utf8",n.async="async"in r?!!r.async:!0,n.src=t,r.attrs&&Be(n,r.attrs),r.text&&(n.text=""+r.text);var l="onload"in n?G:Te;l(n,s),n.onload||G(n,s),o.appendChild(n)};function Be(e,t){for(var r in t)e.setAttribute(r,t[r])}function G(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function Te(e,t){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,e))}}const Ue=Y(je);var xe=function(t){return Ne(t)&&!He(t)};function Ne(e){return!!e&&typeof e=="object"}function He(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||Fe(e)}var Ke=typeof Symbol=="function"&&Symbol.for,ze=Ke?Symbol.for("react.element"):60103;function Fe(e){return e.$$typeof===ze}function Ye(e){return Array.isArray(e)?[]:{}}function L(e,t){return t.clone!==!1&&t.isMergeableObject(e)?E(Ye(e),e,t):e}function Ge(e,t,r){return e.concat(t).map(function(s){return L(s,r)})}function qe(e,t){if(!t.customMerge)return E;var r=t.customMerge(e);return typeof r=="function"?r:E}function We(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function q(e){return Object.keys(e).concat(We(e))}function W(e,t){try{return t in e}catch{return!1}}function Xe(e,t){return W(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function Ze(e,t,r){var s={};return r.isMergeableObject(e)&&q(e).forEach(function(o){s[o]=L(e[o],r)}),q(t).forEach(function(o){Xe(e,o)||(W(e,o)&&r.isMergeableObject(t[o])?s[o]=qe(o,r)(e[o],t[o],r):s[o]=L(t[o],r))}),s}function E(e,t,r){r=r||{},r.arrayMerge=r.arrayMerge||Ge,r.isMergeableObject=r.isMergeableObject||xe,r.cloneUnlessOtherwiseSpecified=L;var s=Array.isArray(t),o=Array.isArray(e),n=s===o;return n?s?r.arrayMerge(e,t,r):Ze(e,t,r):L(t,r)}E.all=function(t,r){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(s,o){return E(s,o,r)},{})};var Ve=E,Qe=Ve;const Je=Y(Qe),et=/[?&#](?:start|t)=([0-9hms]+)/,tt=/[?&#]end=([0-9hms]+)/,D=/(\d+)([hms])/g,rt=/^\d+$/;function X(e,t){if(e instanceof Array)return;const r=e.match(t);if(r){const s=r[1];if(s.match(D))return st(s);if(rt.test(s))return parseInt(s)}}function st(e){let t=0,r=D.exec(e);for(;r!==null;){const[,s,o]=r;o==="h"&&(t+=parseInt(s,10)*60*60),o==="m"&&(t+=parseInt(s,10)*60),o==="s"&&(t+=parseInt(s,10)),r=D.exec(e)}return t}function k(e){return X(e,et)}function Z(e){return X(e,tt)}function C(){return Math.random().toString(36).substr(2,5)}function nt(e){return Object.keys(e).map(t=>`${t}=${e[t]}`).join("&")}function A(e){return window[e]?window[e]:window.exports&&window.exports[e]?window.exports[e]:window.module&&window.module.exports&&window.module.exports[e]?window.module.exports[e]:null}const S={};function b(e,t,r=null,s=()=>!0,o=Ue){const n=A(t);return n&&s(n)?Promise.resolve(n):new Promise((l,d)=>{if(S[e]){S[e].push({resolve:l,reject:d});return}S[e]=[{resolve:l,reject:d}];const u=c=>{S[e].forEach(y=>y.resolve(c))};if(r){const c=window[r];window[r]=function(){c&&c(),u(A(t))}}o(e,c=>{c?(S[e].forEach(y=>y.reject(c)),S[e]=null):r||u(A(t))})})}function it(e,...t){if(!this.player||!this.player[e]){let r=`VuePlayer: ${this.$options.displayName} player could not call %c${e}%c – `;return this.player?this.player[e]||(r+="The method was not available"):r+="The player was not available",console.warn(r,"font-weight: bold",""),null}return this.player[e](...t)}function $(e){return typeof MediaStream<"u"&&e instanceof MediaStream||typeof window<"u"&&typeof window.MediaStream<"u"&&e instanceof window.MediaStream}function at(e){return/^blob:/.test(e)}function v(e=document.createElement("video")){const t=!/iPhone|iPod/.test(navigator.userAgent);return typeof e.webkitSetPresentationMode=="function"&&t}const m={emits:["mounted","ready","start","play","pause","buffer","buffer-end","ended","error","duration","seek","playback-rate-change","progress","click-preview","enable-pip","disable-pip"],slots:["playIcon","fallback"],props:{url:i.oneOfType([i.string,i.array,i.object]).isRequired,playing:i.bool.def(!1),loop:i.bool.def(!1),controls:i.bool.def(!1),volume:i.number,muted:i.bool.def(!1),playbackRate:i.number.def(1),display:i.string.def("block"),width:i.oneOfType([i.string,i.number]).def("640px"),height:i.oneOfType([i.string,i.number]).def("360px"),style:i.object.def(()=>({})),progressInterval:i.number.def(1e3),playsInline:i.bool.def(!1),pictureInPicture:i.bool.def(!1),stopOnUnmount:i.bool.def(!0),light:i.oneOfType([i.bool,i.string]).def(!1),previewTabIndex:i.number.def(0),oEmbedUrl:i.string.def("https://noembed.com/embed?url={url}"),wrapper:i.oneOfType([i.string,i.func,i.shape({render:i.func.isRequired}).loose]).def("div"),config:i.object.def(()=>({}))},data(){return{isMounted:!1}},mounted(){this.isMounted=!0,this.$emit("mounted",this)},beforeUnmount(){this.isMounted=!1},watch:{muted(e){e?this.mute():this.unmute()},loop:"setLoop",playbackRate:"setPlaybackRate",volume:"setVolume",playing(e){e?this.play():this.pause()}},methods:{callPlayer(e,...t){return it.apply(this,[e,...t])},async load(e,...t){},play(){},pause(){},stop(){},seekTo(e){},setVolume(e){},mute(){},unmute(){},getDuration(){return 0},getCurrentTime(){return 0},getSecondsLoaded(){return 0},setPlaybackRate(e){},enablePIP(){},disablePIP(){},setLoop(e){},onError(...e){this.$emit("error",...e)},onDuration(e){this.$emit("duration",e)},onReady(...e){this.$emit("ready",...e)},onSeek(e){this.$emit("seek",e)},onEnded(){this.$emit("ended")},onPause(...e){this.$emit("pause",...e)},onPlay(...e){this.$emit("play",...e)},onBuffer(...e){this.$emit("buffer",...e)},onBufferEnd(...e){this.$emit("buffer-end",...e)},onPlaybackRateChange(...e){this.$emit("playback-rate-change",...e)},onEnablePIP(...e){this.$emit("enable-pip",...e)},onDisablePIP(...e){this.$emit("enable-pip",...e)}}},V={options:{visual:!0,buying:!1,liking:!1,download:!1,sharing:!1,show_comments:!1,show_playcount:!1}},Q=i.shape({options:i.shape({visual:i.bool,buying:i.bool,liking:i.bool,download:i.bool,sharing:i.bool,show_comments:i.bool,show_playcount:i.bool}).loose}).loose.def(()=>V),J={playerVars:{playsinline:1,showinfo:0,rel:0,iv_load_policy:3,modestbranding:1},embedOptions:{},onUnstarted:()=>{}},ee=i.shape({playerVars:i.shape({playsinline:i.integer,showinfo:i.integer,rel:i.integer,iv_load_policy:i.integer,modestbranding:i.integer}).loose,embedOptions:i.object,onUnstarted:i.func}).loose.def(()=>J),te={appId:"1309697205772819",version:"v3.3",playerId:null,attributes:{}},re=i.shape({appId:i.string,version:i.string,playerId:i.string,attributes:i.object}).loose.def(()=>te),se={params:{api:1,"endscreen-enable":!1}},ne=i.shape({params:i.shape({api:i.integer,"endscreen-enable":i.bool}).loose}).loose.def(()=>se),ie={playerOptions:{autopause:!1,byline:!1,portrait:!1,title:!1},title:null},ae=i.shape({playerOptions:i.shape({autopause:i.bool,byline:i.bool,portrait:i.bool,title:i.bool}).loose,title:i.string}).loose.def(()=>ie),oe={attributes:{},tracks:[],forceVideo:!1,forceAudio:!1,forceHLS:!1,forceDASH:!1,forceFLV:!1,hlsOptions:{},hlsVersion:"1.1.4",dashVersion:"3.1.3",flvVersion:"1.5.0"},le=i.shape({attributes:i.object,tracks:i.array,forceVideo:i.bool,forceAudio:i.bool,forceHLS:i.bool,forceDASH:i.bool,forceFLV:i.bool,hlsOptions:i.object,hlsVersion:i.string,dashVersion:i.string,flvVersion:i.string}).loose.def(()=>oe),ce={wistia:{options:{},playerId:null,customControls:null}},de=i.shape({wistia:i.shape({options:i.object,playerId:i.string,customControls:i.array}).loose}).loose.def(()=>ce),he={options:{hide_cover:1}},ue=i.shape({options:i.shape({hide_cover:i.integer}).loose}).loose.def(()=>he),ye={options:{},playerId:null},pe=i.shape({options:i.object,playerId:i.string}).loose.def(()=>ye),fe={options:{}},me=i.shape({options:i.object}).loose.def(()=>fe),I={soundcloud:V,youtube:J,facebook:te,dailymotion:se,vimeo:ie,file:oe,wistia:ce,mixcloud:he,twitch:ye,vidyard:fe},ot=i.shape({soundcloud:Q,youtube:ee,facebook:re,dailymotion:ne,vimeo:ae,file:le,wistia:de,mixcloud:ue,twitch:pe,vidyard:me}).def(()=>I),lt=i.oneOfType([i.object,i.string,i.func]),Pe={mixins:[m],props:{config:ot,progressFrequency:i.number,activePlayer:lt}};/*!
The MIT License
Copyright © Pete Cook http://cookpete.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/const ge=/(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//,ct=/(?:soundcloud\.com|snd\.sc)\/[^.]+$/,dt=/vimeo\.com\/(?!progressive_redirect).+/,ht=/^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/,ut=/^https?:\/\/fb\.watch\/.+$/,be=/streamable\.com\/([a-z0-9]+)$/,_e=/(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?(.*)$/,yt=/(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/,R=/(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/,we=/^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?$/,Ee=/mixcloud\.com\/([^/]+\/[^/]+)/,Se=/vidyard.com\/(?:watch\/)?([a-zA-Z0-9-_]+)/,pt=/^https?:\/\/[a-zA-Z]+\.kaltura.(com|org)\/p\/([0-9]+)\/sp\/([0-9]+)00\/embedIframeJs\/uiconf_id\/([0-9]+)\/partner_id\/([0-9]+)(.*)entry_id.([a-zA-Z0-9-_]+)$/,O=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,Le=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,M=/\.(m3u8)($|\?)/i,ke=/\.(mpd)($|\?)/i,$e=/\.(flv)($|\?)/i,j=e=>{if(e instanceof Array){for(const t of e)if(typeof t=="string"&&j(t)||j(t.src))return!0;return!1}return $(e)||at(e)?!0:O.test(e)||Le.test(e)||M.test(e)||ke.test(e)||$e.test(e)},h={youtube:e=>e instanceof Array?e.every(t=>ge.test(t)):ge.test(e),soundcloud:e=>ct.test(e)&&!O.test(e),vimeo:e=>dt.test(e)&&!Le.test(e)&&!M.test(e),facebook:e=>ht.test(e)||ut.test(e),streamable:e=>be.test(e),wistia:e=>_e.test(e),twitch:e=>yt.test(e)||R.test(e),dailymotion:e=>we.test(e),mixcloud:e=>Ee.test(e),vidyard:e=>Se.test(e),kaltura:e=>pt.test(e),file:j},B=[{key:"youtube",name:"YouTube",canPlay:h.youtube,lazyPlayer:()=>Promise.resolve().then(()=>Ot)},{key:"soundcloud",name:"SoundCloud",canPlay:h.soundcloud,lazyPlayer:()=>Promise.resolve().then(()=>Mt)},{key:"vimeo",name:"Vimeo",canPlay:h.vimeo,lazyPlayer:()=>Promise.resolve().then(()=>xt)},{key:"facebook",name:"Facebook",canPlay:h.facebook,lazyPlayer:()=>Promise.resolve().then(()=>Ft)},{key:"streamable",name:"Streamable",canPlay:h.streamable,lazyPlayer:()=>Promise.resolve().then(()=>Zt)},{key:"wistia",name:"Wistia",canPlay:h.wistia,lazyPlayer:()=>Promise.resolve().then(()=>sr)},{key:"twitch",name:"Twitch",canPlay:h.twitch,lazyPlayer:()=>Promise.resolve().then(()=>dr)},{key:"dailymotion",name:"DailyMotion",canPlay:h.dailymotion,lazyPlayer:()=>Promise.resolve().then(()=>Pr)},{key:"mixcloud",name:"Mixcloud",canPlay:h.mixcloud,lazyPlayer:()=>Promise.resolve().then(()=>Sr)},{key:"vidyard",name:"Vidyard",canPlay:h.vidyard,lazyPlayer:()=>Promise.resolve().then(()=>Cr)},{key:"kaltura",name:"Kaltura",canPlay:h.kaltura,lazyPlayer:()=>Promise.resolve().then(()=>Br)},{key:"file",name:"FilePlayer",canPlay:h.file,canEnablePIP:e=>h.file(e)&&(document.pictureInPictureEnabled||v())&&!O.test(e),lazyPlayer:()=>Promise.resolve().then(()=>Xr)}];var ve=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function ft(e,t){return!!(e===t||ve(e)&&ve(t))}function mt(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!ft(e[r],t[r]))return!1;return!0}function Oe(e,t){t===void 0&&(t=mt);var r=null;function s(){for(var o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];if(r&&r.lastThis===this&&t(o,r.lastArgs))return r.lastResult;var l=e.apply(this,o);return r={lastResult:l,lastArgs:o,lastThis:this},l}return s.clear=function(){r=null},s}const f=(e,t)=>{const r=e.__vccOpts||e;for(const[s,o]of t)r[s]=o;return r};let w=[];const Pt={displayName:"VuePlayer",addCustomPlayer(e){w.push(e)},removeCustomPlayer(e){w=w.filter(t=>t!==e)},removeCustomPlayers(){w=[]},canPlay(e){return[...w,...B].some(t=>t.canPlay(e))},canEnablePIP(e){return[...w,...B].some(t=>{var r;return(r=t.canEnablePIP)==null?void 0:r.call(t,e)})},inheritAttrs:!1,mixins:[Pe],emits:["click-preview"],components:{Preview:()=>Promise.resolve().then(()=>es),Player:()=>Promise.resolve().then(()=>is)},data(){return{shouldShowPreview:!!this.light}},mounted(){this.getConfig=Oe(this.getConfig),this.getActivePlayer=Oe(this.getActivePlayer)},computed:{previewProps(){return{url:this.url,light:this.light,previewTabIndex:this.previewTabIndex,oEmbedUrl:this.oEmbedUrl}},playerKey(){var e;return(e=this.currentPlayer)==null?void 0:e.key},currentPlayer(){return this.activePlayer??this.getActivePlayer(this.url)},playerConfig(){return this.getConfig(this.url,this.playerKey)},playerComponent(){var e;return((e=this.currentPlayer)==null?void 0:e.lazyPlayer)??this.currentPlayer},playerStyles(){return{...this.style??{},width:this.width,height:this.height}}},methods:{getDuration(){var e,t;return(t=(e=this.$refs.player)==null?void 0:e.getDuration)==null?void 0:t.call(e)},getCurrentTime(){var e,t;return(t=(e=this.$refs.player)==null?void 0:e.getCurrentTime)==null?void 0:t.call(e)},getSecondsLoaded(){var e,t;return(t=(e=this.$refs.player)==null?void 0:e.getSecondsLoaded)==null?void 0:t.call(e)},seekTo(e,t){var r,s;return(s=(r=this.$refs.player)==null?void 0:r.seekTo)==null?void 0:s.call(r,e,t)},getConfig(e,t){var r;return Je.all([I,I[t]??{},this.config??{},((r=this.config)==null?void 0:r[t])??{}])},getActivePlayer(e){return[...w,...B].find(t=>t.canPlay(e))},handleClickPreview(e){this.shouldShowPreview=!1,this.$emit("click-preview",e)},showPreview(){this.shouldShowPreview=!0},handleReady(){this.onReady(this)},getInternalPlayer(e="player"){var t;return(t=this.$refs.player)==null?void 0:t.getInternalPlayer(e)}}},gt={key:0};function bt(e,t,r,s,o,n){const l=a.resolveComponent("Preview");return a.openBlock(),a.createBlock(a.resolveDynamicComponent(e.wrapper),a.mergeProps({ref:"wrapper"},e.$attrs),{default:a.withCtx(()=>[e.url?(a.openBlock(),a.createElementBlock("span",gt,[a.renderSlot(e.$slots,"noUrl")])):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[o.shouldShowPreview?(a.openBlock(),a.createBlock(l,a.mergeProps({key:0},n.previewProps,{onClick:n.handleClickPreview}),{playIcon:a.withCtx(()=>[a.renderSlot(e.$slots,"playIcon")]),_:3},16,["onClick"])):(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.currentPlayer),a.mergeProps({key:1},e.$props,{key:n.playerKey,ref:"player",config:n.playerConfig,activePlayer:n.playerComponent,style:n.playerStyles,onReady:n.handleReady},a.toHandlers(e.$listeners)),{none:a.withCtx(()=>[a.renderSlot(e.$slots,"#noPlayer")]),_:3},16,["config","activePlayer","style","onReady"]))],64))]),_:3},16)}const _t=f(Pt,[["render",bt]]),wt="https://www.youtube.com/iframe_api",De="YT",Et="onYouTubeIframeAPIReady",T=/[?&](?:list|channel)=([a-zA-Z0-9_-]+)/,U=/user\/([a-zA-Z0-9_-]+)\/?/,St=/youtube-nocookie\.com/,Lt="https://www.youtube-nocookie.com",kt={displayName:"YouTube",canPlay:h.youtube,mixins:[m],props:{config:ee},computed:{styles(){return{display:this.display,width:"100%",height:"100%"}}},methods:{play(){this.callPlayer("playVideo")},pause(){this.callPlayer("pauseVideo")},stop(){document.body.contains(this.callPlayer("getIframe"))&&this.callPlayer("stopVideo")},seekTo(e){this.callPlayer("seekTo",e),this.playing||this.pause()},setVolume(e){this.callPlayer("setVolume",e*100)},mute(){this.callPlayer("mute")},unmute(){this.callPlayer("unmute")},setPlaybackRate(e){this.callPlayer("setPlaybackRate",e)},setLoop(e){this.callPlayer("setLoop",e)},getDuration(){return this.callPlayer("getDuration")},getCurrentTime(){return this.callPlayer("getCurrentTime")},getSecondsLoaded(){return this.callPlayer("getVideoLoadedFraction")*this.getDuration()},async load(e,t){try{const{playing:r,muted:s,playsinline:o,controls:n,loop:l,config:d,onError:u}=this,{playerVars:c,embedOptions:y}=d,p=this.getID(e);if(t){if(T.test(e)||U.test(e)||e instanceof Array){this.player.loadPlaylist(this.parsePlaylist(e));return}this.player.cueVideoById({videoId:p,startSeconds:k(e)||c.start,endSeconds:Z(e)||c.end});return}const _=await b(wt,De,Et,P=>P.loaded);if(!this.container)return;this.player=new _.Player(this.container,{width:"100%",height:"100%",videoId:p,playerVars:{autoplay:r?1:0,mute:s?1:0,controls:n?1:0,start:k(e),end:Z(e),origin:window.location.origin,playsinline:o?1:0,...this.parsePlaylist(e),...c},events:{onReady:()=>{l&&this.player.setLoop(!0),this.onReady()},onPlaybackRateChange:P=>this.onPlaybackRateChange(P.data),onStateChange:this.onStateChange,onError:P=>u(P.data)},host:St.test(e)?Lt:void 0,...y}),y.events&&console.warn("Using `embedOptions.events` will likely break things. Use ReactPlayer’s callback props instead, eg onReady, onPlay, onPause")}catch(r){this.onError(r)}},parsePlaylist(e){if(e instanceof Array)return{listType:"playlist",playlist:e.map(this.getID).join(",")};if(T.test(e)){const[,t]=e.match(T);return{listType:"playlist",list:t.replace(/^UC/,"UU")}}if(U.test(e)){const[,t]=e.match(U);return{listType:"user_uploads",list:t}}return{}},onStateChange(e){const{data:t}=e,{onPlay:r,onPause:s,onBuffer:o,onBufferEnd:n,onEnded:l,onReady:d,loop:u,config:{playerVars:c,onUnstarted:y}}=this,{UNSTARTED:p,PLAYING:_,PAUSED:P,BUFFERING:H,ENDED:K,CUED:z}=window[De].PlayerState;if(t===p&&y(),t===_&&(r(),n()),t===P&&s(),t===H&&o(),t===K){const F=!!this.callPlayer("getPlaylist");u&&!F&&(c.start?this.seekTo(c.start):this.play()),l()}t===z&&d()}}},$t={ref:"container"};function vt(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("div",{class:"vue-player--youtube",style:a.normalizeStyle(n.styles)},[a.createElementVNode("div",$t,null,512)],4)}const Ot=Object.freeze(Object.defineProperty({__proto__:null,default:f(kt,[["render",vt]])},Symbol.toStringTag,{value:"Module"})),Dt="https://w.soundcloud.com/player/api.js",Ct="SC",At={displayName:"Soundcloud",canPlay:h.soundcloud,loopOnEnded:!0,mixins:[m],props:{config:Q,display:i.string.def("block")},data(){return{duration:null,currentTime:null,fractionLoaded:null}},computed:{styles(){return{display:this.display,width:"100%",height:"100%"}},src(){return`https://w.soundcloud.com/player/?url=${encodeURIComponent(this.url)}`}},methods:{play(){this.callPlayer("play")},pause(){this.callPlayer("pause")},seekTo(e){this.callPlayer("seekTo",e*1e3)},setVolume(e){this.callPlayer("setVolume",e*100)},mute(){this.setVolume(0)},unmute(){this.volume!==null&&this.setVolume(this.volume)},getDuration(){return this.duration},getCurrentTime(){return this.currentTime},getSecondsLoaded(){return this.fractionLoaded*this.duration},async load(e,t){try{const r=await b(Dt,Ct);if(!this.iframe)return;const{PLAY:s,PLAY_PROGRESS:o,PAUSE:n,FINISH:l,ERROR:d}=r.Widget.Events;t||(this.player=r.Widget(this.$refs.iframe),this.player.bind(s,this.onPlay),this.player.bind(n,()=>{this.duration-this.currentTime<.05||this.onPause()}),this.player.bind(o,u=>{this.currentTime=u.currentPosition/1e3,this.fractionLoaded=u.loadedProgress}),this.player.bind(l,this.onEnded),this.player.bind(d,this.onError)),this.player.load(e,{...this.config.options,callback:()=>{this.player.getDuration(u=>{this.duration=u/1e3,this.onReady()})}})}catch(r){this.onError(r)}}}},It=["src"];function Rt(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("iframe",{ref:"iframe",class:"vue-player--soundcloud",style:a.normalizeStyle(n.styles),src:n.src,frameborder:"0",allow:"autoplay"},null,12,It)}const Mt=Object.freeze(Object.defineProperty({__proto__:null,default:f(At,[["render",Rt]])},Symbol.toStringTag,{value:"Module"})),jt="https://player.vimeo.com/api/player.js",Bt="Vimeo",Tt={displayName:"Vimeo",canPlay:h.vimeo,forceLoad:!0,mixins:[m],props:{config:ae,display:i.string.def("block")},data(){return{duration:null,currentTime:null,secondsLoaded:null}},computed:{styles(){return{display:this.display,overflow:"hidden",width:"100%",height:"100%"}}},methods:{play(){const e=this.callPlayer("play");e&&e.catch(this.onError)},pause(){this.callPlayer("pause")},stop(){this.callPlayer("unload")},seekTo(e){this.callPlayer("setCurrentTime",e)},setVolume(e){this.callPlayer("setVolume",e)},setLoop(e){this.callPlayer("setLoop",e)},setPlaybackRate(e){this.callPlayer("setPlaybackRate",e)},mute(){this.setVolume(0)},unmute(){this.volume&&this.setVolume(this.volume)},getDuration(){return this.duration},getCurrentTime(){return this.currentTime},getSecondsLoaded(){return this.secondsLoaded},async load(e){try{this.duration=null;const t=await b(jt,Bt);if(!this.$refs.container)return;const{playerOptions:r,title:s}=this.config;this.player=new t.Player(this.$refs.container,{url:e,autoplay:this.playing,muted:this.muted,loop:this.loop,playsinline:this.playsinline,controls:this.controls,...r}),this.player.ready().then(()=>{const o=this.$refs.container.querySelector("iframe");o.style.width="100%",o.style.height="100%",s&&(o.title=s)}).catch(this.onError),this.player.on("loaded",()=>{this.onReady(),this.refreshDuration()}),this.player.on("play",()=>{this.onPlay(),this.refreshDuration()}),this.player.on("pause",this.onPause),this.player.on("seeked",o=>this.onSeek(o.seconds)),this.player.on("ended",this.onEnded),this.player.on("error",this.onError),this.player.on("timeupdate",({seconds:o})=>{this.currentTime=o}),this.player.on("progress",({seconds:o})=>{this.secondsLoaded=o}),this.player.on("bufferstart",this.onBuffer),this.player.on("bufferend",this.onBufferEnd)}catch(t){this.onError(t)}},async refreshDuration(){this.duration=await this.player.getDuration()}}};function Ut(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("div",{key:this.url,style:a.normalizeStyle(n.styles),ref:"container"},null,4)}const xt=Object.freeze(Object.defineProperty({__proto__:null,default:f(Tt,[["render",Ut]])},Symbol.toStringTag,{value:"Module"})),Ce="https://connect.facebook.net/en_US/sdk.js",Ae="FB",Ie="fbAsyncInit",Nt="facebook-player-",Ht={displayName:"Facebook",canPlay:h.facebook,loopOnEnabled:!0,events:["loaded"],mixins:[m],props:{config:re},data(){return{randomId:`${Nt}${C()}`}},computed:{playerID(){var e;return((e=this==null?void 0:this.config)==null?void 0:e.playerId)??this.randomId}},methods:{play(){this.callPlayer("play")},pause(){this.callPlayer("pause")},seekTo(e){this.callPlayer("seek",e)},setVolume(e){this.callPlayer("setVolume",e)},mute(){this.callPlayer("mute")},unmute(){this.callPlayer("unmute")},getDuration(){return this.callPlayer("getDuration")},getCurrentTime(){return this.callPlayer("getCurrentTime")},getSecondsLoaded(){return null},async load(e,t){var s,o;if(t){const n=await b(Ce,Ae,Ie);(o=(s=n==null?void 0:n.XFBML)==null?void 0:s.parse)==null||o.call(s);return}const r=await b(Ce,Ae,Ie);r.init({appId:this.config.appId,xfbml:!0,version:this.config.version}),r.Event.subscribe("xfbml.render",n=>{this.onLoaded()}),r.Event.subscribe("xfbml.ready",n=>{n.type==="video"&&n.id===this.playerID&&(this.player=n.instance,this.player.subscribe("startedPlaying",this.onPlay),this.player.subscribe("paused",this.onPause),this.player.subscribe("finishedPlaying",this.onEnded),this.player.subscribe("startedBuffering",this.onBuffer),this.player.subscribe("finishedBuffering",this.onBufferEnd),this.player.subscribe("error",this.onError),this.muted?this.mute():this.unmute(),this.onReady(),document.getElementById(this.playerID).querySelector("iframe").style.visibility="visible")})},onLoaded(...e){this.$emit("loaded",...e)}}},Kt=["id","data-href","data-autoplay","data-controls"];function zt(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("div",a.mergeProps({id:this.playerID,class:"fb-video vue-player--facebook","data-href":this.url,"data-autoplay":this.playing?"true":"false","data-controls":this.controls?"true":"false","data-allowfullscreen":"true"},r.config.attributes),null,16,Kt)}const Ft=Object.freeze(Object.defineProperty({__proto__:null,default:f(Ht,[["render",zt]])},Symbol.toStringTag,{value:"Module"})),Yt="https://cdn.embed.ly/player-0.1.0.min.js",Gt="playerjs",qt={displayName:"Streamable",canPlay:h.streamable,mixins:[m],data(){return{duration:null,currentTime:null,secondsLoaded:null}},computed:{id(){return this.url.match(be)[1]},src(){return`https://streamable.com/o/${this.id}`}},methods:{play(){this.callPlayer("play")},pause(){this.callPlayer("pause")},seekTo(e){this.callPlayer("setCurrentTime",e)},setVolume(e){this.callPlayer("setVolume",e*100)},setLoop(e){this.callPlayer("setLoop",e)},mute(){this.callPlayer("mute")},unmute(){this.callPlayer("unmute")},getDuration(){return this.duration},getCurrentTime(){return this.currentTime},getSecondsLoaded(){return this.secondsLoaded},async load(e){try{const t=await getSDK(Yt,Gt);if(!this.iframe)return;this.player=new t.Player(this.$refs.iframe),this.player.setLoop(this.loop),this.player.on("ready",this.onReady),this.player.on("play",this.onPlay),this.player.on("pause",this.onPause),this.player.on("seeked",this.onSeek),this.player.on("ended",this.onEnded),this.player.on("error",this.onError),this.player.on("timeupdate",({duration:r,seconds:s})=>{this.duration=r,this.currentTime=s}),this.player.on("buffered",({percent:r})=>{this.duration&&(this.secondsLoaded=this.duration*r)}),this.muted&&this.player.mute()}catch(t){this.onError(t)}}}},Wt=["src"];function Xt(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("iframe",{class:"vue-player--streamable",ref:"iframe",src:n.src,frameborder:"0",scrolling:"no",allowfullscreen:""},null,8,Wt)}const Zt=Object.freeze(Object.defineProperty({__proto__:null,default:f(qt,[["render",Xt]])},Symbol.toStringTag,{value:"Module"})),Vt="https://fast.wistia.com/assets/external/E-v1.js",Qt="Wistia",Jt="wistia-player-",er={displayName:"Wistia",canPlay:h.wistia,loopOnEnded:!0,mixins:[m],props:{config:de},data(){return{randomId:`${Jt}${C()}`}},computed:{pid(){return this.config.playerId??this.randomId},videoId(){var e,t,r;return(r=(t=(e=this.url)==null?void 0:e.match)==null?void 0:t.call(e,_e))==null?void 0:r[1]},className(){return`vue-player--wistia wistia_embed wistia_async_${this.videoId}`}},methods:{play(){this.callPlayer("play")},pause(){this.callPlayer("pause")},stop(){this.unbind(),this.callPlayer("remove")},seekTo(e){this.callPlayer("time",e)},setVolume(e){this.callPlayer("volume",e)},mute(){this.callPlayer("mute")},unmute(){this.callPlayer("unmute")},setPlaybackRate(e){this.callPlayer("playbackRate",e)},getDuration(){return this.callPlayer("duration")},getCurrentTime(){return this.callPlayer("time")},getSecondsLoaded(){return null},async load(e){var t,r;try{const{playing:s,muted:o,controls:n,onReady:l,config:d,onError:u}=this,c=await getSDK(Vt,Qt);(r=(t=d.customControls)==null?void 0:t.forEach)==null||r.call(t,y=>c.defineControl(y)),window._wq=window._wq||[],window._wq.push({id:this.playerID,options:{autoPlay:s,silentAutoPlay:"allow",muted:o,controlsVisibleOnLoad:n,fullscreenButton:n,playbar:n,playbackRateControl:n,qualityControl:n,volumeControl:n,settingsControl:n,smallPlayButton:n,...d.options},onReady:y=>{this.player=y,this.unbind(),this.player.bind("play",this.onPlay),this.player.bind("pause",this.onPause),this.player.bind("seek",this.onSeek),this.player.bind("end",this.onEnded),this.player.bind("playbackratechange",this.onPlaybackRateChange),l()}})}catch(s){this.onError(s)}},unbind(){var e,t,r,s,o,n,l,d,u,c;(t=(e=this.player)==null?void 0:e.unbind)==null||t.call(e,"play",this.onPlay),(s=(r=this.player)==null?void 0:r.unbind)==null||s.call(r,"pause",this.onPause),(n=(o=this.player)==null?void 0:o.unbind)==null||n.call(o,"seek",this.onSeek),(d=(l=this.player)==null?void 0:l.unbind)==null||d.call(l,"end",this.onEnded),(c=(u=this.player)==null?void 0:u.unbind)==null||c.call(u,"playbackratechange",this.onPlaybackRateChange)}}},tr=["id"];function rr(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("div",{id:n.pid,key:n.videoId,class:a.normalizeClass(n.className)},null,10,tr)}const sr=Object.freeze(Object.defineProperty({__proto__:null,default:f(er,[["render",rr]])},Symbol.toStringTag,{value:"Module"})),nr="https://player.twitch.tv/js/embed/v1.js",ir="Twitch",ar="twitch-player-",or={displayName:"Twitch",canPlay:h.twitch,loopOnEnded:!0,mixins:[m],props:{config:pe},data(){return{randomId:`${ar}${C()}`}},computed:{pid(){return this.config.playerId??this.randomId}},methods:{play(){this.callPlayer("play")},pause(){this.callPlayer("pause")},stop(){this.callPlayer("pause")},seekTo(e){this.callPlayer("seek",e)},setVolume(e){this.callPlayer("setVolume",e)},unmute(){this.callPlayer("setMuted",!1)},getDuration(){return this.callPlayer("getDuration")},getCurrentTime(){return this.callPlayer("getCurrentTime")},getSecondsLoaded(){return null},async load(e,t){var r,s,o,n;try{const{playsinline:l,config:d,controls:u}=this,c=R.test(e),y=c?e.match(R)[1]:e.match(MATCH_URL_TWITCH_VIDEO)[1];if(t){c?(s=(r=this.player)==null?void 0:r.setChannel)==null||s.call(r,y):(n=(o=this.player)==null?void 0:o.setVideo)==null||n.call(o,"v"+y);return}const p=await getSDK(nr,ir);this.player=new p.Player(this.pid,{video:c?"":y,channel:c?y:"",height:"100%",width:"100%",playsinline:l,autoplay:this.playing,muted:this.muted,controls:c?!0:u,time:k(e),...d.options});const{READY:_,PLAYING:P,PAUSE:H,ENDED:K,ONLINE:z,OFFLINE:F,SEEK:as}=p.Player;this.player.addEventListener(_,this.onReady),this.player.addEventListener(P,this.onPlay),this.player.addEventListener(H,this.onPause),this.player.addEventListener(K,this.onEnded),this.player.addEventListener(as,this.onSeek),this.player.addEventListener(z,this.onLoaded),this.player.addEventListener(F,this.onLoaded)}catch(l){this.onError(l)}}}},lr=["id"];function cr(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("div",{class:"vue-player--twitch",id:n.pid},null,8,lr)}const dr=Object.freeze(Object.defineProperty({__proto__:null,default:f(or,[["render",cr]])},Symbol.toStringTag,{value:"Module"})),hr="https://api.dmcdn.net/all.js",ur="DM",yr="dmAsyncInit",pr={displayName:"DailyMotion",canPlay:h.dailymotion,loopOnEnded:!0,mixins:[m],props:{config:ne,display:i.string.def("block")},computed:{styles(){return this.display?{display:this.display}:{}}},methods:{play(){this.callPlayer("play")},pause(){this.callPlayer("pause")},seekTo(e){this.callPlayer("seek",e)},setVolume(e){this.callPlayer("setVolume",e)},mute(){this.callPlayer("setMuted",!0)},unmute(){this.callPlayer("setMuted",!1)},getDuration(){var e;return((e=this.player)==null?void 0:e.duration)||null},getCurrentTime(){var e;return(e=this.player)==null?void 0:e.currentTime},getSecondsLoaded(){var e;return(e=this.player)==null?void 0:e.bufferedTime},async load(e){const{controls:t,config:r,playing:s}=this,[,o]=e.match(we);if(this.player){this.player.load(o,{start:k(e),autoplay:s});return}try{const n=await b(hr,ur,yr,d=>d.player);if(!this.$refs.container)return;const l=n.player;this.player=new l(this.$refs.container,{width:"100%",height:"100%",video:o,params:{controls:t,autoplay:this.playing,mute:this.muted,start:k(e),origin:window.location.origin,...r.params},events:{apiready:this.onReady,seeked:()=>this.onSeek(this.player.currentTime),video_end:this.onEnded,durationchange:this.onDurationChange,pause:this.onPause,playing:this.onPlay,waiting:this.onBuffer,error:this.onError}})}catch(n){this.onError(n)}},onDurationChange(){const e=this.getDuration();this.onDuration(e)}}},fr={ref:"container"};function mr(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("div",{class:"vue-player--dailymotion",style:a.normalizeStyle(n.styles)},[a.createElementVNode("div",fr,null,512)],4)}const Pr=Object.freeze(Object.defineProperty({__proto__:null,default:f(pr,[["render",mr]])},Symbol.toStringTag,{value:"Module"})),gr="https://widget.mixcloud.com/media/js/widgetApi.js",br="Mixcloud",_r={displayName:"Mixcloud",canPlay:h.mixcloud,mixins:[m],props:{config:ue},data(){return{duration:null,currentTime:null,secondsLoaded:null}},computed:{id(){return this.url.match(Ee)[1]},query(){return nt({...this.config.options,feed:`/${this.id}/`})},src(){return`https://www.mixcloud.com/widget/iframe/?${this.query}`}},methods:{play(){this.callPlayer("play")},pause(){this.callPlayer("pause")},seekTo(e){this.callPlayer("seek",e)},getDuration(){return this.duration},getCurrentTime(){return this.currentTime},getSecondsLoaded(){return this.secondsLoaded},async load(e){try{const t=await b(gr,br);this.player=t.PlayerWidget(this.$refs.iframe),this.player.ready.then(()=>{this.player.events.play.on(this.onPlay),this.player.events.pause.on(this.onPause),this.player.events.ended.on(this.onEnded),this.player.events.error.on(this.onError),this.player.events.progress.on((r,s)=>{this.currentTime=r,this.duration=s}),this.onReady()})}catch(t){this.onError(t)}}}},wr=["src"];function Er(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("iframe",{key:n.id,ref:"iframe",src:n.src,class:"vue-player--mixcloud",frameborder:"0"},null,8,wr)}const Sr=Object.freeze(Object.defineProperty({__proto__:null,default:f(_r,[["render",Er]])},Symbol.toStringTag,{value:"Module"})),Lr="https://play.vidyard.com/embed/v4.js",kr="VidyardV4",$r="onVidyardAPI",vr={displayName:"Vidyard",canPlay:h.vidyard,mixins:[m],props:{config:me,display:i.string.def("block")},computed:{styles(){return{display:this.display,width:"100%",height:"100%"}}},methods:{play(){this.callPlayer("play")},pause(){this.callPlayer("pause")},stop(){var e,t,r;(r=(t=(e=window.VidyardV4)==null?void 0:e.api)==null?void 0:t.destroyPlayer)==null||r.call(t,this.player)},seekTo(e){this.callPlayer("seek",e)},setVolume(e){this.callPlayer("setVolume",e)},mute(){this.setVolume(0)},unmute(){this.volume&&this.setVolume(this.volume)},setPlaybackRate(e){this.callPlayer("setPlaybackSpeed",e)},getDuration(){return this.duration},getCurrentTime(){return this.callPlayer("currentTime")},getSecondsLoaded(){return null},async load(e){try{const{playing:t,config:r}=this,s=(e??this.url).match(Se)[1];this.player&&this.stop();const o=await b(Lr,kr,$r);if(!this.$refs.container)return;o.api.addReadyListener((n,l)=>{this.player=l,this.player.on("ready",this.onReady),this.player.on("play",this.onPlay),this.player.on("pause",this.onPause),this.player.on("seek",this.onSeek),this.player.on("playerComplete",this.onEnded)},s),o.api.renderPlayer({uuid:s,container:this.$refs.container,autoplay:t?1:0,...r.options}),o.api.getPlayerMetadata(s).then(n=>{this.duration=n.length_in_seconds,this.onDuration(n.length_in_seconds)})}catch(t){this.onError(t)}}}},Or={ref:"container"};function Dr(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("div",{style:a.normalizeStyle(n.styles)},[a.createElementVNode("div",Or,null,512)],4)}const Cr=Object.freeze(Object.defineProperty({__proto__:null,default:f(vr,[["render",Dr]])},Symbol.toStringTag,{value:"Module"})),Ar="https://cdn.embed.ly/player-0.1.0.min.js",Ir="playerjs",Rr={displayName:"Kaltura",canPlay:h.kaltura,mixins:[m],data(){return{duration:null,currentTime:null,secondsLoaded:null}},methods:{play(){this.callPlayer("play")},pause(){this.callPlayer("pause")},seekTo(e){this.callPlayer("setCurrentTime",e)},setVolume(e){this.callPlayer("setVolume",e)},setLoop(e){this.callPlayer("setLoop",e)},mute(){this.callPlayer("mute")},unmute(){this.callPlayer("unmute")},getDuration(){return this.duration},getCurrentTime(){return this.currentTime},getSecondsLoaded(){return this.secondsLoaded},async load(e){try{const t=await b(Ar,Ir);if(!this.$refs.iframe)return;this.player=new t.Player(this.$refs.iframe),this.player.on("ready",()=>{setTimeout(()=>{this.player.isReady=!0,this.player.setLoop(this.loop),this.muted&&this.player.mute(),this.addListeners(this.player),this.onReady()},500)})}catch(t){this.onError(t)}},addListeners(e){e.on("play",this.onPlay),e.on("pause",this.onPause),e.on("ended",this.onEnded),e.on("error",this.onError),e.on("timeupdate",({duration:t,seconds:r})=>{const s=this.duration!==t;this.duration=t,this.currentTime=r,s&&this.onDuration(t),this.onSeek(r)})}}},Mr=["src"];function jr(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("iframe",{class:"vue-player--kaltura",ref:"iframe",src:e.url,frameborder:"0",scrolling:"no",allowfullscreen:"",allow:"encrypted-media;autoplay",referrerpolicy:"no-referrer-when-downgrade"},null,8,Mr)}const Br=Object.freeze(Object.defineProperty({__proto__:null,default:f(Rr,[["render",jr]])},Symbol.toStringTag,{value:"Module"})),Re=typeof navigator<"u",Tr=Re&&navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,Me=Re&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||Tr)&&!window.MSStream,Ur="https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js",xr="Hls",Nr="https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js",Hr="dashjs",Kr="https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js",zr="flvjs",Fr=/www\.dropbox\.com\/.+/,x=/https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/,Yr="https://videodelivery.net/{id}/manifest/video.m3u8",Gr={displayName:"FilePlayer",canPlay:h.file,mixins:[m],props:{config:le},data(){return{prevPlayer:this.$refs.player??null,prevUrl:this.url}},computed:{urlIsArray(){return Array.isArray(this.url)},hasTracks(){var t;const e=((t=this.config)==null?void 0:t.tracks)??[];return Array.isArray(e)&&e.length>0},tag(){return this.shouldUseAudio?"audio":"video"},shouldUseAudio(){var e;return(e=this.config)!=null&&e.forceVideo||this.config.attributes.poster?!1:O.test(this.url)||this.config.forceAudio},styles(){return{width:this.width==="auto"?this.width:"100%",height:this.height==="auto"?this.height:"100%"}},src(){return this.getSource(this.url)}},mounted(){var e,t;this.addListeners(this.$refs.player),Me&&((t=(e=this.$refs.player)==null?void 0:e.load)==null||t.call(e)),this.$watch(()=>this.$refs.player,(r,s)=>{this.prevPlayer=s})},beforeUnmount(){var e,t;this.prevPlayer=null,this.removeListeners(this.$refs.player),(t=(e=this.hls)==null?void 0:e.destroy)==null||t.call(e)},watch:{url(e,t){this.prevUrl=t,!$(e)&&this.$refs.player&&(this.$refs.player.srcObject=null)},shouldUseAudio(){this.removeListeners(this.prevPlayer,this.prevUrl),this.addListeners(this.$refs.player)}},methods:{onDisablePIP(...e){this.$emit("disable-pip",...e),this.playing&&this.play()},onSeek(e){this.$emit("seek",e.target.currentTime)},play(){var t,r;const e=(r=(t=this.$refs.player).play)==null?void 0:r.call(t);e&&e.catch(this.onError)},pause(){var e,t;(t=(e=this.$refs.player).pause)==null||t.call(e)},stop(){var e,t,r,s;(t=(e=this.$refs.player)==null?void 0:e.removeAttribute)==null||t.call(e,"src"),(s=(r=this.dash)==null?void 0:r.reset)==null||s.call(r)},seekTo(e){this.player.currentTime=e},setVolume(e){this.player.volume=e},mute(){this.player.muted=!0},unmute(){this.player.muted=!1},getDuration(){if(!this.$refs.player)return null;const{duration:e,seekable:t}=this.$refs.player;return e===1/0&&t.length>0?t.end(t.length-1):e},getCurrentTime(){var e;return(e=this.$refs.player)==null?void 0:e.currentTime},getSecondsLoaded(){if(!this.$refs.player)return null;const{buffered:e}=this.$refs.player;if(e.length===0)return 0;const t=e.end(e.length-1),r=this.getDuration();return t>r?r:t},setPlaybackRate(e){try{this.$refs.player.playbackRate=e}catch(t){this.onError(t)}},enablePIP(){var e,t,r,s,o,n;(e=this.$refs.player)!=null&&e.requestPictureInPicture&&document.pictureInPictureElement!==this.$refs.player?((r=(t=this.$refs.player)==null?void 0:t.requestPictureInPicture)==null||r.call(t),this.onEnablePIP()):v(this.$refs.player)&&((s=this.$refs.player)==null?void 0:s.webkitPresentationMode)!=="picture-in-picture"&&((n=(o=this.$refs.player)==null?void 0:o.webkitSetPresentationMode)==null||n.call(o,"picture-in-picture"),this.onEnablePIP())},disablePIP(){var e,t,r;document.exitPictureInPicture&&document.pictureInPictureElement===this.$refs.player?(document.exitPictureInPicture(),this.onDisablePIP()):v(this.$refs.player)&&((e=this.$refs.player)==null?void 0:e.webkitPresentationMode)!=="inline"&&((r=(t=this.$refs.player)==null?void 0:t.webkitSetPresentationMode)==null||r.call(t,"inline"),this.onDisablePIP())},async load(e){var n,l,d,u,c,y;const{hlsVersion:t,hlsOptions:r,dashVersion:s,flvVersion:o}=this.config;if((l=(n=this.hls)==null?void 0:n.destroy)==null||l.call(n),(u=(d=this.dash)==null?void 0:d.reset)==null||u.call(d),this.shouldUseHLS(e)){const p=await getSDK(Ur.replace("VERSION",t),xr);if(this.hls=new p(r),this.hls.on(p.Events.MANIFEST_PARSED,()=>{this.onReady()}),this.hls.on(p.Events.ERROR,(_,P)=>{this.onError(_,P,this.hls,p)}),x.test(e)){const _=e.match(x)[1];this.hls.loadSource(Yr.replace("{id}",_))}else this.hls.loadSource(e);this.hls.attachMedia(this.$refs.player),this.onLoaded()}else if(this.shouldUseDASH(e)){const p=await getSDK(Nr.replace("VERSION",s),Hr);this.dash=p.MediaPlayer().create(),this.dash.initialize(this.$refs.player,e,this.playing),this.dash.on("error",this.onError),parseInt(s)<3?this.dash.getDebug().setLogToBrowserConsole(!1):this.dash.updateSettings({debug:{logLevel:p.Debug.LOG_LEVEL_NONE}}),this.onLoaded()}else if(this.shouldUseFLV(e)){const p=await getSDK(Kr.replace("VERSION",o),zr);this.flv=p.createPlayer({type:"flv",url:e}),this.flv.attachMediaElement(this.$refs.player),this.flv.load(),this.onLoaded()}if(e instanceof Array)(y=(c=this.$refs.player)==null?void 0:c.load)==null||y.call(c);else if($(e))try{this.$refs.player.srcObject=e}catch{this.$refs.player.src=URL.createObjectURL(e)}},getSource(e){const t=this.shouldUseHLS(e),r=this.shouldUseDASH(e),s=this.shouldUseFLV(e);if(!(e instanceof Array||$(e)||t||r||s))return Fr.test(e)?e.replace("www.dropbox.com","dl.dropboxusercontent.com"):e},onPresentationModeChange(e){if(this.$refs.player&&v(this.$refs.player)){const{webkitPresentationMode:t}=this.$refs.player;t==="picture-in-picture"?this.onEnablePIP(e):t==="inline"&&this.onDisablePIP(e)}},addListeners(e){const{url:t,playsInline:r}=this;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlaybackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.addEventListener("canplay",this.onReady),r&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""))},removeListeners(e,t){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlaybackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.removeEventListener("canplay",this.onReady)},shouldUseHLS(e){var t;return(t=this.config)!=null&&t.forceHLS?!0:Me?!1:M.test(e)||x.test(e)},shouldUseDASH(e){return ke.test(e)||this.props.config.forceDASH},shouldUseFLV(e){return $e.test(e)||this.props.config.forceFLV}}},qr=["src"];function Wr(e,t,r,s,o,n){return a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.tag),a.mergeProps({ref:"player",class:"vue-player--file",style:n.styles,preload:"auto",src:n.src,autoplay:e.playing,controls:e.controls,muted:e.muted,loop:e.loop},r.config.attributes),{default:a.withCtx(()=>[n.urlIsArray?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(this.url,(l,d)=>a.renderSlot(e.$slots,"source",a.normalizeProps(a.guardReactiveProps({source:l})),()=>[typeof l=="string"?(a.openBlock(),a.createElementBlock("source",{src:l,key:l},null,8,qr)):(a.openBlock(),a.createElementBlock("source",a.mergeProps({key:d},l),null,16))])),256)),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(this.config.tracks,(l,d)=>a.renderSlot(e.$slots,"track",a.normalizeProps(a.guardReactiveProps({track:l})),()=>[(a.openBlock(),a.createElementBlock("track",a.mergeProps({key:d},l),null,16))])),256))],64)):a.createCommentVNode("",!0)]),_:3},16,["style","src","autoplay","controls","muted","loop"])}const Xr=Object.freeze(Object.defineProperty({__proto__:null,default:f(Gr,[["render",Wr]])},Symbol.toStringTag,{value:"Module"})),N={},Zr={emits:["click"],props:{url:i.string.isRequired,oEmbedUrl:i.string.isRequired,previewTabIndex:i.integer.def(0),light:i.any},data(){return{image:null,mounted:!1}},mounted(){this.mounted=!0,this.fetchImage()},beforeUnmount(){this.mounted=!1},computed:{previewStyles(){return this.image?{backgroundImage:`url(${this.image})`}:{}}},methods:{handleClick(e){this.$emit("click",e)},handleKeyPress(e){(e.key==="Enter"||e.key===" ")&&this.$emit("click",e)},async fetchImage(){if(typeof this.light=="string")this.image=this.light;else if(N[this.url])this.image=N[this.url];else{this.image=null;const t=await(await fetch(this.oEmbedUrl.replace("{url}",this.url))).json();if(typeof t.thumbnail_url<"u"&&this.mounted){const r=t.thumbnail_url.replace("height=100","height=480");this.image=r,N[this.url]=r}}},watch:{url:"fetchImage",light:"fetchImage"}}},Vr=["tabindex"],Qr=a.createElementVNode("div",{class:"vue-player__shadow react-player__shadow"},[a.createElementVNode("div",{class:"vue-player__play-icon react-player__play-icon"})],-1);function Jr(e,t,r,s,o,n){return a.openBlock(),a.createElementBlock("div",{class:"vue-player__preview react-player__preview",tabindex:r.previewTabIndex,style:a.normalizeStyle(n.previewStyles),onClick:t[0]||(t[0]=(...l)=>n.handleClick&&n.handleClick(...l)),onKeydown:t[1]||(t[1]=(...l)=>n.handleKeyPress&&n.handleKeyPress(...l))},[a.renderSlot(e.$slots,"playIcon",{},()=>[Qr])],44,Vr)}const es=Object.freeze(Object.defineProperty({__proto__:null,default:f(Zr,[["render",Jr]])},Symbol.toStringTag,{value:"Module"})),ts=5e3,rs={mixins:[Pe],inheritAttrs:!1,data(){return{player:null,isReady:!1,isPlaying:!1,isLoading:!0,loadOnReady:null,startOnPlay:!0,seekOnPlay:null,onDurationCalled:!1,progressTimeout:0,durationCheckTimeout:0}},computed:{playerProps(){return{...this.$props,...this.$attrs}}},beforeUnmount(){var e,t,r,s;clearTimeout(this.progressTimeout),clearTimeout(this.durationCheckTimeout),this.isReady&&this.stopOnUnmount&&((t=(e=this.player)==null?void 0:e.stop)==null||t.call(e),(s=(r=this.player)==null?void 0:r.disablePIP)==null||s.call(r))},watch:{playing(e){var t,r,s,o;e&&!this.isPlaying?((r=(t=this.player)==null?void 0:t.play)==null||r.call(t),this.isPlaying=!0):!e&&this.isPlaying&&((o=(s=this.player)==null?void 0:s.pause)==null||o.call(s),this.isPlaying=!1)},pictureInPicture(e){var t,r,s,o;e?(r=(t=this.player)==null?void 0:t.enablePIP)==null||r.call(t):(o=(s=this.player)==null?void 0:s.disablePIP)==null||o.call(s)},muted(e){var t,r,s,o;e?(r=(t=this.player)==null?void 0:t.mute)==null||r.call(t):((o=(s=this.player)==null?void 0:s.unmute)==null||o.call(s),this.volume!==null&&this.$nextTick(()=>{var n,l;return(l=(n=this.player)==null?void 0:n.setVolume)==null?void 0:l.call(n,volume)}))}},methods:{getDuration(){var e,t;return this.isReady?(t=(e=this.player)==null?void 0:e.getDuration)==null?void 0:t.call(e):null},getCurrentTime(){var e,t;return this.isReady?(t=(e=this.player)==null?void 0:e.getCurrentTime)==null?void 0:t.call(e):null},getSecondsLoaded(){var e,t;return this.isReady?(t=(e=this.player)==null?void 0:e.getSecondsLoaded)==null?void 0:t.call(e):null},seekTo(e,t){if(!this.isReady){e!==0&&(this.seekOnPlay=e,setTimeout(()=>{this.seekOnPlay=null},ts));return}if(t?t==="fraction":e>0&&e<1){const s=this.player.getDuration();if(!s){console.warn("VuePlayer: could not seek using fraction – duration not yet available");return}this.player.seekTo(s*e);return}this.player.seekTo(e)},handlePlayerMount(e){this.player=e,this.player.load(this.url),this.progress()},getInternalPlayer(e){var t;return(t=this.player)==null?void 0:t[e]},progress(){if(this.url&&this.player&&this.isReady){const e=this.getCurrentTime()??0,t=this.getSecon