@mux/mux-player 3.11.7 → 3.11.8-canary.1
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/base.cjs.js +70 -69
- package/dist/base.mjs +22 -21
- package/dist/mux-player.js +153 -152
- package/dist/mux-player.mjs +153 -152
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/base.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
https://github.com/muxinc/elements/blob/main/errors/${t.file}`),O(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},I={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},
|
|
1
|
+
var lt=t=>{throw TypeError(t)};var Ae=(t,a,e)=>a.has(t)||lt("Cannot "+e);var l=(t,a,e)=>(Ae(t,a,"read from private field"),e?e.call(t):a.get(t)),h=(t,a,e)=>a.has(t)?lt("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(t):a.set(t,e),f=(t,a,e,i)=>(Ae(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e),p=(t,a,e)=>(Ae(t,a,"access private method"),e);var Y=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends Y{}globalThis.DocumentFragment=t}var Q=class extends Y{},Ce=class extends Y{},Gt={get(t){},define(t,a,e){},getName(t){return null},upgrade(t){},whenDefined(t){return Promise.resolve(Q)}},J,ke=class{constructor(a,e={}){h(this,J);f(this,J,e==null?void 0:e.detail)}get detail(){return l(this,J)}initCustomEvent(){}};J=new WeakMap;function jt(t,a){return new Q}var ut={document:{createElement:jt},DocumentFragment,customElements:Gt,CustomEvent:ke,EventTarget:Y,HTMLElement:Q,HTMLVideoElement:Ce},mt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",_=mt?ut:globalThis,w=mt?ut.document:globalThis.document;import{MediaController as _a,MediaErrorDialog as Kt}from"media-chrome";import{Attributes as we}from"media-chrome/dist/media-container.js";import{MediaStateChangeEvents as Pt,MediaUIAttributes as ve,MediaUIEvents as wt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import{MediaError as Ee,Attributes as s}from"@mux/mux-video/base";import{StreamTypes as L,PlaybackTypes as Te,addTextTrack as Ra,removeTextTrack as xa,CmcdTypeValues as Dt,i18n as B,parseJwt as De,MuxJWTAud as Ue,generatePlayerInitTime as Oa}from"@mux/playback-core";import{i18n as Jt}from"@mux/playback-core";import{StreamTypes as xe,parseJwt as pt}from"@mux/playback-core";function ct(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${me(e)}: ${i}; `)}),a?a.trim():void 0}function me(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ce(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function A(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function _e(t){let a=zt(t).toString();return a?"?"+a:""}function zt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}var Re=(t,a)=>!t||!a?!1:t.contains(a)?!0:Re(t,a.getRootNode().host);var bt="mux.com",Xt=()=>{try{return"3.11.7"}catch{}return"UNKNOWN"},qt=Xt(),be=()=>qt,ht=(t,{token:a,customDomain:e=bt,thumbnailTime:i,programTime:r}={})=>{var u;let n=a==null?i:void 0,{aud:d}=(u=pt(a))!=null?u:{};if(!(a&&d!=="t"))return`https://image.${e}/${t}/thumbnail.webp${_e({token:a,time:n,program_time:r})}`},gt=(t,{token:a,customDomain:e=bt,programStartTime:i,programEndTime:r}={})=>{var d;let{aud:n}=(d=pt(a))!=null?d:{};if(!(a&&n!=="s"))return`https://image.${e}/${t}/storyboard.vtt${_e({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},ee=t=>{if(t){if([xe.LIVE,xe.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return xe.LIVE}};var Qt={crossorigin:"crossOrigin",playsinline:"playsInline"};function ft(t){var a;return(a=Qt[t])!=null?a:ce(t)}var D,U,C,pe=class{constructor(a,e){h(this,D);h(this,U);h(this,C,[]);f(this,D,a),f(this,U,e)}[Symbol.iterator](){return l(this,C).values()}get length(){return l(this,C).length}get value(){var a;return(a=l(this,C).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(f(this,C,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return l(this,C)[a]}values(){return l(this,C).values()}keys(){return l(this,C).keys()}forEach(a){l(this,C).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||l(this,C).push(r)}),!(this.value===""&&!((e=l(this,D))!=null&&e.hasAttribute(`${l(this,U)}`)))&&((i=l(this,D))==null||i.setAttribute(`${l(this,U)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{l(this,C).splice(l(this,C).indexOf(i),1)}),(e=l(this,D))==null||e.setAttribute(`${l(this,U)}`,`${this.value}`)}contains(a){return l(this,C).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};D=new WeakMap,U=new WeakMap,C=new WeakMap;var yt=`[mux-player ${be()}]`;function O(...t){console.warn(yt,...t)}function k(...t){console.error(yt,...t)}function Oe(t){var e;let a=(e=t.message)!=null?e:"";t.context&&(a+=` ${t.context}`),t.file&&(a+=` ${Jt("Read more: ")}
|
|
2
|
+
https://github.com/muxinc/elements/blob/main/errors/${t.file}`),O(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},I={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Xa={...y,...I},Tt=Object.freeze({length:0,start(t){let a=t>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(t){let a=t>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),ea=Object.values(y).filter(t=>y.PLAYSINLINE!==t),ta=Object.values(I),aa=[...ea,...ta],Le=class extends _.HTMLElement{static get observedAttributes(){return aa}constructor(){super()}attributeChangedCallback(a,e,i){var r,n;switch(a){case I.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case I.VOLUME:{let d=(r=A(i))!=null?r:1;this.media&&(this.media.volume=d);return}case I.PLAYBACKRATE:{let d=(n=A(i))!=null?n:1;this.media&&(this.media.playbackRate=d,this.media.defaultPlaybackRate=d);return}}}play(){var a,e;return(e=(a=this.media)==null?void 0:a.play())!=null?e:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}load(){var a;(a=this.media)==null||a.load()}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var a,e;return(e=(a=this.media)==null?void 0:a.paused)!=null?e:!0}get duration(){var a,e;return(e=(a=this.media)==null?void 0:a.duration)!=null?e:NaN}get ended(){var a,e;return(e=(a=this.media)==null?void 0:a.ended)!=null?e:!1}get buffered(){var a,e;return(e=(a=this.media)==null?void 0:a.buffered)!=null?e:Tt}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:Tt}get readyState(){var a,e;return(e=(a=this.media)==null?void 0:a.readyState)!=null?e:0}get videoWidth(){var a,e;return(e=(a=this.media)==null?void 0:a.videoWidth)!=null?e:0}get videoHeight(){var a,e;return(e=(a=this.media)==null?void 0:a.videoHeight)!=null?e:0}get currentSrc(){var a,e;return(e=(a=this.media)==null?void 0:a.currentSrc)!=null?e:""}get currentTime(){var a,e;return(e=(a=this.media)==null?void 0:a.currentTime)!=null?e:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,e;return(e=(a=this.media)==null?void 0:a.volume)!=null?e:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,e;return(e=(a=this.media)==null?void 0:a.playbackRate)!=null?e:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=A(this.getAttribute(I.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(I.PLAYBACKRATE,`${a}`):this.removeAttribute(I.PLAYBACKRATE)}get crossOrigin(){return te(this,y.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(y.CROSSORIGIN,`${a}`)}get autoplay(){return te(this,y.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(y.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(y.AUTOPLAY)}get loop(){return te(this,y.LOOP)!=null}set loop(a){a?this.setAttribute(y.LOOP,""):this.removeAttribute(y.LOOP)}get muted(){var a,e;return(e=(a=this.media)==null?void 0:a.muted)!=null?e:!1}set muted(a){this.media&&(this.media.muted=!!a)}get defaultMuted(){return te(this,y.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(y.MUTED,""):this.removeAttribute(y.MUTED)}get playsInline(){return te(this,y.PLAYSINLINE)!=null}set playsInline(a){k("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(a){["","none","metadata","auto"].includes(a)?this.setAttribute(y.PRELOAD,a):this.removeAttribute(y.PRELOAD)}};function te(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Me=Le;import"media-chrome/dist/media-theme-element.js";var Et=`:host {
|
|
3
3
|
--media-control-display: var(--controls);
|
|
4
4
|
--media-loading-indicator-display: var(--loading-indicator);
|
|
5
5
|
--media-dialog-display: var(--dialog);
|
|
@@ -149,24 +149,24 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
149
149
|
:host([no-tooltips]) {
|
|
150
150
|
--media-tooltip-display: none;
|
|
151
151
|
}
|
|
152
|
-
`;import{TemplateInstance as
|
|
152
|
+
`;import{TemplateInstance as ra,ChildNodePart as ge,AttrPart as fe}from"media-chrome/dist/media-theme-element.js";var ae=new WeakMap,Ne=class t{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let i=ae.get(this.element);i&&i.set(this.type,this)}set(a){if(typeof a=="function")this.handleEvent=a.bind(this.element);else if(typeof a=="object"&&typeof a.handleEvent=="function")this.handleEvent=a.handleEvent.bind(a);else{this.element.removeEventListener(this.type,this);let e=ae.get(this.element);e&&e.delete(this.type)}}static for(a){ae.has(a.element)||ae.set(a.element,new Map);let e=a.attributeName.slice(2),i=ae.get(a.element);return i&&i.has(e)?i.get(e):new t(a.element,e)}};function oa(t,a){return t instanceof fe&&t.attributeName.startsWith("on")?(Ne.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function na(t,a){return a instanceof he&&t instanceof ge?(a.renderInto(t),!0):!1}function sa(t,a){return a instanceof DocumentFragment&&t instanceof ge?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function da(t,a){if(t instanceof fe){let e=t.attributeNamespace,i=t.element.getAttributeNS(e,t.attributeName);return String(a)!==i&&(t.value=String(a)),!0}return t.value=String(a),!0}function la(t,a){if(t instanceof fe&&a instanceof Element){let e=t.element;return e[t.attributeName]!==a&&(t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),e[t.attributeName]=a),!0}return!1}function ua(t,a){if(typeof a=="boolean"&&t instanceof fe){let e=t.attributeNamespace,i=t.element.hasAttributeNS(e,t.attributeName);return a!==i&&(t.booleanValue=a),!0}return!1}function ma(t,a){return a===!1&&t instanceof ge?(t.replace(""),!0):!1}function ca(t,a){la(t,a)||ua(t,a)||oa(t,a)||ma(t,a)||na(t,a)||sa(t,a)||da(t,a)}var Se=new Map,At=new WeakMap,Ct=new WeakMap,he=class{constructor(a,e,i){this.strings=a;this.values=e;this.processor=i;this.stringsKey=this.strings.join("")}get template(){if(Se.has(this.stringsKey))return Se.get(this.stringsKey);{let a=w.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,n)=>i+r+(n<e?`{{ ${n} }}`:""),""),Se.set(this.stringsKey,a),a}}renderInto(a){var r;let e=this.template;if(At.get(a)!==e){At.set(a,e);let n=new ra(e,this.values,this.processor);Ct.set(a,n),a instanceof ge?a.replace(...n.children):a.appendChild(n);return}let i=Ct.get(a);(r=i==null?void 0:i.update)==null||r.call(i,this.values)}},pa={processCallback(t,a,e){var i;if(e){for(let[r,n]of a)if(r in e){let d=(i=e[r])!=null?i:"";ca(n,d)}}}};function ie(t,...a){return new he(t,a,pa)}function kt(t,a){t.renderInto(a)}import{StreamTypes as ba,toMuxVideoURL as _t}from"@mux/playback-core";var ha=t=>{let{tokens:a}=t;return a.drm?":host(:not([cast-receiver])) { --_cast-button-drm-display: none; }":""},Rt=t=>ie`
|
|
153
153
|
<style>
|
|
154
|
-
${
|
|
155
|
-
${
|
|
154
|
+
${ha(t)}
|
|
155
|
+
${Et}
|
|
156
156
|
</style>
|
|
157
|
-
${
|
|
158
|
-
`,
|
|
157
|
+
${va(t)}
|
|
158
|
+
`,ga=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return ee(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},fa={TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",THUMB:"thumb",DISPLAY:"display",CONTROL_BAR:"control-bar",MENU_BUTTON:"menu-button",MENU:"menu",MENU_ITEM:"menu-item",OPTION:"option",POSTER:"poster",LIVE:"live",PLAY:"play",PRE_PLAY:"pre-play",SEEK_BACKWARD:"seek-backward",SEEK_FORWARD:"seek-forward",MUTE:"mute",CAPTIONS:"captions",AIRPLAY:"airplay",PIP:"pip",FULLSCREEN:"fullscreen",CAST:"cast",PLAYBACK_RATE:"playback-rate",VOLUME:"volume",TIME:"time",TITLE:"title",AUDIO_TRACK:"audio-track",RENDITION:"rendition"},ya=Object.values(fa).join(", "),va=t=>{var a,e,i,r,n,d,u,b,R,j,z,E,v,x,F,g,ue,X,q,Ke,$e,Fe,Ye,We,Ze,Ge,je,ze,Xe,qe,Qe,Je,et,tt,at,it,rt,ot,nt,st,dt;return ie`
|
|
159
159
|
<media-theme
|
|
160
160
|
template="${t.themeTemplate||!1}"
|
|
161
161
|
defaultstreamtype="${(a=t.defaultStreamType)!=null?a:!1}"
|
|
162
|
-
hotkeys="${
|
|
162
|
+
hotkeys="${ga(t)||!1}"
|
|
163
163
|
nohotkeys="${t.noHotKeys||!t.hasSrc||!1}"
|
|
164
|
-
noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(
|
|
164
|
+
noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(ba.LIVE))&&t.targetLiveWindow!==0}"
|
|
165
165
|
novolumepref="${t.novolumepref||!1}"
|
|
166
166
|
nomutedpref="${t.nomutedpref||!1}"
|
|
167
167
|
disabled="${!t.hasSrc||t.isDialogOpen}"
|
|
168
168
|
audio="${(i=t.audio)!=null?i:!1}"
|
|
169
|
-
style="${(r=
|
|
169
|
+
style="${(r=ct({"--media-primary-color":t.primaryColor,"--media-secondary-color":t.secondaryColor,"--media-accent-color":t.accentColor}))!=null?r:!1}"
|
|
170
170
|
defaultsubtitles="${!t.defaultHiddenCaptions}"
|
|
171
171
|
forwardseekoffset="${(n=t.forwardSeekOffset)!=null?n:!1}"
|
|
172
172
|
backwardseekoffset="${(d=t.backwardSeekOffset)!=null?d:!1}"
|
|
@@ -177,7 +177,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
177
177
|
title="${(z=t.title)!=null?z:!1}"
|
|
178
178
|
videotitle="${(E=t.videoTitle)!=null?E:!1}"
|
|
179
179
|
proudlydisplaymuxbadge="${(v=t.proudlyDisplayMuxBadge)!=null?v:!1}"
|
|
180
|
-
exportparts="${
|
|
180
|
+
exportparts="${ya}"
|
|
181
181
|
onclose="${t.onCloseErrorDialog}"
|
|
182
182
|
onfocusin="${t.onFocusInErrorDialog}"
|
|
183
183
|
>
|
|
@@ -204,14 +204,15 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
204
204
|
player-software-version="${(qe=t.playerSoftwareVersion)!=null?qe:!1}"
|
|
205
205
|
env-key="${(Qe=t.envKey)!=null?Qe:!1}"
|
|
206
206
|
custom-domain="${(Je=t.customDomain)!=null?Je:!1}"
|
|
207
|
-
src="${t.src?t.src:t.playbackId?
|
|
208
|
-
cast-src="${t.src?t.src:t.playbackId?
|
|
207
|
+
src="${t.src?t.src:t.playbackId?_t(t):!1}"
|
|
208
|
+
cast-src="${t.src?t.src:t.playbackId?_t(t):!1}"
|
|
209
209
|
cast-receiver="${(et=t.castReceiver)!=null?et:!1}"
|
|
210
210
|
drm-token="${(at=(tt=t.tokens)==null?void 0:tt.drm)!=null?at:!1}"
|
|
211
|
+
playback-token="${(rt=(it=t.tokens)==null?void 0:it.playback)!=null?rt:!1}"
|
|
211
212
|
exportparts="video"
|
|
212
|
-
disable-pseudo-ended="${(
|
|
213
|
-
max-auto-resolution="${(
|
|
214
|
-
cap-rendition-to-player-size="${(
|
|
213
|
+
disable-pseudo-ended="${(ot=t.disablePseudoEnded)!=null?ot:!1}"
|
|
214
|
+
max-auto-resolution="${(nt=t.maxAutoResolution)!=null?nt:!1}"
|
|
215
|
+
cap-rendition-to-player-size="${(st=t.capRenditionToPlayerSize)!=null?st:!1}"
|
|
215
216
|
>
|
|
216
217
|
${t.storyboard?ie`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:ie``}
|
|
217
218
|
<slot></slot>
|
|
@@ -221,11 +222,11 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
221
222
|
part="poster"
|
|
222
223
|
exportparts="poster, img"
|
|
223
224
|
src="${t.poster?t.poster:!1}"
|
|
224
|
-
placeholdersrc="${(
|
|
225
|
+
placeholdersrc="${(dt=t.placeholder)!=null?dt:!1}"
|
|
225
226
|
></media-poster-image>
|
|
226
227
|
</slot>
|
|
227
228
|
</media-theme>
|
|
228
|
-
`};import{errorCategoryToTokenNameOrPrefix as
|
|
229
|
+
`};import{errorCategoryToTokenNameOrPrefix as xt,i18n as T,MediaError as M,MuxErrorCategory as Ot,MuxErrorCode as c}from"@mux/playback-core";var Lt=t=>t.charAt(0).toUpperCase()+t.slice(1),Ta=(t,a=!1)=>{var e,i;if(t.muxCode){let r=Lt((e=t.errorCategory)!=null?e:"video"),n=xt((i=t.errorCategory)!=null?i:Ot.VIDEO);if(t.muxCode===c.NETWORK_OFFLINE)return T("Your device appears to be offline",a);if(t.muxCode===c.NETWORK_TOKEN_EXPIRED)return T("{category} URL has expired",a).format({category:r});if([c.NETWORK_TOKEN_SUB_MISMATCH,c.NETWORK_TOKEN_AUD_MISMATCH,c.NETWORK_TOKEN_AUD_MISSING,c.NETWORK_TOKEN_MALFORMED].includes(t.muxCode))return T("{category} URL is formatted incorrectly",a).format({category:r});if(t.muxCode===c.NETWORK_TOKEN_MISSING)return T("Invalid {categoryName} URL",a).format({categoryName:n});if(t.muxCode===c.NETWORK_NOT_FOUND)return T("{category} does not exist",a).format({category:r});if(t.muxCode===c.NETWORK_NOT_READY){let d=t.streamType==="live"?"Live stream":"Video";return T("{mediaType} is not currently available",a).format({mediaType:d})}}if(t.code){if(t.code===M.MEDIA_ERR_NETWORK)return T("Network Error",a);if(t.code===M.MEDIA_ERR_DECODE)return T("Media Error",a);if(t.code===M.MEDIA_ERR_SRC_NOT_SUPPORTED)return T("Source Not Supported",a)}return T("Error",a)},Ea=(t,a=!1)=>{var e,i;if(t.muxCode){let r=Lt((e=t.errorCategory)!=null?e:"video"),n=xt((i=t.errorCategory)!=null?i:Ot.VIDEO);return t.muxCode===c.NETWORK_OFFLINE?T("Check your internet connection and try reloading this video.",a):t.muxCode===c.NETWORK_TOKEN_EXPIRED?T("The video\u2019s secured {tokenNamePrefix}-token has expired.",a).format({tokenNamePrefix:n}):t.muxCode===c.NETWORK_TOKEN_SUB_MISMATCH?T("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",a).format({tokenNamePrefix:n}):t.muxCode===c.NETWORK_TOKEN_MALFORMED?T("{category} URL is formatted incorrectly",a).format({category:r}):[c.NETWORK_TOKEN_AUD_MISMATCH,c.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode)?T("The {tokenNamePrefix}-token is formatted with incorrect information.",a).format({tokenNamePrefix:n}):[c.NETWORK_TOKEN_MISSING,c.NETWORK_INVALID_URL].includes(t.muxCode)?T("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",a).format({tokenNamePrefix:n}):t.muxCode===c.NETWORK_NOT_FOUND?"":t.message}return t.code&&(t.code===M.MEDIA_ERR_NETWORK||t.code===M.MEDIA_ERR_DECODE||t.code===M.MEDIA_ERR_SRC_NOT_SUPPORTED),t.message},Mt=(t,a=!1)=>{let e=Ta(t,a).toString(),i=Ea(t,a).toString();return{title:e,message:i}},Aa=t=>{if(t.muxCode){if(t.muxCode===c.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(t.muxCode===c.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([c.NETWORK_TOKEN_AUD_MISMATCH,c.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode))return"403-incorrect-aud-value.md";if(t.muxCode===c.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(t.muxCode===c.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(t.muxCode===c.NETWORK_NOT_FOUND)return"404-not-found.md";if(t.muxCode===c.NETWORK_NOT_READY)return"412-not-playable.md"}if(t.code){if(t.code===M.MEDIA_ERR_NETWORK)return"";if(t.code===M.MEDIA_ERR_DECODE)return"media-decode-error.md";if(t.code===M.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},Ie=(t,a)=>{let e=Aa(t);return{message:t.message,context:t.context,file:e}};var St=`<template id="media-theme-gerwig">
|
|
229
230
|
<style>
|
|
230
231
|
@keyframes pre-play-hide {
|
|
231
232
|
0% {
|
|
@@ -1357,7 +1358,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
1357
1358
|
<slot></slot>
|
|
1358
1359
|
</media-controller>
|
|
1359
1360
|
</template>
|
|
1360
|
-
`;import{MediaThemeElement as
|
|
1361
|
+
`;import{MediaThemeElement as ka}from"media-chrome/dist/media-theme-element.js";import"media-chrome/dist/menu";var Pe=w.createElement("template");"innerHTML"in Pe&&(Pe.innerHTML=St);var Nt,It,ye=class extends ka{};ye.template=(It=(Nt=Pe.content)==null?void 0:Nt.children)==null?void 0:It[0];_.customElements.get("media-theme-gerwig")||_.customElements.define("media-theme-gerwig",ye);var La="gerwig",S={SRC:"src",POSTER:"poster"},o={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",FULLSCREEN_ELEMENT:"fullscreen-element",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",VIDEO_TITLE:"video-title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",NO_MUTED_PREF:"no-muted-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips",PROUDLY_DISPLAY_MUX_BADGE:"proudly-display-mux-badge",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended"},Ve=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","videotitle","novolumepref","nomutedpref","proudlydisplaymuxbadge"];function Ma(t,a){var i,r,n;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src||!!t.currentSrc,poster:t.poster,storyboard:((i=t.media)==null?void 0:i.currentSrc)&&t.storyboard,storyboardSrc:t.getAttribute(o.STORYBOARD_SRC),fullscreenElement:t.getAttribute(o.FULLSCREEN_ELEMENT),placeholder:t.getAttribute("placeholder"),themeTemplate:Na(t),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(o.NOHOTKEYS),hotKeys:t.getAttribute(o.HOTKEYS),muted:t.muted,paused:t.paused,preload:t.preload,envKey:t.envKey,preferCmcd:t.preferCmcd,debug:t.debug,disableTracking:t.disableTracking,disableCookies:t.disableCookies,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,maxResolution:t.maxResolution,minResolution:t.minResolution,maxAutoResolution:t.maxAutoResolution,programStartTime:t.programStartTime,programEndTime:t.programEndTime,assetStartTime:t.assetStartTime,assetEndTime:t.assetEndTime,renditionOrder:t.renditionOrder,metadata:t.metadata,playerInitTime:t.playerInitTime,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,defaultStreamType:t.defaultStreamType,targetLiveWindow:t.getAttribute(s.TARGET_LIVE_WINDOW),streamType:ee(t.getAttribute(s.STREAM_TYPE)),primaryColor:t.getAttribute(o.PRIMARY_COLOR),secondaryColor:t.getAttribute(o.SECONDARY_COLOR),accentColor:t.getAttribute(o.ACCENT_COLOR),forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultDuration:t.defaultDuration,defaultShowRemainingTime:t.defaultShowRemainingTime,hideDuration:Ia(t),playbackRates:t.getAttribute(o.PLAYBACK_RATES),customDomain:(r=t.getAttribute(s.CUSTOM_DOMAIN))!=null?r:void 0,title:t.getAttribute(o.TITLE),videoTitle:(n=t.getAttribute(o.VIDEO_TITLE))!=null?n:t.getAttribute(o.TITLE),novolumepref:t.hasAttribute(o.NO_VOLUME_PREF),nomutedpref:t.hasAttribute(o.NO_MUTED_PREF),proudlyDisplayMuxBadge:t.hasAttribute(o.PROUDLY_DISPLAY_MUX_BADGE),castReceiver:t.castReceiver,disablePseudoEnded:t.hasAttribute(o.DISABLE_PSEUDO_ENDED),capRenditionToPlayerSize:t.capRenditionToPlayerSize,...a,extraSourceParams:t.extraSourceParams}}var Sa=Kt.formatErrorMessage;Kt.formatErrorMessage=t=>{var a,e;if(t instanceof Ee){let i=Mt(t,!1);return`
|
|
1361
1362
|
${i!=null&&i.title?`<h3>${i.title}</h3>`:""}
|
|
1362
1363
|
${i!=null&&i.message||i!=null&&i.linkUrl?`<p>
|
|
1363
1364
|
${i==null?void 0:i.message}
|
|
@@ -1369,5 +1370,5 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
1369
1370
|
>${(e=i.linkText)!=null?e:i.linkUrl}</a
|
|
1370
1371
|
>`:""}
|
|
1371
1372
|
</p>`:""}
|
|
1372
|
-
`}return La(t)};function Ma(t){var e,i;let a=t.theme;if(a){let r=(i=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:i.call(e,a);if(r&&r instanceof HTMLTemplateElement)return r;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let n=_.customElements.get(a);if(n!=null&&n.template)return n.template}}function Sa(t){var e;let a=(e=t.mediaController)==null?void 0:e.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function wt(t){let a=t.videoTitle?{video_title:t.videoTitle}:{};return t.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=t.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},a)}var Na=Object.values(s),Ia=Object.values(S),Pa=Object.values(o),Dt=be(),Ut="mux-player",Vt={isDialogOpen:!1},wa={redundant_streams:!0},re,W,oe,P,ne,Z,se,de,K,G,$,le,m,N,Ht,He,H,Kt,$t,Ft,Yt,Be=class extends Me{constructor(){super();h(this,m);h(this,re);h(this,W,!1);h(this,oe,{});h(this,P,!0);h(this,ne,new pe(this,"hotkeys"));h(this,Z);h(this,se,()=>p(this,m,H).call(this));h(this,de,()=>p(this,m,H).call(this));h(this,K,()=>p(this,m,H).call(this));h(this,G);h(this,$,{...Vt,onCloseErrorDialog:e=>{var r;((r=e.composedPath()[0])==null?void 0:r.localName)==="media-error-dialog"&&p(this,m,He).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:e=>{var n;if(((n=e.composedPath()[0])==null?void 0:n.localName)!=="media-error-dialog")return;Re(this,w.activeElement)||e.preventDefault()}});h(this,le,e=>{var n;let i=(n=this.media)==null?void 0:n.error;if(!(i instanceof Ee)){let{message:d,code:u}=i!=null?i:{};i=new Ee(d,u)}if(!(i!=null&&i.fatal)){O(i),i.data&&O(`${i.name} data:`,i.data);return}let r=Ie(i,!1);r.message&&Oe(r),k(i),i.data&&k(`${i.name} data:`,i.data),p(this,m,He).call(this,{isDialogOpen:!0})});f(this,re,Ra()),this.attachShadow({mode:"open"}),p(this,m,Ht).call(this),this.isConnected&&p(this,m,N).call(this)}static get NAME(){return Ut}static get VERSION(){return Dt}static get observedAttributes(){var e;return[...(e=Me.observedAttributes)!=null?e:[],...Ia,...Na,...Pa]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}connectedCallback(){p(this,m,N).call(this);let e=this.media;e&&(e.metadata=wt(this))}disconnectedCallback(){var e,i,r,n,d,u,b,R;(e=l(this,Z))==null||e.disconnect(),(i=this.media)==null||i.removeEventListener("streamtypechange",l(this,se)),(r=this.media)==null||r.removeEventListener("loadstart",l(this,de)),this.removeEventListener("error",l(this,le)),this.media&&(this.media.errorTranslator=void 0),(d=(n=this.media)==null?void 0:n.textTracks)==null||d.removeEventListener("addtrack",l(this,K)),(b=(u=this.media)==null?void 0:u.textTracks)==null||b.removeEventListener("removetrack",l(this,K)),(R=l(this,G))==null||R.call(this),f(this,G,void 0),f(this,W,!1)}attributeChangedCallback(e,i,r){switch(p(this,m,N).call(this),super.attributeChangedCallback(e,i,r),e){case o.HOTKEYS:l(this,ne).value=r;break;case o.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&O(B("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break}case o.THUMBNAIL_TOKEN:{if(r){let d=De(r);if(d){let{aud:u}=d,b=Ue.THUMBNAIL;u!==b&&O(B("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:u,expectedAud:b,tokenNamePrefix:"thumbnail"}))}}break}case o.STORYBOARD_TOKEN:{if(r){let d=De(r);if(d){let{aud:u}=d,b=Ue.STORYBOARD;u!==b&&O(B("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:u,expectedAud:b,tokenNamePrefix:"storyboard"}))}}break}case o.DRM_TOKEN:{if(r){let d=De(r);if(d){let{aud:u}=d,b=Ue.DRM;u!==b&&O(B("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:u,expectedAud:b,tokenNamePrefix:"drm"}))}}break}case s.PLAYBACK_ID:{r!=null&&r.includes("?token")&&k(B("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case s.STREAM_TYPE:{r&&![L.LIVE,L.ON_DEMAND,L.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:Oe({file:"invalid-stream-type.md",message:B("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===L.LIVE?this.getAttribute(o.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN;break}case o.FULLSCREEN_ELEMENT:{if(r!=null||r!==i){let d=w.getElementById(r),u=d==null?void 0:d.querySelector("mux-player");this.mediaController&&d&&u&&(this.mediaController.fullscreenElement=d)}break}case s.CAP_RENDITION_TO_PLAYER_SIZE:{(r==null||r!==i)&&(this.capRenditionToPlayerSize=r!=null?!0:void 0);break}}[s.PLAYBACK_ID,S.SRC,o.PLAYBACK_TOKEN].includes(e)&&i!==r&&f(this,$,{...l(this,$),...Vt}),p(this,m,H).call(this,{[ht(e)]:r})}async requestFullscreen(e){var i;if(!(!this.mediaController||this.mediaController.hasAttribute(ve.MEDIA_IS_FULLSCREEN)))return(i=this.mediaController)==null||i.dispatchEvent(new _.CustomEvent(It.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((r,n)=>{var d;(d=this.mediaController)==null||d.addEventListener(Nt.MEDIA_IS_FULLSCREEN,()=>r(),{once:!0})})}async exitFullscreen(){var e;if(!(!this.mediaController||!this.mediaController.hasAttribute(ve.MEDIA_IS_FULLSCREEN)))return(e=this.mediaController)==null||e.dispatchEvent(new _.CustomEvent(It.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((i,r)=>{var n;(n=this.mediaController)==null||n.addEventListener(Nt.MEDIA_IS_FULLSCREEN,()=>i(),{once:!0})})}get preferCmcd(){var e;return(e=this.getAttribute(s.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Pt.includes(e)?this.setAttribute(s.PREFER_CMCD,e):O(`Invalid value for preferCmcd. Must be one of ${Pt.join()}`):this.removeAttribute(s.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute(ve.MEDIA_HAS_PLAYED))!=null?i:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(ve.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get theme(){var e;return(e=this.getAttribute(o.THEME))!=null?e:xa}set theme(e){this.setAttribute(o.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let i={};for(let r of e.getAttributeNames()){if(Ve.includes(r))continue;let n=e.getAttribute(r);i[ce(r)]=n===""?!0:n}return i}set themeProps(e){var r,n;p(this,m,N).call(this);let i={...this.themeProps,...e};for(let d in i){if(Ve.includes(d))continue;let u=e==null?void 0:e[d];typeof u=="boolean"||u==null?(r=this.mediaTheme)==null||r.toggleAttribute(me(d),!!u):(n=this.mediaTheme)==null||n.setAttribute(me(d),u)}}get playbackId(){var e;return(e=this.getAttribute(s.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(s.PLAYBACK_ID,e):this.removeAttribute(s.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=V(this,S.SRC))!=null?e:void 0:(i=this.getAttribute(S.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(S.SRC,e):this.removeAttribute(S.SRC)}get poster(){var r;let e=this.getAttribute(S.POSTER);if(e!=null)return e;let{tokens:i}=this;if(i.playback&&!i.thumbnail){O("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return pt(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,programTime:this.programStartTime,token:i.thumbnail})}set poster(e){e||e===""?this.setAttribute(S.POSTER,e):this.removeAttribute(S.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(o.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(o.STORYBOARD_SRC,e):this.removeAttribute(o.STORYBOARD_SRC)}get storyboard(){let{tokens:e}=this;if(this.storyboardSrc&&!e.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[L.LIVE,L.UNKNOWN].includes(this.streamType)||e.playback&&!e.storyboard))return bt(this.playbackId,{customDomain:this.customDomain,token:e.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(o.AUDIO)}set audio(e){if(!e){this.removeAttribute(o.AUDIO);return}this.setAttribute(o.AUDIO,"")}get hotkeys(){return l(this,ne)}get nohotkeys(){return this.hasAttribute(o.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(o.NOHOTKEYS);return}this.setAttribute(o.NOHOTKEYS,"")}get thumbnailTime(){return A(this.getAttribute(o.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(o.THUMBNAIL_TIME,`${e}`)}get videoTitle(){var e,i;return(i=(e=this.getAttribute(o.VIDEO_TITLE))!=null?e:this.getAttribute(o.TITLE))!=null?i:""}set videoTitle(e){e!==this.videoTitle&&(e?this.setAttribute(o.VIDEO_TITLE,e):this.removeAttribute(o.VIDEO_TITLE))}get placeholder(){var e;return(e=V(this,o.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(o.PLACEHOLDER,`${e}`)}get primaryColor(){var i,r;let e=this.getAttribute(o.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=_.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),e))return e}set primaryColor(e){this.setAttribute(o.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var i,r;let e=this.getAttribute(o.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=_.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),e))return e}set secondaryColor(e){this.setAttribute(o.SECONDARY_COLOR,`${e}`)}get accentColor(){var i,r;let e=this.getAttribute(o.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=_.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),e))return e}set accentColor(e){this.setAttribute(o.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(o.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(o.PLAYBACK_RATES))return this.getAttribute(o.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(o.PLAYBACK_RATES);return}this.setAttribute(o.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=A(this.getAttribute(o.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(o.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=A(this.getAttribute(o.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(o.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(o.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return A(this.getAttribute(o.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute(o.DEFAULT_DURATION):this.setAttribute(o.DEFAULT_DURATION,`${e}`)}get playerInitTime(){return this.hasAttribute(s.PLAYER_INIT_TIME)?A(this.getAttribute(s.PLAYER_INIT_TIME)):l(this,re)}set playerInitTime(e){e!=this.playerInitTime&&(e==null?this.removeAttribute(s.PLAYER_INIT_TIME):this.setAttribute(s.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_NAME))!=null?e:Ut}get playerSoftwareVersion(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_VERSION))!=null?e:Dt}get beaconCollectionDomain(){var e;return(e=this.getAttribute(s.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(s.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(s.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(s.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(s.MAX_RESOLUTION,e):this.removeAttribute(s.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(s.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(s.MIN_RESOLUTION,e):this.removeAttribute(s.MIN_RESOLUTION))}get maxAutoResolution(){var e;return(e=this.getAttribute(s.MAX_AUTO_RESOLUTION))!=null?e:void 0}set maxAutoResolution(e){e==null?this.removeAttribute(s.MAX_AUTO_RESOLUTION):this.setAttribute(s.MAX_AUTO_RESOLUTION,e)}get renditionOrder(){var e;return(e=this.getAttribute(s.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(s.RENDITION_ORDER,e):this.removeAttribute(s.RENDITION_ORDER))}get programStartTime(){return A(this.getAttribute(s.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(s.PROGRAM_START_TIME):this.setAttribute(s.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return A(this.getAttribute(s.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(s.PROGRAM_END_TIME):this.setAttribute(s.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){return A(this.getAttribute(s.ASSET_START_TIME))}set assetStartTime(e){e==null?this.removeAttribute(s.ASSET_START_TIME):this.setAttribute(s.ASSET_START_TIME,`${e}`)}get assetEndTime(){return A(this.getAttribute(s.ASSET_END_TIME))}set assetEndTime(e){e==null?this.removeAttribute(s.ASSET_END_TIME):this.setAttribute(s.ASSET_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(o.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(o.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[i,r])=>(e[i]=r,e),{}):wa}set extraSourceParams(e){e==null?this.removeAttribute(o.EXTRA_SOURCE_PARAMS):this.setAttribute(o.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(s.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(s.CUSTOM_DOMAIN,e):this.removeAttribute(s.CUSTOM_DOMAIN))}get envKey(){var e;return(e=V(this,s.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(s.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(o.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(o.NO_VOLUME_PREF,""):this.removeAttribute(o.NO_VOLUME_PREF)}get noMutedPref(){return this.hasAttribute(o.NO_MUTED_PREF)}set noMutedPref(e){e?this.setAttribute(o.NO_MUTED_PREF,""):this.removeAttribute(o.NO_MUTED_PREF)}get debug(){return V(this,s.DEBUG)!=null}set debug(e){e?this.setAttribute(s.DEBUG,""):this.removeAttribute(s.DEBUG)}get disableTracking(){return V(this,s.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(s.DISABLE_TRACKING,!!e)}get disableCookies(){return V(this,s.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(s.DISABLE_COOKIES,""):this.removeAttribute(s.DISABLE_COOKIES)}get streamType(){var e,i,r;return(r=(i=this.getAttribute(s.STREAM_TYPE))!=null?i:(e=this.media)==null?void 0:e.streamType)!=null?r:L.UNKNOWN}set streamType(e){this.setAttribute(s.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,i,r;return(r=(i=this.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?i:(e=this.mediaController)==null?void 0:e.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?r:L.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(o.DEFAULT_STREAM_TYPE,e):this.removeAttribute(o.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,i;return this.hasAttribute(o.TARGET_LIVE_WINDOW)?+this.getAttribute(o.TARGET_LIVE_WINDOW):(i=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?i:Number.NaN}set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(e==null?this.removeAttribute(o.TARGET_LIVE_WINDOW):this.setAttribute(o.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return A(V(this,s.START_TIME))}set startTime(e){this.setAttribute(s.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(s.PREFER_PLAYBACK);if(e===Te.MSE||e===Te.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===Te.MSE||e===Te.NATIVE?this.setAttribute(s.PREFER_PLAYBACK,e):this.removeAttribute(s.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(p(this,m,N).call(this),!this.media){k("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...wt(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(p(this,m,N).call(this),!this.media){k("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var i;if(p(this,m,N).call(this),!this.media){k("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(i=this.media)==null?void 0:i.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,i;return(i=(e=this.media)==null?void 0:e.cuePoints)!=null?i:[]}addChapters(e){var i;if(p(this,m,N).call(this),!this.media){k("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(i=this.media)==null?void 0:i.addChapters(e)}get activeChapter(){var e;return(e=this.media)==null?void 0:e.activeChapter}get chapters(){var e,i;return(i=(e=this.media)==null?void 0:e.chapters)!=null?i:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(o.PLAYBACK_TOKEN),i=this.getAttribute(o.DRM_TOKEN),r=this.getAttribute(o.THUMBNAIL_TOKEN),n=this.getAttribute(o.STORYBOARD_TOKEN);return{...l(this,oe),...e!=null?{playback:e}:{},...i!=null?{drm:i}:{},...r!=null?{thumbnail:r}:{},...n!=null?{storyboard:n}:{}}}set tokens(e){f(this,oe,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(o.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(o.PLAYBACK_TOKEN,`${e}`)}get drmToken(){var e;return(e=this.getAttribute(o.DRM_TOKEN))!=null?e:void 0}set drmToken(e){this.setAttribute(o.DRM_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(o.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(o.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(o.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(o.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,n){var u;let d=(u=this.media)==null?void 0:u.nativeEl;if(d)return ka(d,e,i,r,n)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(i)return _a(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}get castReceiver(){var e;return(e=this.getAttribute(o.CAST_RECEIVER))!=null?e:void 0}set castReceiver(e){e!==this.castReceiver&&(e?this.setAttribute(o.CAST_RECEIVER,e):this.removeAttribute(o.CAST_RECEIVER))}get castCustomData(){var e;return(e=this.media)==null?void 0:e.castCustomData}set castCustomData(e){if(!this.media){k("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=e}get noTooltips(){return this.hasAttribute(o.NO_TOOLTIPS)}set noTooltips(e){if(!e){this.removeAttribute(o.NO_TOOLTIPS);return}this.setAttribute(o.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(o.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(e){e?this.setAttribute(o.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(o.PROUDLY_DISPLAY_MUX_BADGE)}get capRenditionToPlayerSize(){var e;return(e=this.media)==null?void 0:e.capRenditionToPlayerSize}set capRenditionToPlayerSize(e){if(!this.media){k("underlying media element missing when trying to set capRenditionToPlayerSize");return}this.media.capRenditionToPlayerSize=e}};re=new WeakMap,W=new WeakMap,oe=new WeakMap,P=new WeakMap,ne=new WeakMap,Z=new WeakMap,se=new WeakMap,de=new WeakMap,K=new WeakMap,G=new WeakMap,$=new WeakMap,le=new WeakMap,m=new WeakSet,N=function(){var e,i,r,n;if(!l(this,W)){f(this,W,!0),p(this,m,H).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof _.HTMLElement))throw""}catch{k("<media-theme> failed to upgrade!")}try{customElements.upgrade(this.media)}catch{k("underlying media element failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof Ca))throw""}catch{k("<media-controller> failed to upgrade!")}p(this,m,Kt).call(this),p(this,m,$t).call(this),p(this,m,Ft).call(this),f(this,P,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(we.USER_INACTIVE))!=null?i:!0),p(this,m,Yt).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",l(this,se)),(n=this.media)==null||n.addEventListener("loadstart",l(this,de))}},Ht=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},He=function(e){Object.assign(l(this,$),e),p(this,m,H).call(this)},H=function(e={}){At(kt(Oa(this,{...l(this,$),...e})),this.shadowRoot)},Kt=function(){let e=i=>{var d,u;if(!(i!=null&&i.startsWith("theme-")))return;let r=i.replace(/^theme-/,"");if(Ve.includes(r))return;let n=this.getAttribute(i);n!=null?(d=this.mediaTheme)==null||d.setAttribute(r,n):(u=this.mediaTheme)==null||u.removeAttribute(r)};f(this,Z,new MutationObserver(i=>{for(let{attributeName:r}of i)e(r)})),l(this,Z).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},$t=function(){this.addEventListener("error",l(this,le)),this.media&&(this.media.errorTranslator=(e={})=>{var r,n,d;if(!(((r=this.media)==null?void 0:r.error)instanceof Ee))return e;let i=Ie((n=this.media)==null?void 0:n.error,!1);return{player_error_code:(d=this.media)==null?void 0:d.error.code,player_error_message:i.message?String(i.message):e.player_error_message,player_error_context:i.context?String(i.context):e.player_error_context}})},Ft=function(){var e,i,r,n;(i=(e=this.media)==null?void 0:e.textTracks)==null||i.addEventListener("addtrack",l(this,K)),(n=(r=this.media)==null?void 0:r.textTracks)==null||n.addEventListener("removetrack",l(this,K))},Yt=function(){var j,z;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,n=()=>this.streamType===L.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,d=(E,v,x=!1)=>{if(n())return;Array.from(E&&E.activeCues||[]).forEach(g=>{if(!(!g.snapToLines||g.line<-5||g.line>=0&&g.line<10))if(!v||this.paused){let ue=g.text.split(`
|
|
1373
|
-
`).length,X=-3;this.streamType===L.LIVE&&(X=-2);let q=X-ue;if(g.line===q&&!x)return;r.has(g)||r.set(g,g.line),g.line=q}else setTimeout(()=>{g.line=r.get(g)||"auto"},500)})},u=()=>{var E,v;d(i,(v=(E=this.mediaController)==null?void 0:E.hasAttribute(we.USER_INACTIVE))!=null?v:!1)},b=()=>{var x,F;let v=Array.from(((F=(x=this.mediaController)==null?void 0:x.media)==null?void 0:F.textTracks)||[]).filter(g=>["subtitles","captions"].includes(g.kind)&&g.mode==="showing")[0];v!==i&&(i==null||i.removeEventListener("cuechange",u)),i=v,i==null||i.addEventListener("cuechange",u),d(i,l(this,P))};b(),(j=this.textTracks)==null||j.addEventListener("change",b),(z=this.textTracks)==null||z.addEventListener("addtrack",b);let R=()=>{var v,x;let E=(x=(v=this.mediaController)==null?void 0:v.hasAttribute(we.USER_INACTIVE))!=null?x:!0;l(this,P)!==E&&(f(this,P,E),d(i,l(this,P)))};this.addEventListener("userinactivechange",R),f(this,G,()=>{var E,v;i==null||i.removeEventListener("cuechange",u),(E=this.textTracks)==null||E.removeEventListener("change",b),(v=this.textTracks)==null||v.removeEventListener("addtrack",b),this.removeEventListener("userinactivechange",R)})};function V(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var
|
|
1373
|
+
`}return Sa(t)};function Na(t){var e,i;let a=t.theme;if(a){let r=(i=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:i.call(e,a);if(r&&r instanceof HTMLTemplateElement)return r;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let n=_.customElements.get(a);if(n!=null&&n.template)return n.template}}function Ia(t){var e;let a=(e=t.mediaController)==null?void 0:e.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function Ut(t){let a=t.videoTitle?{video_title:t.videoTitle}:{};return t.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=t.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},a)}var Pa=Object.values(s),wa=Object.values(S),Da=Object.values(o),Vt=be(),Bt="mux-player",Ht={isDialogOpen:!1},Ua={redundant_streams:!0},re,W,oe,P,ne,Z,se,de,K,G,$,le,m,N,$t,He,H,Ft,Yt,Wt,Zt,Be=class extends Me{constructor(){super();h(this,m);h(this,re);h(this,W,!1);h(this,oe,{});h(this,P,!0);h(this,ne,new pe(this,"hotkeys"));h(this,Z);h(this,se,()=>p(this,m,H).call(this));h(this,de,()=>p(this,m,H).call(this));h(this,K,()=>p(this,m,H).call(this));h(this,G);h(this,$,{...Ht,onCloseErrorDialog:e=>{var r;((r=e.composedPath()[0])==null?void 0:r.localName)==="media-error-dialog"&&p(this,m,He).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:e=>{var n;if(((n=e.composedPath()[0])==null?void 0:n.localName)!=="media-error-dialog")return;Re(this,w.activeElement)||e.preventDefault()}});h(this,le,e=>{var n;let i=(n=this.media)==null?void 0:n.error;if(!(i instanceof Ee)){let{message:d,code:u}=i!=null?i:{};i=new Ee(d,u)}if(!(i!=null&&i.fatal)){O(i),i.data&&O(`${i.name} data:`,i.data);return}let r=Ie(i,!1);r.message&&Oe(r),k(i),i.data&&k(`${i.name} data:`,i.data),p(this,m,He).call(this,{isDialogOpen:!0})});f(this,re,Oa()),this.attachShadow({mode:"open"}),p(this,m,$t).call(this),this.isConnected&&p(this,m,N).call(this)}static get NAME(){return Bt}static get VERSION(){return Vt}static get observedAttributes(){var e;return[...(e=Me.observedAttributes)!=null?e:[],...wa,...Pa,...Da]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}connectedCallback(){p(this,m,N).call(this);let e=this.media;e&&(e.metadata=Ut(this))}disconnectedCallback(){var e,i,r,n,d,u,b,R;(e=l(this,Z))==null||e.disconnect(),(i=this.media)==null||i.removeEventListener("streamtypechange",l(this,se)),(r=this.media)==null||r.removeEventListener("loadstart",l(this,de)),this.removeEventListener("error",l(this,le)),this.media&&(this.media.errorTranslator=void 0),(d=(n=this.media)==null?void 0:n.textTracks)==null||d.removeEventListener("addtrack",l(this,K)),(b=(u=this.media)==null?void 0:u.textTracks)==null||b.removeEventListener("removetrack",l(this,K)),(R=l(this,G))==null||R.call(this),f(this,G,void 0),f(this,W,!1)}attributeChangedCallback(e,i,r){switch(p(this,m,N).call(this),super.attributeChangedCallback(e,i,r),e){case o.HOTKEYS:l(this,ne).value=r;break;case o.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&O(B("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break}case o.THUMBNAIL_TOKEN:{if(r){let d=De(r);if(d){let{aud:u}=d,b=Ue.THUMBNAIL;u!==b&&O(B("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:u,expectedAud:b,tokenNamePrefix:"thumbnail"}))}}break}case o.STORYBOARD_TOKEN:{if(r){let d=De(r);if(d){let{aud:u}=d,b=Ue.STORYBOARD;u!==b&&O(B("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:u,expectedAud:b,tokenNamePrefix:"storyboard"}))}}break}case o.DRM_TOKEN:{if(r){let d=De(r);if(d){let{aud:u}=d,b=Ue.DRM;u!==b&&O(B("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:u,expectedAud:b,tokenNamePrefix:"drm"}))}}break}case s.PLAYBACK_ID:{r!=null&&r.includes("?token")&&k(B("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case s.STREAM_TYPE:{r&&![L.LIVE,L.ON_DEMAND,L.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:Oe({file:"invalid-stream-type.md",message:B("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===L.LIVE?this.getAttribute(o.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN;break}case o.FULLSCREEN_ELEMENT:{if(r!=null||r!==i){let d=w.getElementById(r),u=d==null?void 0:d.querySelector("mux-player");this.mediaController&&d&&u&&(this.mediaController.fullscreenElement=d)}break}case s.CAP_RENDITION_TO_PLAYER_SIZE:{(r==null||r!==i)&&(this.capRenditionToPlayerSize=r!=null?!0:void 0);break}}[s.PLAYBACK_ID,S.SRC,o.PLAYBACK_TOKEN].includes(e)&&i!==r&&f(this,$,{...l(this,$),...Ht}),p(this,m,H).call(this,{[ft(e)]:r})}async requestFullscreen(e){var i;if(!(!this.mediaController||this.mediaController.hasAttribute(ve.MEDIA_IS_FULLSCREEN)))return(i=this.mediaController)==null||i.dispatchEvent(new _.CustomEvent(wt.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((r,n)=>{var d;(d=this.mediaController)==null||d.addEventListener(Pt.MEDIA_IS_FULLSCREEN,()=>r(),{once:!0})})}async exitFullscreen(){var e;if(!(!this.mediaController||!this.mediaController.hasAttribute(ve.MEDIA_IS_FULLSCREEN)))return(e=this.mediaController)==null||e.dispatchEvent(new _.CustomEvent(wt.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((i,r)=>{var n;(n=this.mediaController)==null||n.addEventListener(Pt.MEDIA_IS_FULLSCREEN,()=>i(),{once:!0})})}get preferCmcd(){var e;return(e=this.getAttribute(s.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Dt.includes(e)?this.setAttribute(s.PREFER_CMCD,e):O(`Invalid value for preferCmcd. Must be one of ${Dt.join()}`):this.removeAttribute(s.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute(ve.MEDIA_HAS_PLAYED))!=null?i:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(ve.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get theme(){var e;return(e=this.getAttribute(o.THEME))!=null?e:La}set theme(e){this.setAttribute(o.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let i={};for(let r of e.getAttributeNames()){if(Ve.includes(r))continue;let n=e.getAttribute(r);i[ce(r)]=n===""?!0:n}return i}set themeProps(e){var r,n;p(this,m,N).call(this);let i={...this.themeProps,...e};for(let d in i){if(Ve.includes(d))continue;let u=e==null?void 0:e[d];typeof u=="boolean"||u==null?(r=this.mediaTheme)==null||r.toggleAttribute(me(d),!!u):(n=this.mediaTheme)==null||n.setAttribute(me(d),u)}}get playbackId(){var e;return(e=this.getAttribute(s.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(s.PLAYBACK_ID,e):this.removeAttribute(s.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=V(this,S.SRC))!=null?e:void 0:(i=this.getAttribute(S.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(S.SRC,e):this.removeAttribute(S.SRC)}get poster(){var r;let e=this.getAttribute(S.POSTER);if(e!=null)return e;let{tokens:i}=this;if(i.playback&&!i.thumbnail){O("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return ht(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,programTime:this.programStartTime,token:i.thumbnail})}set poster(e){e||e===""?this.setAttribute(S.POSTER,e):this.removeAttribute(S.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(o.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(o.STORYBOARD_SRC,e):this.removeAttribute(o.STORYBOARD_SRC)}get storyboard(){let{tokens:e}=this;if(this.storyboardSrc&&!e.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[L.LIVE,L.UNKNOWN].includes(this.streamType)||e.playback&&!e.storyboard))return gt(this.playbackId,{customDomain:this.customDomain,token:e.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(o.AUDIO)}set audio(e){if(!e){this.removeAttribute(o.AUDIO);return}this.setAttribute(o.AUDIO,"")}get hotkeys(){return l(this,ne)}get nohotkeys(){return this.hasAttribute(o.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(o.NOHOTKEYS);return}this.setAttribute(o.NOHOTKEYS,"")}get thumbnailTime(){return A(this.getAttribute(o.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(o.THUMBNAIL_TIME,`${e}`)}get videoTitle(){var e,i;return(i=(e=this.getAttribute(o.VIDEO_TITLE))!=null?e:this.getAttribute(o.TITLE))!=null?i:""}set videoTitle(e){e!==this.videoTitle&&(e?this.setAttribute(o.VIDEO_TITLE,e):this.removeAttribute(o.VIDEO_TITLE))}get placeholder(){var e;return(e=V(this,o.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(o.PLACEHOLDER,`${e}`)}get primaryColor(){var i,r;let e=this.getAttribute(o.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=_.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),e))return e}set primaryColor(e){this.setAttribute(o.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var i,r;let e=this.getAttribute(o.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=_.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),e))return e}set secondaryColor(e){this.setAttribute(o.SECONDARY_COLOR,`${e}`)}get accentColor(){var i,r;let e=this.getAttribute(o.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=_.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),e))return e}set accentColor(e){this.setAttribute(o.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(o.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(o.PLAYBACK_RATES))return this.getAttribute(o.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(o.PLAYBACK_RATES);return}this.setAttribute(o.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=A(this.getAttribute(o.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(o.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=A(this.getAttribute(o.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(o.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(o.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return A(this.getAttribute(o.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute(o.DEFAULT_DURATION):this.setAttribute(o.DEFAULT_DURATION,`${e}`)}get playerInitTime(){return this.hasAttribute(s.PLAYER_INIT_TIME)?A(this.getAttribute(s.PLAYER_INIT_TIME)):l(this,re)}set playerInitTime(e){e!=this.playerInitTime&&(e==null?this.removeAttribute(s.PLAYER_INIT_TIME):this.setAttribute(s.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_NAME))!=null?e:Bt}get playerSoftwareVersion(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_VERSION))!=null?e:Vt}get beaconCollectionDomain(){var e;return(e=this.getAttribute(s.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(s.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(s.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(s.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(s.MAX_RESOLUTION,e):this.removeAttribute(s.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(s.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(s.MIN_RESOLUTION,e):this.removeAttribute(s.MIN_RESOLUTION))}get maxAutoResolution(){var e;return(e=this.getAttribute(s.MAX_AUTO_RESOLUTION))!=null?e:void 0}set maxAutoResolution(e){e==null?this.removeAttribute(s.MAX_AUTO_RESOLUTION):this.setAttribute(s.MAX_AUTO_RESOLUTION,e)}get renditionOrder(){var e;return(e=this.getAttribute(s.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(s.RENDITION_ORDER,e):this.removeAttribute(s.RENDITION_ORDER))}get programStartTime(){return A(this.getAttribute(s.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(s.PROGRAM_START_TIME):this.setAttribute(s.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return A(this.getAttribute(s.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(s.PROGRAM_END_TIME):this.setAttribute(s.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){return A(this.getAttribute(s.ASSET_START_TIME))}set assetStartTime(e){e==null?this.removeAttribute(s.ASSET_START_TIME):this.setAttribute(s.ASSET_START_TIME,`${e}`)}get assetEndTime(){return A(this.getAttribute(s.ASSET_END_TIME))}set assetEndTime(e){e==null?this.removeAttribute(s.ASSET_END_TIME):this.setAttribute(s.ASSET_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(o.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(o.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[i,r])=>(e[i]=r,e),{}):Ua}set extraSourceParams(e){e==null?this.removeAttribute(o.EXTRA_SOURCE_PARAMS):this.setAttribute(o.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(s.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(s.CUSTOM_DOMAIN,e):this.removeAttribute(s.CUSTOM_DOMAIN))}get envKey(){var e;return(e=V(this,s.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(s.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(o.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(o.NO_VOLUME_PREF,""):this.removeAttribute(o.NO_VOLUME_PREF)}get noMutedPref(){return this.hasAttribute(o.NO_MUTED_PREF)}set noMutedPref(e){e?this.setAttribute(o.NO_MUTED_PREF,""):this.removeAttribute(o.NO_MUTED_PREF)}get debug(){return V(this,s.DEBUG)!=null}set debug(e){e?this.setAttribute(s.DEBUG,""):this.removeAttribute(s.DEBUG)}get disableTracking(){return V(this,s.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(s.DISABLE_TRACKING,!!e)}get disableCookies(){return V(this,s.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(s.DISABLE_COOKIES,""):this.removeAttribute(s.DISABLE_COOKIES)}get streamType(){var e,i,r;return(r=(i=this.getAttribute(s.STREAM_TYPE))!=null?i:(e=this.media)==null?void 0:e.streamType)!=null?r:L.UNKNOWN}set streamType(e){this.setAttribute(s.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,i,r;return(r=(i=this.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?i:(e=this.mediaController)==null?void 0:e.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?r:L.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(o.DEFAULT_STREAM_TYPE,e):this.removeAttribute(o.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,i;return this.hasAttribute(o.TARGET_LIVE_WINDOW)?+this.getAttribute(o.TARGET_LIVE_WINDOW):(i=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?i:Number.NaN}set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(e==null?this.removeAttribute(o.TARGET_LIVE_WINDOW):this.setAttribute(o.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return A(V(this,s.START_TIME))}set startTime(e){this.setAttribute(s.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(s.PREFER_PLAYBACK);if(e===Te.MSE||e===Te.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===Te.MSE||e===Te.NATIVE?this.setAttribute(s.PREFER_PLAYBACK,e):this.removeAttribute(s.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(p(this,m,N).call(this),!this.media){k("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Ut(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(p(this,m,N).call(this),!this.media){k("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var i;if(p(this,m,N).call(this),!this.media){k("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(i=this.media)==null?void 0:i.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,i;return(i=(e=this.media)==null?void 0:e.cuePoints)!=null?i:[]}addChapters(e){var i;if(p(this,m,N).call(this),!this.media){k("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(i=this.media)==null?void 0:i.addChapters(e)}get activeChapter(){var e;return(e=this.media)==null?void 0:e.activeChapter}get chapters(){var e,i;return(i=(e=this.media)==null?void 0:e.chapters)!=null?i:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(o.PLAYBACK_TOKEN),i=this.getAttribute(o.DRM_TOKEN),r=this.getAttribute(o.THUMBNAIL_TOKEN),n=this.getAttribute(o.STORYBOARD_TOKEN);return{...l(this,oe),...e!=null?{playback:e}:{},...i!=null?{drm:i}:{},...r!=null?{thumbnail:r}:{},...n!=null?{storyboard:n}:{}}}set tokens(e){f(this,oe,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(o.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(o.PLAYBACK_TOKEN,`${e}`)}get drmToken(){var e;return(e=this.getAttribute(o.DRM_TOKEN))!=null?e:void 0}set drmToken(e){this.setAttribute(o.DRM_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(o.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(o.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(o.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(o.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,n){var u;let d=(u=this.media)==null?void 0:u.nativeEl;if(d)return Ra(d,e,i,r,n)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(i)return xa(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}get castReceiver(){var e;return(e=this.getAttribute(o.CAST_RECEIVER))!=null?e:void 0}set castReceiver(e){e!==this.castReceiver&&(e?this.setAttribute(o.CAST_RECEIVER,e):this.removeAttribute(o.CAST_RECEIVER))}get castCustomData(){var e;return(e=this.media)==null?void 0:e.castCustomData}set castCustomData(e){if(!this.media){k("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=e}get noTooltips(){return this.hasAttribute(o.NO_TOOLTIPS)}set noTooltips(e){if(!e){this.removeAttribute(o.NO_TOOLTIPS);return}this.setAttribute(o.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(o.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(e){e?this.setAttribute(o.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(o.PROUDLY_DISPLAY_MUX_BADGE)}get capRenditionToPlayerSize(){var e;return(e=this.media)==null?void 0:e.capRenditionToPlayerSize}set capRenditionToPlayerSize(e){if(!this.media){k("underlying media element missing when trying to set capRenditionToPlayerSize");return}this.media.capRenditionToPlayerSize=e}};re=new WeakMap,W=new WeakMap,oe=new WeakMap,P=new WeakMap,ne=new WeakMap,Z=new WeakMap,se=new WeakMap,de=new WeakMap,K=new WeakMap,G=new WeakMap,$=new WeakMap,le=new WeakMap,m=new WeakSet,N=function(){var e,i,r,n;if(!l(this,W)){f(this,W,!0),p(this,m,H).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof _.HTMLElement))throw""}catch{k("<media-theme> failed to upgrade!")}try{customElements.upgrade(this.media)}catch{k("underlying media element failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof _a))throw""}catch{k("<media-controller> failed to upgrade!")}p(this,m,Ft).call(this),p(this,m,Yt).call(this),p(this,m,Wt).call(this),f(this,P,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(we.USER_INACTIVE))!=null?i:!0),p(this,m,Zt).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",l(this,se)),(n=this.media)==null||n.addEventListener("loadstart",l(this,de))}},$t=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},He=function(e){Object.assign(l(this,$),e),p(this,m,H).call(this)},H=function(e={}){kt(Rt(Ma(this,{...l(this,$),...e})),this.shadowRoot)},Ft=function(){let e=i=>{var d,u;if(!(i!=null&&i.startsWith("theme-")))return;let r=i.replace(/^theme-/,"");if(Ve.includes(r))return;let n=this.getAttribute(i);n!=null?(d=this.mediaTheme)==null||d.setAttribute(r,n):(u=this.mediaTheme)==null||u.removeAttribute(r)};f(this,Z,new MutationObserver(i=>{for(let{attributeName:r}of i)e(r)})),l(this,Z).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},Yt=function(){this.addEventListener("error",l(this,le)),this.media&&(this.media.errorTranslator=(e={})=>{var r,n,d;if(!(((r=this.media)==null?void 0:r.error)instanceof Ee))return e;let i=Ie((n=this.media)==null?void 0:n.error,!1);return{player_error_code:(d=this.media)==null?void 0:d.error.code,player_error_message:i.message?String(i.message):e.player_error_message,player_error_context:i.context?String(i.context):e.player_error_context}})},Wt=function(){var e,i,r,n;(i=(e=this.media)==null?void 0:e.textTracks)==null||i.addEventListener("addtrack",l(this,K)),(n=(r=this.media)==null?void 0:r.textTracks)==null||n.addEventListener("removetrack",l(this,K))},Zt=function(){var j,z;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,n=()=>this.streamType===L.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,d=(E,v,x=!1)=>{if(n())return;Array.from(E&&E.activeCues||[]).forEach(g=>{if(!(!g.snapToLines||g.line<-5||g.line>=0&&g.line<10))if(!v||this.paused){let ue=g.text.split(`
|
|
1374
|
+
`).length,X=-3;this.streamType===L.LIVE&&(X=-2);let q=X-ue;if(g.line===q&&!x)return;r.has(g)||r.set(g,g.line),g.line=q}else setTimeout(()=>{g.line=r.get(g)||"auto"},500)})},u=()=>{var E,v;d(i,(v=(E=this.mediaController)==null?void 0:E.hasAttribute(we.USER_INACTIVE))!=null?v:!1)},b=()=>{var x,F;let v=Array.from(((F=(x=this.mediaController)==null?void 0:x.media)==null?void 0:F.textTracks)||[]).filter(g=>["subtitles","captions"].includes(g.kind)&&g.mode==="showing")[0];v!==i&&(i==null||i.removeEventListener("cuechange",u)),i=v,i==null||i.addEventListener("cuechange",u),d(i,l(this,P))};b(),(j=this.textTracks)==null||j.addEventListener("change",b),(z=this.textTracks)==null||z.addEventListener("addtrack",b);let R=()=>{var v,x;let E=(x=(v=this.mediaController)==null?void 0:v.hasAttribute(we.USER_INACTIVE))!=null?x:!0;l(this,P)!==E&&(f(this,P,E),d(i,l(this,P)))};this.addEventListener("userinactivechange",R),f(this,G,()=>{var E,v;i==null||i.removeEventListener("cuechange",u),(E=this.textTracks)==null||E.removeEventListener("change",b),(v=this.textTracks)==null||v.removeEventListener("addtrack",b),this.removeEventListener("userinactivechange",R)})};function V(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Ii=Be;export{Ee as MediaError,Ii as default,Oa as generatePlayerInitTime,V as getVideoAttribute,Bt as playerSoftwareName,Vt as playerSoftwareVersion};
|