@mux/mux-audio 0.8.1 → 0.9.0
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/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +3 -3
- package/dist/mux-audio.js +8 -8
- package/dist/mux-audio.js.map +3 -3
- package/dist/mux-audio.mjs +8 -8
- package/dist/mux-audio.mjs.map +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var S=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var z=(t,s)=>{for(var e in s)S(t,e,{get:s[e],enumerable:!0})},V=(t,s,e,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of H(s))!q.call(t,i)&&i!==e&&S(t,i,{get:()=>s[i],enumerable:!(r=G(s,i))||r.enumerable});return t};var W=t=>V(S({},"__esModule",{value:!0}),t);var x=(t,s,e)=>{if(!s.has(t))throw TypeError("Cannot "+e)};var o=(t,s,e)=>(x(t,s,"read from private field"),e?e.call(t):s.get(t)),d=(t,s,e)=>{if(s.has(t))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(t):s.set(t,e)},c=(t,s,e,r)=>(x(t,s,"write to private field"),r?r.call(t,e):s.set(t,e),e);var b=(t,s,e)=>(x(t,s,"access private method"),e);var ne={};z(ne,{AudioEvents:()=>D,MediaError:()=>a.MediaError,default:()=>re});module.exports=W(ne);var E=class{addEventListener(){}removeEventListener(){}dispatchEvent(s){return!0}};if(typeof DocumentFragment=="undefined"){class t extends E{}globalThis.DocumentFragment=t}var T=class extends E{},I=class extends E{},$={get(t){},define(t,s,e){},upgrade(t){},whenDefined(t){return Promise.resolve(T)}},_,v=class{constructor(s,e={}){d(this,_,void 0);c(this,_,e==null?void 0:e.detail)}get detail(){return o(this,_)}initCustomEvent(){}};_=new WeakMap;function J(t,s){return new T}var K={document:{createElement:J},DocumentFragment,customElements:$,CustomEvent:v,EventTarget:E,HTMLElement:T,HTMLVideoElement:I},Y=typeof window=="undefined"||typeof globalThis.customElements=="undefined",h=Y?K:globalThis,R=Y?K.document:globalThis.document;var a=require("@mux/playback-core");var Q=()=>{try{return"0.9.0"}catch{}return"UNKNOWN"},X=Q(),w=()=>X;var D=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],U=R.createElement("template");U.innerHTML=`
|
|
2
2
|
<style>
|
|
3
3
|
:host {
|
|
4
4
|
/* display:inline (like the native el) makes it so you can't fill
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
|
|
22
22
|
<audio part="audio" crossorigin></audio>
|
|
23
23
|
<slot></slot>
|
|
24
|
-
`;var
|
|
24
|
+
`;var P,g,k,p=class extends h.HTMLElement{constructor(){super();d(this,g);d(this,P,void 0);this.attachShadow({mode:"open"}),this.isConnected&&b(this,g,k).call(this)}static get observedAttributes(){let e=[];Object.getOwnPropertyNames(this.prototype).forEach(i=>{let u=!1;try{typeof this.prototype[i]=="function"&&(u=!0)}catch{}!u&&i!==i.toUpperCase()&&e.push(i.toLowerCase())});let r=Object.getPrototypeOf(this).observedAttributes;return r&&(e=e.concat(r)),e}attributeChangedCallback(e,r,i){b(this,g,k).call(this),this.forwardAttribute(e,r,i)}forwardAttribute(e,r,i){let u=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),m=ee(u,e),l=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;m&&!l?typeof this[m]=="boolean"?i===null?this[m]=!1:this[m]=!0:this[m]=i:i===null?this.nativeEl.removeAttribute(e):["id","class"].indexOf(e)===-1&&this.nativeEl.setAttribute(e,i)}connectedCallback(){b(this,g,k).call(this)}};P=new WeakMap,g=new WeakSet,k=function(){if(o(this,P))return;c(this,P,!0),this.shadowRoot.append(U.content.cloneNode(!0));let e=this.nativeEl=this.shadowRoot.querySelector("audio");D.forEach(i=>{e.addEventListener(i,u=>{this.dispatchEvent(new CustomEvent(u.type,{detail:u.detail}))})});let r=this.shadowRoot.querySelector("slot");r.addEventListener("slotchange",()=>{r.assignedElements().forEach(i=>{!["track","source"].includes(i.localName)||e.append(i)})}),Array.from(this.attributes).forEach(i=>{this.forwardAttribute(i.name,null,i.value)}),e.defaultMuted&&(e.muted=!0)};var F=[],j=R.createElement("audio"),Z=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let t=Object.getPrototypeOf(j);t&&t!==h.HTMLElement.prototype;t=Object.getPrototypeOf(t))Object.keys(t).forEach(s=>{Z.indexOf(s)===-1&&F.push(s)});F.forEach(t=>{if(typeof j[t]=="function")p.prototype[t]=function(){return this.nativeEl[t].apply(this.nativeEl,arguments)};else{let e={get(){return this.nativeEl[t]}};t!==t.toUpperCase()&&(e.set=function(r){this.nativeEl[t]=r}),Object.defineProperty(p.prototype,t,e)}});function ee(t,s){let e=null;return t.forEach(r=>{r.toLowerCase()==s.toLowerCase()&&(e=r)}),e}h.customElements.get("custom-audio")||(h.customElements.define("custom-audio",p),h.CustomAudioElement=p);var N=p;var n={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},te=Object.values(n),ie=w(),se="mux-audio",f,A,C,y,M,B,O=class extends N{constructor(){super();d(this,M);d(this,f,void 0);d(this,A,void 0);d(this,C,void 0);d(this,y,{});c(this,C,(0,a.generatePlayerInitTime)())}static get observedAttributes(){var e;return[...te,...(e=N.observedAttributes)!=null?e:[]]}get playerInitTime(){return o(this,C)}get playerSoftwareName(){return se}get playerSoftwareVersion(){return ie}get _hls(){var e;return(e=o(this,f))==null?void 0:e.engine}get mux(){return this.nativeEl.mux}get src(){return this.getAttribute("src")}set src(e){e!==this.src&&(e==null?this.removeAttribute("src"):this.setAttribute("src",e))}get preload(){let e=this.getAttribute("preload");return e===""?"auto":["none","metadata","auto"].includes(e)?e:super.preload}set preload(e){e!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(e)?this.setAttribute("preload",e):this.removeAttribute("preload"))}get debug(){return this.getAttribute(n.DEBUG)!=null}set debug(e){e!==this.debug&&(e?this.setAttribute(n.DEBUG,""):this.removeAttribute(n.DEBUG))}get disableCookies(){return this.hasAttribute(n.DISABLE_COOKIES)}set disableCookies(e){e!==this.disableCookies&&(e?this.setAttribute(n.DISABLE_COOKIES,""):this.removeAttribute(n.DISABLE_COOKIES))}get startTime(){let e=this.getAttribute(n.START_TIME);if(e==null)return;let r=+e;return Number.isNaN(r)?void 0:r}set startTime(e){e!==this.startTime&&(e==null?this.removeAttribute(n.START_TIME):this.setAttribute(n.START_TIME,`${e}`))}get playbackId(){var e;return(e=this.getAttribute(n.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e!==this.playbackId&&(e?this.setAttribute(n.PLAYBACK_ID,e):this.removeAttribute(n.PLAYBACK_ID))}get envKey(){var e;return(e=this.getAttribute(n.ENV_KEY))!=null?e:void 0}set envKey(e){e!==this.envKey&&(e?this.setAttribute(n.ENV_KEY,e):this.removeAttribute(n.ENV_KEY))}get beaconCollectionDomain(){var e;return(e=this.getAttribute(n.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(n.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(n.BEACON_COLLECTION_DOMAIN))}get streamType(){var e;return(e=this.getAttribute(n.STREAM_TYPE))!=null?e:void 0}set streamType(e){e!==this.streamType&&(e?this.setAttribute(n.STREAM_TYPE,e):this.removeAttribute(n.STREAM_TYPE))}get preferPlayback(){let e=this.getAttribute(n.PREFER_PLAYBACK);if(e===a.PlaybackTypes.MSE||e===a.PlaybackTypes.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===a.PlaybackTypes.MSE||e===a.PlaybackTypes.NATIVE?this.setAttribute(n.PREFER_PLAYBACK,e):this.removeAttribute(n.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(r=>r.startsWith("metadata-")&&![n.METADATA_URL].includes(r)).reduce((r,i)=>{let u=this.getAttribute(i);return u!=null&&(r[i.replace(/^metadata-/,"").replace(/-/g,"_")]=u),r},{}),...o(this,y)}}set metadata(e){c(this,y,e!=null?e:{}),this.mux&&(console.info("Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src."),this.mux.emit("hb",o(this,y)))}load(){c(this,f,(0,a.initialize)(this,this.nativeEl,o(this,f)))}unload(){(0,a.teardown)(this.nativeEl,o(this,f)),c(this,f,void 0)}attributeChangedCallback(e,r,i){var u,m;switch(super.attributeChangedCallback(e,r,i),e){case"src":{let l=!!r,L=!!i;!l&&L?b(this,M,B).call(this):l&&!L?this.unload():l&&L&&(this.unload(),b(this,M,B).call(this));break}case"autoplay":if(i===r)break;(u=o(this,f))==null||u.setAutoplay(this.autoplay);break;case"preload":if(i===r)break;(m=o(this,f))==null||m.setPreload(i);break;case n.PLAYBACK_ID:this.src=(0,a.toMuxVideoURL)(i!=null?i:void 0);break;case n.DEBUG:{let l=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=l);break}case n.METADATA_URL:i&&fetch(i).then(l=>l.json()).then(l=>this.metadata=l).catch(l=>console.error(`Unable to load or parse metadata JSON from metadata-url ${i}!`));break;default:break}}disconnectedCallback(){this.unload()}};f=new WeakMap,A=new WeakMap,C=new WeakMap,y=new WeakMap,M=new WeakSet,B=async function(){o(this,A)||(await c(this,A,Promise.resolve()),c(this,A,null),this.load())};h.customElements.get("mux-audio")||(h.customElements.define("mux-audio",O),h.MuxAudioElement=O);var re=O;
|
|
25
25
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../../../shared/polyfills/index.js", "../src/env.ts", "../src/CustomAudioElement.js"],
|
|
4
|
-
"sourcesContent": ["import { globalThis } from 'shared-polyfills';\nimport {\n initialize,\n teardown,\n generatePlayerInitTime,\n MuxMediaProps,\n StreamTypes,\n PlaybackTypes,\n ValueOf,\n toMuxVideoURL,\n Metadata,\n MediaError,\n} from '@mux/playback-core';\nimport type { PlaybackCore, PlaybackEngine, Autoplay, ExtensionMimeTypeMap } from '@mux/playback-core';\nimport { getPlayerVersion } from './env';\n// this must be imported after playback-core for the polyfill to be included\nimport CustomAudioElement, { AudioEvents } from './CustomAudioElement';\n\n/** @TODO make the relationship between name+value smarter and more deriveable (CJP) */\ntype AttributeNames = {\n ENV_KEY: 'env-key';\n DEBUG: 'debug';\n METADATA_URL: 'metadata-url';\n METADATA_VIDEO_ID: 'metadata-video-id';\n METADATA_VIDEO_TITLE: 'metadata-video-title';\n METADATA_VIEWER_USER_ID: 'metadata-viewer-user-id';\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain';\n DISABLE_COOKIES: 'disable-cookies';\n PLAYBACK_ID: 'playback-id';\n PREFER_PLAYBACK: 'prefer-playback';\n TYPE: 'type';\n STREAM_TYPE: 'stream-type';\n START_TIME: 'start-time';\n};\n\nconst Attributes: AttributeNames = {\n ENV_KEY: 'env-key',\n DEBUG: 'debug',\n PLAYBACK_ID: 'playback-id',\n METADATA_URL: 'metadata-url',\n PREFER_PLAYBACK: 'prefer-playback',\n METADATA_VIDEO_ID: 'metadata-video-id',\n METADATA_VIDEO_TITLE: 'metadata-video-title',\n METADATA_VIEWER_USER_ID: 'metadata-viewer-user-id',\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain',\n DISABLE_COOKIES: 'disable-cookies',\n TYPE: 'type',\n STREAM_TYPE: 'stream-type',\n START_TIME: 'start-time',\n};\n\nconst AttributeNameValues = Object.values(Attributes);\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-audio';\n\nclass MuxAudioElement extends CustomAudioElement<HTMLAudioElement> implements Partial<MuxMediaProps> {\n static get observedAttributes() {\n return [...AttributeNameValues, ...(CustomAudioElement.observedAttributes ?? [])];\n }\n\n #core?: PlaybackCore;\n #loadRequested?: Promise<void> | null;\n #playerInitTime: number;\n #metadata: Readonly<Metadata> = {};\n\n constructor() {\n super();\n this.#playerInitTime = generatePlayerInitTime();\n }\n\n get playerInitTime() {\n return this.#playerInitTime;\n }\n\n get playerSoftwareName() {\n return playerSoftwareName;\n }\n\n get playerSoftwareVersion() {\n return playerSoftwareVersion;\n }\n\n // Keeping this named \"_hls\" since it's exposed for unadvertised \"advanced usage\" via getter that assumes specifically hls.js (CJP)\n get _hls(): PlaybackEngine | undefined {\n return this.#core?.engine;\n }\n\n get mux(): Readonly<HTMLAudioElement['mux']> | undefined {\n return this.nativeEl.mux;\n }\n\n get src() {\n // Use the attribute value as the source of truth.\n // No need to store it in two places.\n // This avoids needing a to read the attribute initially and update the src.\n return this.getAttribute('src') as string;\n }\n\n set src(val: string) {\n // If being set by attributeChangedCallback,\n // dont' cause an infinite loop\n if (val === this.src) return;\n\n if (val == null) {\n this.removeAttribute('src');\n } else {\n this.setAttribute('src', val);\n }\n }\n\n get preload() {\n const val = this.getAttribute('preload') as HTMLMediaElement['preload'];\n if (val === '') return 'auto';\n if (['none', 'metadata', 'auto'].includes(val)) return val;\n return super.preload;\n }\n\n set preload(val) {\n // don't cause an infinite loop\n // check the attribute because an empty string maps to the `auto` prop\n if (val == this.getAttribute('preload')) return;\n\n if (['', 'none', 'metadata', 'auto'].includes(val)) {\n this.setAttribute('preload', val);\n } else {\n this.removeAttribute('preload');\n }\n }\n\n get debug(): boolean {\n return this.getAttribute(Attributes.DEBUG) != null;\n }\n\n set debug(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.debug) return;\n\n if (val) {\n this.setAttribute(Attributes.DEBUG, '');\n } else {\n this.removeAttribute(Attributes.DEBUG);\n }\n }\n\n get disableCookies(): boolean {\n return this.hasAttribute(Attributes.DISABLE_COOKIES);\n }\n\n set disableCookies(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.disableCookies) return;\n\n if (val) {\n this.setAttribute(Attributes.DISABLE_COOKIES, '');\n } else {\n this.removeAttribute(Attributes.DISABLE_COOKIES);\n }\n }\n\n get startTime(): number | undefined {\n const val = this.getAttribute(Attributes.START_TIME);\n if (val == null) return undefined;\n const num = +val;\n return !Number.isNaN(num) ? num : undefined;\n }\n\n set startTime(val: number | undefined) {\n // dont' cause an infinite loop\n if (val === this.startTime) return;\n\n if (val == null) {\n this.removeAttribute(Attributes.START_TIME);\n } else {\n this.setAttribute(Attributes.START_TIME, `${val}`);\n }\n }\n\n get playbackId(): string | undefined {\n return this.getAttribute(Attributes.PLAYBACK_ID) ?? undefined;\n }\n\n set playbackId(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.playbackId) return;\n\n if (val) {\n this.setAttribute(Attributes.PLAYBACK_ID, val);\n } else {\n this.removeAttribute(Attributes.PLAYBACK_ID);\n }\n }\n\n get envKey(): string | undefined {\n return this.getAttribute(Attributes.ENV_KEY) ?? undefined;\n }\n\n set envKey(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.envKey) return;\n\n if (val) {\n this.setAttribute(Attributes.ENV_KEY, val);\n } else {\n this.removeAttribute(Attributes.ENV_KEY);\n }\n }\n\n get beaconCollectionDomain(): string | undefined {\n return this.getAttribute(Attributes.BEACON_COLLECTION_DOMAIN) ?? undefined;\n }\n\n set beaconCollectionDomain(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.beaconCollectionDomain) return;\n\n if (val) {\n this.setAttribute(Attributes.BEACON_COLLECTION_DOMAIN, val);\n } else {\n this.removeAttribute(Attributes.BEACON_COLLECTION_DOMAIN);\n }\n }\n\n get streamType(): ValueOf<StreamTypes> | undefined {\n // getAttribute doesn't know that this attribute is well defined. Should explore extending for MuxVideo (CJP)\n return (this.getAttribute(Attributes.STREAM_TYPE) as ValueOf<StreamTypes>) ?? undefined;\n }\n\n set streamType(val: ValueOf<StreamTypes> | undefined) {\n // dont' cause an infinite loop\n if (val === this.streamType) return;\n\n if (val) {\n this.setAttribute(Attributes.STREAM_TYPE, val);\n } else {\n this.removeAttribute(Attributes.STREAM_TYPE);\n }\n }\n\n get preferPlayback(): ValueOf<PlaybackTypes> | undefined {\n const val = this.getAttribute(Attributes.PREFER_PLAYBACK);\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) return val;\n return undefined;\n }\n\n set preferPlayback(val: ValueOf<PlaybackTypes> | undefined) {\n if (val === this.preferPlayback) return;\n\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) {\n this.setAttribute(Attributes.PREFER_PLAYBACK, val);\n } else {\n this.removeAttribute(Attributes.PREFER_PLAYBACK);\n }\n }\n\n get metadata() {\n return this.#metadata;\n }\n\n set metadata(val: Readonly<Metadata> | undefined) {\n this.#metadata = val ?? {};\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src.'\n );\n this.mux.emit('hb', this.#metadata);\n }\n }\n\n async #requestLoad() {\n if (this.#loadRequested) return;\n await (this.#loadRequested = Promise.resolve());\n this.#loadRequested = null;\n this.load();\n }\n\n load() {\n this.#core = initialize(this as Partial<MuxMediaProps>, this.nativeEl, this.#core);\n }\n\n unload() {\n teardown(this.nativeEl, this.#core);\n this.#core = undefined;\n }\n\n attributeChangedCallback(attrName: string, oldValue: string | null, newValue: string | null) {\n super.attributeChangedCallback(attrName, oldValue, newValue);\n\n switch (attrName) {\n case 'src': {\n const hadSrc = !!oldValue;\n const hasSrc = !!newValue;\n if (!hadSrc && hasSrc) {\n this.#requestLoad();\n } else if (hadSrc && !hasSrc) {\n this.unload();\n /** @TODO Test this thoroughly (async?) and confirm unload() necessary (CJP) */\n } else if (hadSrc && hasSrc) {\n this.unload();\n this.#requestLoad();\n }\n break;\n }\n case 'autoplay':\n if (newValue === oldValue) {\n break;\n }\n /** In case newValue is an empty string or null, use this.autoplay which translates to booleans (WL) */\n this.#core?.setAutoplay(this.autoplay);\n break;\n case 'preload':\n if (newValue === oldValue) {\n break;\n }\n this.#core?.setPreload(newValue as HTMLMediaElement['preload']);\n break;\n case Attributes.PLAYBACK_ID:\n /** @TODO Improv+Discuss - how should playback-id update wrt src attr changes (and vice versa) (CJP) */\n this.src = toMuxVideoURL(newValue ?? undefined) as string;\n break;\n case Attributes.DEBUG: {\n const debug = this.debug;\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src.'\n );\n }\n if (!!this._hls) {\n this._hls.config.debug = debug;\n }\n break;\n }\n case Attributes.METADATA_URL:\n if (newValue) {\n fetch(newValue)\n .then((resp) => resp.json())\n .then((json) => (this.metadata = json))\n .catch((_err) => console.error(`Unable to load or parse metadata JSON from metadata-url ${newValue}!`));\n }\n break;\n default:\n break;\n }\n }\n\n disconnectedCallback() {\n this.unload();\n }\n}\n\ntype MuxAudioElementType = typeof MuxAudioElement;\ndeclare global {\n var MuxAudioElement: MuxAudioElementType; // eslint-disable-line\n}\n\nif (!globalThis.customElements.get('mux-audio')) {\n globalThis.customElements.define('mux-audio', MuxAudioElement);\n /** @TODO consider externalizing this (breaks standard modularity) */\n globalThis.MuxAudioElement = MuxAudioElement;\n}\n\nexport { PlaybackEngine, PlaybackEngine as Hls, ExtensionMimeTypeMap as MimeTypes, MediaError, AudioEvents };\n\nexport default MuxAudioElement;\n", "class EventTarget {\n addEventListener() {}\n removeEventListener() {}\n dispatchEvent(_event) {\n return true;\n }\n}\n\n// @github/template-parts requires DocumentFragment to be available on globalThis for SSR\nif (typeof DocumentFragment === 'undefined') {\n class DocumentFragment extends EventTarget {}\n // @ts-ignore\n globalThis.DocumentFragment = DocumentFragment;\n}\n\nclass HTMLElement extends EventTarget {}\nclass HTMLVideoElement extends EventTarget {}\n\nconst customElements = {\n get(_name) {\n return undefined;\n },\n define(_name, _constructor, _options) {},\n upgrade(_root) {},\n whenDefined(_name) {\n return Promise.resolve(HTMLElement);\n },\n};\n\nclass CustomEvent {\n #detail;\n get detail() {\n return this.#detail;\n }\n constructor(typeArg, eventInitDict = {}) {\n // super(typeArg, eventInitDict);\n this.#detail = eventInitDict?.detail;\n }\n initCustomEvent() {}\n}\n\nfunction createElement(_tagName, _options) {\n return new HTMLElement();\n}\n\nconst globalThisShim = {\n document: {\n createElement,\n },\n DocumentFragment,\n customElements,\n CustomEvent,\n EventTarget,\n HTMLElement,\n HTMLVideoElement,\n};\n\nconst isServer = typeof window === 'undefined' || typeof globalThis.customElements === 'undefined';\nconst GlobalThis = isServer ? globalThisShim : globalThis;\nconst Document = isServer ? globalThisShim.document : globalThis.document;\n\nexport { GlobalThis as globalThis, Document as document };\n", "export const isMaybeBrowser = () => typeof window != 'undefined';\n// @ts-ignore\nexport const isMaybeServer = () => typeof global != 'undefined';\n\nconst getEnvPlayerVersion = () => {\n try {\n // @ts-ignore\n return PLAYER_VERSION as string;\n } catch {}\n return 'UNKNOWN';\n};\n\nconst player_version: string = getEnvPlayerVersion();\n\nexport const getPlayerVersion = () => player_version;\n", "import { globalThis, document } from 'shared-polyfills';\n/**\n * Custom Audio Element\n * The goal is to create an element that works just like the audio element\n * but can be extended/sub-classed, because native elements cannot be\n * extended today across browsers.\n */\n\nexport const AudioEvents = [\n 'abort',\n 'canplay',\n 'canplaythrough',\n 'durationchange',\n 'emptied',\n 'ended',\n 'error',\n 'loadeddata',\n 'loadedmetadata',\n 'loadstart',\n 'pause',\n 'play',\n 'playing',\n 'progress',\n 'ratechange',\n 'seeked',\n 'seeking',\n 'stalled',\n 'suspend',\n 'timeupdate',\n 'volumechange',\n 'waiting',\n];\n\nconst template = document.createElement('template');\n// Could you get styles to apply by passing a global button from global to shadow?\n\ntemplate.innerHTML = `\n<style>\n :host {\n /* display:inline (like the native el) makes it so you can't fill\n the container with the native el */\n display: inline-block;\n box-sizing: border-box;\n\n width: auto;\n height: auto;\n }\n\n audio {\n max-width: 100%;\n max-height: 100%;\n min-width: 100%;\n min-height: 100%;\n }\n\n</style>\n\n<audio part=\"audio\" crossorigin></audio>\n<slot></slot>\n`;\n\nclass CustomAudioElement extends globalThis.HTMLElement {\n #isInit;\n\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n\n // If the custom element is defined before the <custom-video> HTML is parsed\n // no attributes will be available in the constructor (construction process).\n // Wait until initializing attributes in the attributeChangedCallback.\n // If this element is connected to the DOM, the attributes will be available.\n if (this.isConnected) {\n this.#init();\n }\n }\n\n #init() {\n if (this.#isInit) return;\n this.#isInit = true;\n\n this.shadowRoot.append(template.content.cloneNode(true));\n const nativeEl = (this.nativeEl = this.shadowRoot.querySelector('audio'));\n\n // The audio events are dispatched on the CustomAudioElement instance.\n // This makes it possible to add event listeners before the element is upgraded.\n AudioEvents.forEach((type) => {\n nativeEl.addEventListener(type, (evt) => {\n this.dispatchEvent(new CustomEvent(evt.type, { detail: evt.detail }));\n });\n });\n\n const slotEl = this.shadowRoot.querySelector('slot');\n slotEl.addEventListener('slotchange', () => {\n slotEl.assignedElements().forEach((el) => {\n if (!['track', 'source'].includes(el.localName)) return;\n nativeEl.append(el);\n });\n });\n\n // Initialize all the attribute properties\n // This is required before attributeChangedCallback is called after construction\n // so the initial state of all the attributes are forwarded to the native element.\n Array.from(this.attributes).forEach((attrNode) => {\n this.forwardAttribute(attrNode.name, null, attrNode.value);\n });\n\n // Neither Chrome or Firefox support setting the muted attribute\n // after using document.createElement.\n // One way to get around this would be to build the native tag as a string.\n // But just fixing it manually for now.\n // Apparently this may also be an issue with <input checked> for buttons\n if (nativeEl.defaultMuted) {\n nativeEl.muted = true;\n }\n }\n\n // observedAttributes is required to trigger attributeChangedCallback\n // for any attributes on the custom element.\n // Attributes need to be the lowercase word, e.g. crossorigin, not crossOrigin\n static get observedAttributes() {\n let attrs = [];\n\n // Instead of manually creating a list of all observed attributes,\n // observe any getter/setter prop name (lowercased)\n Object.getOwnPropertyNames(this.prototype).forEach((propName) => {\n let isFunc = false;\n\n // Non-func properties throw errors because it's not an instance\n try {\n if (typeof this.prototype[propName] === 'function') {\n isFunc = true;\n }\n } catch (e) {}\n\n // Exclude functions and constants\n if (!isFunc && propName !== propName.toUpperCase()) {\n attrs.push(propName.toLowerCase());\n }\n });\n\n // Include any attributes from the super class (recursive)\n const supAttrs = Object.getPrototypeOf(this).observedAttributes;\n\n if (supAttrs) {\n attrs = attrs.concat(supAttrs);\n }\n\n return attrs;\n }\n\n // We need to handle sub-class custom attributes differently from\n // attrs meant to be passed to the internal native el.\n attributeChangedCallback(attrName, oldValue, newValue) {\n // Initialize right after construction when the attributes become available.\n this.#init();\n\n this.forwardAttribute(attrName, oldValue, newValue);\n }\n\n forwardAttribute(attrName, oldValue, newValue) {\n // Find the matching prop for custom attributes\n const ownProps = Object.getOwnPropertyNames(Object.getPrototypeOf(this));\n const propName = arrayFindAnyCase(ownProps, attrName);\n\n // Check if this is the original custom native elemnt or a subclass\n const isBaseElement = Object.getPrototypeOf(this.constructor).toString().indexOf('function HTMLElement') === 0;\n\n // If this is a subclass custom attribute we want to set the\n // matching property on the subclass\n if (propName && !isBaseElement) {\n // Boolean props should never start as null\n if (typeof this[propName] == 'boolean') {\n // null is returned when attributes are removed i.e. boolean attrs\n if (newValue === null) {\n this[propName] = false;\n } else {\n // The new value might be an empty string, which is still true\n // for boolean attributes\n this[propName] = true;\n }\n } else {\n this[propName] = newValue;\n }\n } else {\n // When this is the original Custom Element, or the subclass doesn't\n // have a matching prop, pass it through.\n if (newValue === null) {\n this.nativeEl.removeAttribute(attrName);\n } else {\n // Ignore a few that don't need to be passed through just in case\n // it creates unexpected behavior.\n if (['id', 'class'].indexOf(attrName) === -1) {\n this.nativeEl.setAttribute(attrName, newValue);\n }\n }\n }\n }\n\n connectedCallback() {\n this.#init();\n }\n}\n\n// Map all native element properties to the custom element\n// so that they're applied to the native element.\n// Skipping HTMLElement because of things like \"attachShadow\"\n// causing issues. Most of those props still need to apply to\n// the custom element.\n// But includign EventTarget props because most events emit from\n// the native element.\nlet nativeElProps = [];\n\n// Can't check typeof directly on element prototypes without\n// throwing Illegal Invocation errors, so creating an element\n// to check on instead.\nconst nativeElTest = document.createElement('audio');\n\n// Deprecated props throw warnings if used, so exclude them\nconst deprecatedProps = ['webkitDisplayingFullscreen', 'webkitSupportsFullscreen'];\n\n// Walk the prototype chain up to HTMLElement.\n// This will grab all super class props in between.\n// i.e. AudioElement and MediaElement\nfor (\n let proto = Object.getPrototypeOf(nativeElTest);\n proto && proto !== globalThis.HTMLElement.prototype;\n proto = Object.getPrototypeOf(proto)\n) {\n Object.keys(proto).forEach((key) => {\n if (deprecatedProps.indexOf(key) === -1) {\n nativeElProps.push(key);\n }\n });\n}\n\n// Passthrough native el functions from the custom el to the native el\nnativeElProps.forEach((prop) => {\n const type = typeof nativeElTest[prop];\n\n if (type == 'function') {\n // Function\n CustomAudioElement.prototype[prop] = function () {\n return this.nativeEl[prop].apply(this.nativeEl, arguments);\n };\n } else {\n // Getter\n let config = {\n get() {\n return this.nativeEl[prop];\n },\n };\n\n if (prop !== prop.toUpperCase()) {\n // Setter (not a CONSTANT)\n config.set = function (val) {\n this.nativeEl[prop] = val;\n };\n }\n\n Object.defineProperty(CustomAudioElement.prototype, prop, config);\n }\n});\n\nfunction arrayFindAnyCase(arr, word) {\n let found = null;\n\n arr.forEach((item) => {\n if (item.toLowerCase() == word.toLowerCase()) {\n found = item;\n }\n });\n\n return found;\n}\n\nif (!globalThis.customElements.get('custom-audio')) {\n globalThis.customElements.define('custom-audio', CustomAudioElement);\n globalThis.CustomAudioElement = CustomAudioElement;\n}\n\nexport default CustomAudioElement;\n"],
|
|
5
|
-
"mappings": "8yBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,iBAAAE,EAAA,wCAAAC,KAAA,eAAAC,EAAAJ,ICAA,IAAMK,EAAN,KAAkB,CAChB,kBAAmB,CAAC,CACpB,qBAAsB,CAAC,CACvB,cAAcC,EAAQ,CACpB,MAAO,EACT,CACF,EAGA,GAAI,OAAO,kBAAqB,YAAa,CAC3C,MAAMC,UAAyBF,CAAY,CAAC,CAE5C,WAAW,iBAAmBE,CAChC,CAEA,IAAMC,EAAN,cAA0BH,CAAY,CAAC,EACjCI,EAAN,cAA+BJ,CAAY,CAAC,EAEtCK,EAAiB,CACrB,IAAIC,EAAO,CAEX,EACA,OAAOA,EAAOC,EAAcC,EAAU,CAAC,EACvC,QAAQC,EAAO,CAAC,EAChB,YAAYH,EAAO,CACjB,OAAO,QAAQ,QAAQH,CAAW,CACpC,CACF,EA3BAO,EA6BMC,EAAN,KAAkB,CAKhB,YAAYC,EAASC,EAAgB,CAAC,EAAG,CAJzCC,EAAA,KAAAJ,EAAA,QAMEK,EAAA,KAAKL,EAAUG,GAAA,YAAAA,EAAe,OAChC,CANA,IAAI,QAAS,CACX,OAAOG,EAAA,KAAKN,EACd,CAKA,iBAAkB,CAAC,CACrB,EATEA,EAAA,YAWF,SAASO,EAAcC,EAAUV,EAAU,CACzC,OAAO,IAAIL,CACb,CAEA,IAAMgB,EAAiB,CACrB,SAAU,CACR,cAAAF,CACF,EACA,iBACA,eAAAZ,EACA,YAAAM,EACA,YAAAX,EACA,YAAAG,EACA,iBAAAC,CACF,EAEMgB,EAAW,OAAO,QAAW,aAAe,OAAO,WAAW,gBAAmB,YACjFC,EAAaD,EAAWD,EAAiB,WACzCG,EAAWF,EAAWD,EAAe,SAAW,WAAW,SD1DjE,IAAAI,EAWO,8BERP,IAAMC,EAAsB,IAAM,CACh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GAErB,EAgGF,IAAIM,EAAgB,CAAC,EAKfC,EAAe3B,EAAS,cAAc,OAAO,EAG7C4B,EAAkB,CAAC,6BAA8B,0BAA0B,EAKjF,QACMC,EAAQ,OAAO,eAAeF,CAAY,EAC9CE,GAASA,IAAUxB,EAAW,YAAY,UAC1CwB,EAAQ,OAAO,eAAeA,CAAK,EAEnC,OAAO,KAAKA,CAAK,EAAE,QAASC,GAAQ,CAC9BF,EAAgB,QAAQE,CAAG,IAAM,IACnCJ,EAAc,KAAKI,CAAG,CAE1B,CAAC,EAIHJ,EAAc,QAASK,GAAS,CAG9B,GAFa,OAAOJ,EAAaI,IAErB,WAEV3B,EAAmB,UAAU2B,GAAQ,UAAY,CAC/C,OAAO,KAAK,SAASA,GAAM,MAAM,KAAK,SAAU,SAAS,CAC3D,MACK,CAEL,IAAIC,EAAS,CACX,KAAM,CACJ,OAAO,KAAK,SAASD,EACvB,CACF,EAEIA,IAASA,EAAK,YAAY,IAE5BC,EAAO,IAAM,SAAUC,EAAK,CAC1B,KAAK,SAASF,GAAQE,CACxB,GAGF,OAAO,eAAe7B,EAAmB,UAAW2B,EAAMC,CAAM,CAClE,CACF,CAAC,EAED,SAAShB,GAAiBkB,EAAKC,EAAM,CACnC,IAAIC,EAAQ,KAEZ,OAAAF,EAAI,QAASG,GAAS,CAChBA,EAAK,YAAY,GAAKF,EAAK,YAAY,IACzCC,EAAQC,EAEZ,CAAC,EAEMD,CACT,CAEK/B,EAAW,eAAe,IAAI,cAAc,IAC/CA,EAAW,eAAe,OAAO,eAAgBD,CAAkB,EACnEC,EAAW,mBAAqBD,GAGlC,IAAOkC,EAAQlC,
|
|
6
|
-
"names": ["src_exports", "__export", "AudioEvents", "src_default", "__toCommonJS", "EventTarget", "_event", "DocumentFragment", "HTMLElement", "HTMLVideoElement", "customElements", "_name", "_constructor", "_options", "_root", "_detail", "CustomEvent", "typeArg", "eventInitDict", "__privateAdd", "__privateSet", "__privateGet", "createElement", "_tagName", "globalThisShim", "isServer", "GlobalThis", "Document", "import_playback_core", "getEnvPlayerVersion", "player_version", "getPlayerVersion", "AudioEvents", "template", "Document", "_isInit", "_init", "init_fn", "CustomAudioElement", "GlobalThis", "__privateAdd", "__privateMethod", "attrs", "propName", "isFunc", "supAttrs", "attrName", "oldValue", "newValue", "ownProps", "arrayFindAnyCase", "isBaseElement", "__privateGet", "__privateSet", "nativeEl", "type", "evt", "slotEl", "el", "attrNode", "nativeElProps", "nativeElTest", "deprecatedProps", "proto", "key", "prop", "config", "val", "arr", "word", "found", "item", "CustomAudioElement_default", "Attributes", "AttributeNameValues", "playerSoftwareVersion", "getPlayerVersion", "playerSoftwareName", "_core", "_loadRequested", "_playerInitTime", "_metadata", "_requestLoad", "requestLoad_fn", "MuxAudioElement", "CustomAudioElement_default", "__privateAdd", "__privateSet", "_a", "__privateGet", "val", "num", "attrName", "oldValue", "newValue", "_b", "hadSrc", "hasSrc", "__privateMethod", "debug", "resp", "json", "_err", "GlobalThis", "src_default", "MuxAudioElement"]
|
|
4
|
+
"sourcesContent": ["import { globalThis } from 'shared-polyfills';\nimport {\n initialize,\n teardown,\n generatePlayerInitTime,\n MuxMediaProps,\n StreamTypes,\n PlaybackTypes,\n ValueOf,\n toMuxVideoURL,\n Metadata,\n MediaError,\n} from '@mux/playback-core';\nimport type { PlaybackCore, PlaybackEngine, Autoplay, ExtensionMimeTypeMap } from '@mux/playback-core';\nimport { getPlayerVersion } from './env';\n// this must be imported after playback-core for the polyfill to be included\nimport CustomAudioElement, { AudioEvents } from './CustomAudioElement';\n\n/** @TODO make the relationship between name+value smarter and more deriveable (CJP) */\ntype AttributeNames = {\n ENV_KEY: 'env-key';\n DEBUG: 'debug';\n METADATA_URL: 'metadata-url';\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain';\n DISABLE_COOKIES: 'disable-cookies';\n PLAYBACK_ID: 'playback-id';\n PREFER_PLAYBACK: 'prefer-playback';\n TYPE: 'type';\n STREAM_TYPE: 'stream-type';\n START_TIME: 'start-time';\n};\n\nconst Attributes: AttributeNames = {\n ENV_KEY: 'env-key',\n DEBUG: 'debug',\n PLAYBACK_ID: 'playback-id',\n METADATA_URL: 'metadata-url',\n PREFER_PLAYBACK: 'prefer-playback',\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain',\n DISABLE_COOKIES: 'disable-cookies',\n TYPE: 'type',\n STREAM_TYPE: 'stream-type',\n START_TIME: 'start-time',\n};\n\nconst AttributeNameValues = Object.values(Attributes);\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-audio';\n\nclass MuxAudioElement extends CustomAudioElement<HTMLAudioElement> implements Partial<MuxMediaProps> {\n static get observedAttributes() {\n return [...AttributeNameValues, ...(CustomAudioElement.observedAttributes ?? [])];\n }\n\n #core?: PlaybackCore;\n #loadRequested?: Promise<void> | null;\n #playerInitTime: number;\n #metadata: Readonly<Metadata> = {};\n\n constructor() {\n super();\n this.#playerInitTime = generatePlayerInitTime();\n }\n\n get playerInitTime() {\n return this.#playerInitTime;\n }\n\n get playerSoftwareName() {\n return playerSoftwareName;\n }\n\n get playerSoftwareVersion() {\n return playerSoftwareVersion;\n }\n\n // Keeping this named \"_hls\" since it's exposed for unadvertised \"advanced usage\" via getter that assumes specifically hls.js (CJP)\n get _hls(): PlaybackEngine | undefined {\n return this.#core?.engine;\n }\n\n get mux(): Readonly<HTMLAudioElement['mux']> | undefined {\n return this.nativeEl.mux;\n }\n\n get src() {\n // Use the attribute value as the source of truth.\n // No need to store it in two places.\n // This avoids needing a to read the attribute initially and update the src.\n return this.getAttribute('src') as string;\n }\n\n set src(val: string) {\n // If being set by attributeChangedCallback,\n // dont' cause an infinite loop\n if (val === this.src) return;\n\n if (val == null) {\n this.removeAttribute('src');\n } else {\n this.setAttribute('src', val);\n }\n }\n\n get preload() {\n const val = this.getAttribute('preload') as HTMLMediaElement['preload'];\n if (val === '') return 'auto';\n if (['none', 'metadata', 'auto'].includes(val)) return val;\n return super.preload;\n }\n\n set preload(val) {\n // don't cause an infinite loop\n // check the attribute because an empty string maps to the `auto` prop\n if (val == this.getAttribute('preload')) return;\n\n if (['', 'none', 'metadata', 'auto'].includes(val)) {\n this.setAttribute('preload', val);\n } else {\n this.removeAttribute('preload');\n }\n }\n\n get debug(): boolean {\n return this.getAttribute(Attributes.DEBUG) != null;\n }\n\n set debug(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.debug) return;\n\n if (val) {\n this.setAttribute(Attributes.DEBUG, '');\n } else {\n this.removeAttribute(Attributes.DEBUG);\n }\n }\n\n get disableCookies(): boolean {\n return this.hasAttribute(Attributes.DISABLE_COOKIES);\n }\n\n set disableCookies(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.disableCookies) return;\n\n if (val) {\n this.setAttribute(Attributes.DISABLE_COOKIES, '');\n } else {\n this.removeAttribute(Attributes.DISABLE_COOKIES);\n }\n }\n\n get startTime(): number | undefined {\n const val = this.getAttribute(Attributes.START_TIME);\n if (val == null) return undefined;\n const num = +val;\n return !Number.isNaN(num) ? num : undefined;\n }\n\n set startTime(val: number | undefined) {\n // dont' cause an infinite loop\n if (val === this.startTime) return;\n\n if (val == null) {\n this.removeAttribute(Attributes.START_TIME);\n } else {\n this.setAttribute(Attributes.START_TIME, `${val}`);\n }\n }\n\n get playbackId(): string | undefined {\n return this.getAttribute(Attributes.PLAYBACK_ID) ?? undefined;\n }\n\n set playbackId(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.playbackId) return;\n\n if (val) {\n this.setAttribute(Attributes.PLAYBACK_ID, val);\n } else {\n this.removeAttribute(Attributes.PLAYBACK_ID);\n }\n }\n\n get envKey(): string | undefined {\n return this.getAttribute(Attributes.ENV_KEY) ?? undefined;\n }\n\n set envKey(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.envKey) return;\n\n if (val) {\n this.setAttribute(Attributes.ENV_KEY, val);\n } else {\n this.removeAttribute(Attributes.ENV_KEY);\n }\n }\n\n get beaconCollectionDomain(): string | undefined {\n return this.getAttribute(Attributes.BEACON_COLLECTION_DOMAIN) ?? undefined;\n }\n\n set beaconCollectionDomain(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.beaconCollectionDomain) return;\n\n if (val) {\n this.setAttribute(Attributes.BEACON_COLLECTION_DOMAIN, val);\n } else {\n this.removeAttribute(Attributes.BEACON_COLLECTION_DOMAIN);\n }\n }\n\n get streamType(): ValueOf<StreamTypes> | undefined {\n // getAttribute doesn't know that this attribute is well defined. Should explore extending for MuxVideo (CJP)\n return (this.getAttribute(Attributes.STREAM_TYPE) as ValueOf<StreamTypes>) ?? undefined;\n }\n\n set streamType(val: ValueOf<StreamTypes> | undefined) {\n // dont' cause an infinite loop\n if (val === this.streamType) return;\n\n if (val) {\n this.setAttribute(Attributes.STREAM_TYPE, val);\n } else {\n this.removeAttribute(Attributes.STREAM_TYPE);\n }\n }\n\n get preferPlayback(): ValueOf<PlaybackTypes> | undefined {\n const val = this.getAttribute(Attributes.PREFER_PLAYBACK);\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) return val;\n return undefined;\n }\n\n set preferPlayback(val: ValueOf<PlaybackTypes> | undefined) {\n if (val === this.preferPlayback) return;\n\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) {\n this.setAttribute(Attributes.PREFER_PLAYBACK, val);\n } else {\n this.removeAttribute(Attributes.PREFER_PLAYBACK);\n }\n }\n\n get metadata() {\n const inferredMetadataAttrs: { [key: string]: string } = this.getAttributeNames()\n .filter((attrName) => {\n return attrName.startsWith('metadata-') && !([Attributes.METADATA_URL] as string[]).includes(attrName);\n })\n .reduce((currAttrs, attrName) => {\n const value = this.getAttribute(attrName);\n if (value != null) {\n currAttrs[attrName.replace(/^metadata-/, '').replace(/-/g, '_') as string] = value;\n }\n return currAttrs;\n }, {} as { [key: string]: string });\n\n return {\n ...inferredMetadataAttrs,\n ...this.#metadata,\n };\n }\n\n set metadata(val: Readonly<Metadata> | undefined) {\n this.#metadata = val ?? {};\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src.'\n );\n this.mux.emit('hb', this.#metadata);\n }\n }\n\n async #requestLoad() {\n if (this.#loadRequested) return;\n await (this.#loadRequested = Promise.resolve());\n this.#loadRequested = null;\n this.load();\n }\n\n load() {\n this.#core = initialize(this as Partial<MuxMediaProps>, this.nativeEl, this.#core);\n }\n\n unload() {\n teardown(this.nativeEl, this.#core);\n this.#core = undefined;\n }\n\n attributeChangedCallback(attrName: string, oldValue: string | null, newValue: string | null) {\n super.attributeChangedCallback(attrName, oldValue, newValue);\n\n switch (attrName) {\n case 'src': {\n const hadSrc = !!oldValue;\n const hasSrc = !!newValue;\n if (!hadSrc && hasSrc) {\n this.#requestLoad();\n } else if (hadSrc && !hasSrc) {\n this.unload();\n /** @TODO Test this thoroughly (async?) and confirm unload() necessary (CJP) */\n } else if (hadSrc && hasSrc) {\n this.unload();\n this.#requestLoad();\n }\n break;\n }\n case 'autoplay':\n if (newValue === oldValue) {\n break;\n }\n /** In case newValue is an empty string or null, use this.autoplay which translates to booleans (WL) */\n this.#core?.setAutoplay(this.autoplay);\n break;\n case 'preload':\n if (newValue === oldValue) {\n break;\n }\n this.#core?.setPreload(newValue as HTMLMediaElement['preload']);\n break;\n case Attributes.PLAYBACK_ID:\n /** @TODO Improv+Discuss - how should playback-id update wrt src attr changes (and vice versa) (CJP) */\n this.src = toMuxVideoURL(newValue ?? undefined) as string;\n break;\n case Attributes.DEBUG: {\n const debug = this.debug;\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src.'\n );\n }\n if (!!this._hls) {\n this._hls.config.debug = debug;\n }\n break;\n }\n case Attributes.METADATA_URL:\n if (newValue) {\n fetch(newValue)\n .then((resp) => resp.json())\n .then((json) => (this.metadata = json))\n .catch((_err) => console.error(`Unable to load or parse metadata JSON from metadata-url ${newValue}!`));\n }\n break;\n default:\n break;\n }\n }\n\n disconnectedCallback() {\n this.unload();\n }\n}\n\ntype MuxAudioElementType = typeof MuxAudioElement;\ndeclare global {\n var MuxAudioElement: MuxAudioElementType; // eslint-disable-line\n}\n\nif (!globalThis.customElements.get('mux-audio')) {\n globalThis.customElements.define('mux-audio', MuxAudioElement);\n /** @TODO consider externalizing this (breaks standard modularity) */\n globalThis.MuxAudioElement = MuxAudioElement;\n}\n\nexport { PlaybackEngine, PlaybackEngine as Hls, ExtensionMimeTypeMap as MimeTypes, MediaError, AudioEvents };\n\nexport default MuxAudioElement;\n", "class EventTarget {\n addEventListener() {}\n removeEventListener() {}\n dispatchEvent(_event) {\n return true;\n }\n}\n\n// @github/template-parts requires DocumentFragment to be available on globalThis for SSR\nif (typeof DocumentFragment === 'undefined') {\n class DocumentFragment extends EventTarget {}\n // @ts-ignore\n globalThis.DocumentFragment = DocumentFragment;\n}\n\nclass HTMLElement extends EventTarget {}\nclass HTMLVideoElement extends EventTarget {}\n\nconst customElements = {\n get(_name) {\n return undefined;\n },\n define(_name, _constructor, _options) {},\n upgrade(_root) {},\n whenDefined(_name) {\n return Promise.resolve(HTMLElement);\n },\n};\n\nclass CustomEvent {\n #detail;\n get detail() {\n return this.#detail;\n }\n constructor(typeArg, eventInitDict = {}) {\n // super(typeArg, eventInitDict);\n this.#detail = eventInitDict?.detail;\n }\n initCustomEvent() {}\n}\n\nfunction createElement(_tagName, _options) {\n return new HTMLElement();\n}\n\nconst globalThisShim = {\n document: {\n createElement,\n },\n DocumentFragment,\n customElements,\n CustomEvent,\n EventTarget,\n HTMLElement,\n HTMLVideoElement,\n};\n\nconst isServer = typeof window === 'undefined' || typeof globalThis.customElements === 'undefined';\nconst GlobalThis = isServer ? globalThisShim : globalThis;\nconst Document = isServer ? globalThisShim.document : globalThis.document;\n\nexport { GlobalThis as globalThis, Document as document };\n", "export const isMaybeBrowser = () => typeof window != 'undefined';\n// @ts-ignore\nexport const isMaybeServer = () => typeof global != 'undefined';\n\nconst getEnvPlayerVersion = () => {\n try {\n // @ts-ignore\n return PLAYER_VERSION as string;\n } catch {}\n return 'UNKNOWN';\n};\n\nconst player_version: string = getEnvPlayerVersion();\n\nexport const getPlayerVersion = () => player_version;\n", "import { globalThis, document } from 'shared-polyfills';\n/**\n * Custom Audio Element\n * The goal is to create an element that works just like the audio element\n * but can be extended/sub-classed, because native elements cannot be\n * extended today across browsers.\n */\n\nexport const AudioEvents = [\n 'abort',\n 'canplay',\n 'canplaythrough',\n 'durationchange',\n 'emptied',\n 'ended',\n 'error',\n 'loadeddata',\n 'loadedmetadata',\n 'loadstart',\n 'pause',\n 'play',\n 'playing',\n 'progress',\n 'ratechange',\n 'seeked',\n 'seeking',\n 'stalled',\n 'suspend',\n 'timeupdate',\n 'volumechange',\n 'waiting',\n];\n\nconst template = document.createElement('template');\n// Could you get styles to apply by passing a global button from global to shadow?\n\ntemplate.innerHTML = `\n<style>\n :host {\n /* display:inline (like the native el) makes it so you can't fill\n the container with the native el */\n display: inline-block;\n box-sizing: border-box;\n\n width: auto;\n height: auto;\n }\n\n audio {\n max-width: 100%;\n max-height: 100%;\n min-width: 100%;\n min-height: 100%;\n }\n\n</style>\n\n<audio part=\"audio\" crossorigin></audio>\n<slot></slot>\n`;\n\nclass CustomAudioElement extends globalThis.HTMLElement {\n #isInit;\n\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n\n // If the custom element is defined before the <custom-video> HTML is parsed\n // no attributes will be available in the constructor (construction process).\n // Wait until initializing attributes in the attributeChangedCallback.\n // If this element is connected to the DOM, the attributes will be available.\n if (this.isConnected) {\n this.#init();\n }\n }\n\n #init() {\n if (this.#isInit) return;\n this.#isInit = true;\n\n this.shadowRoot.append(template.content.cloneNode(true));\n const nativeEl = (this.nativeEl = this.shadowRoot.querySelector('audio'));\n\n // The audio events are dispatched on the CustomAudioElement instance.\n // This makes it possible to add event listeners before the element is upgraded.\n AudioEvents.forEach((type) => {\n nativeEl.addEventListener(type, (evt) => {\n this.dispatchEvent(new CustomEvent(evt.type, { detail: evt.detail }));\n });\n });\n\n const slotEl = this.shadowRoot.querySelector('slot');\n slotEl.addEventListener('slotchange', () => {\n slotEl.assignedElements().forEach((el) => {\n if (!['track', 'source'].includes(el.localName)) return;\n nativeEl.append(el);\n });\n });\n\n // Initialize all the attribute properties\n // This is required before attributeChangedCallback is called after construction\n // so the initial state of all the attributes are forwarded to the native element.\n Array.from(this.attributes).forEach((attrNode) => {\n this.forwardAttribute(attrNode.name, null, attrNode.value);\n });\n\n // Neither Chrome or Firefox support setting the muted attribute\n // after using document.createElement.\n // One way to get around this would be to build the native tag as a string.\n // But just fixing it manually for now.\n // Apparently this may also be an issue with <input checked> for buttons\n if (nativeEl.defaultMuted) {\n nativeEl.muted = true;\n }\n }\n\n // observedAttributes is required to trigger attributeChangedCallback\n // for any attributes on the custom element.\n // Attributes need to be the lowercase word, e.g. crossorigin, not crossOrigin\n static get observedAttributes() {\n let attrs = [];\n\n // Instead of manually creating a list of all observed attributes,\n // observe any getter/setter prop name (lowercased)\n Object.getOwnPropertyNames(this.prototype).forEach((propName) => {\n let isFunc = false;\n\n // Non-func properties throw errors because it's not an instance\n try {\n if (typeof this.prototype[propName] === 'function') {\n isFunc = true;\n }\n } catch (e) {}\n\n // Exclude functions and constants\n if (!isFunc && propName !== propName.toUpperCase()) {\n attrs.push(propName.toLowerCase());\n }\n });\n\n // Include any attributes from the super class (recursive)\n const supAttrs = Object.getPrototypeOf(this).observedAttributes;\n\n if (supAttrs) {\n attrs = attrs.concat(supAttrs);\n }\n\n return attrs;\n }\n\n // We need to handle sub-class custom attributes differently from\n // attrs meant to be passed to the internal native el.\n attributeChangedCallback(attrName, oldValue, newValue) {\n // Initialize right after construction when the attributes become available.\n this.#init();\n\n this.forwardAttribute(attrName, oldValue, newValue);\n }\n\n forwardAttribute(attrName, oldValue, newValue) {\n // Find the matching prop for custom attributes\n const ownProps = Object.getOwnPropertyNames(Object.getPrototypeOf(this));\n const propName = arrayFindAnyCase(ownProps, attrName);\n\n // Check if this is the original custom native elemnt or a subclass\n const isBaseElement = Object.getPrototypeOf(this.constructor).toString().indexOf('function HTMLElement') === 0;\n\n // If this is a subclass custom attribute we want to set the\n // matching property on the subclass\n if (propName && !isBaseElement) {\n // Boolean props should never start as null\n if (typeof this[propName] == 'boolean') {\n // null is returned when attributes are removed i.e. boolean attrs\n if (newValue === null) {\n this[propName] = false;\n } else {\n // The new value might be an empty string, which is still true\n // for boolean attributes\n this[propName] = true;\n }\n } else {\n this[propName] = newValue;\n }\n } else {\n // When this is the original Custom Element, or the subclass doesn't\n // have a matching prop, pass it through.\n if (newValue === null) {\n this.nativeEl.removeAttribute(attrName);\n } else {\n // Ignore a few that don't need to be passed through just in case\n // it creates unexpected behavior.\n if (['id', 'class'].indexOf(attrName) === -1) {\n this.nativeEl.setAttribute(attrName, newValue);\n }\n }\n }\n }\n\n connectedCallback() {\n this.#init();\n }\n}\n\n// Map all native element properties to the custom element\n// so that they're applied to the native element.\n// Skipping HTMLElement because of things like \"attachShadow\"\n// causing issues. Most of those props still need to apply to\n// the custom element.\n// But includign EventTarget props because most events emit from\n// the native element.\nlet nativeElProps = [];\n\n// Can't check typeof directly on element prototypes without\n// throwing Illegal Invocation errors, so creating an element\n// to check on instead.\nconst nativeElTest = document.createElement('audio');\n\n// Deprecated props throw warnings if used, so exclude them\nconst deprecatedProps = ['webkitDisplayingFullscreen', 'webkitSupportsFullscreen'];\n\n// Walk the prototype chain up to HTMLElement.\n// This will grab all super class props in between.\n// i.e. AudioElement and MediaElement\nfor (\n let proto = Object.getPrototypeOf(nativeElTest);\n proto && proto !== globalThis.HTMLElement.prototype;\n proto = Object.getPrototypeOf(proto)\n) {\n Object.keys(proto).forEach((key) => {\n if (deprecatedProps.indexOf(key) === -1) {\n nativeElProps.push(key);\n }\n });\n}\n\n// Passthrough native el functions from the custom el to the native el\nnativeElProps.forEach((prop) => {\n const type = typeof nativeElTest[prop];\n\n if (type == 'function') {\n // Function\n CustomAudioElement.prototype[prop] = function () {\n return this.nativeEl[prop].apply(this.nativeEl, arguments);\n };\n } else {\n // Getter\n let config = {\n get() {\n return this.nativeEl[prop];\n },\n };\n\n if (prop !== prop.toUpperCase()) {\n // Setter (not a CONSTANT)\n config.set = function (val) {\n this.nativeEl[prop] = val;\n };\n }\n\n Object.defineProperty(CustomAudioElement.prototype, prop, config);\n }\n});\n\nfunction arrayFindAnyCase(arr, word) {\n let found = null;\n\n arr.forEach((item) => {\n if (item.toLowerCase() == word.toLowerCase()) {\n found = item;\n }\n });\n\n return found;\n}\n\nif (!globalThis.customElements.get('custom-audio')) {\n globalThis.customElements.define('custom-audio', CustomAudioElement);\n globalThis.CustomAudioElement = CustomAudioElement;\n}\n\nexport default CustomAudioElement;\n"],
|
|
5
|
+
"mappings": "8yBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,iBAAAE,EAAA,wCAAAC,KAAA,eAAAC,EAAAJ,ICAA,IAAMK,EAAN,KAAkB,CAChB,kBAAmB,CAAC,CACpB,qBAAsB,CAAC,CACvB,cAAcC,EAAQ,CACpB,MAAO,EACT,CACF,EAGA,GAAI,OAAO,kBAAqB,YAAa,CAC3C,MAAMC,UAAyBF,CAAY,CAAC,CAE5C,WAAW,iBAAmBE,CAChC,CAEA,IAAMC,EAAN,cAA0BH,CAAY,CAAC,EACjCI,EAAN,cAA+BJ,CAAY,CAAC,EAEtCK,EAAiB,CACrB,IAAIC,EAAO,CAEX,EACA,OAAOA,EAAOC,EAAcC,EAAU,CAAC,EACvC,QAAQC,EAAO,CAAC,EAChB,YAAYH,EAAO,CACjB,OAAO,QAAQ,QAAQH,CAAW,CACpC,CACF,EA3BAO,EA6BMC,EAAN,KAAkB,CAKhB,YAAYC,EAASC,EAAgB,CAAC,EAAG,CAJzCC,EAAA,KAAAJ,EAAA,QAMEK,EAAA,KAAKL,EAAUG,GAAA,YAAAA,EAAe,OAChC,CANA,IAAI,QAAS,CACX,OAAO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AAK,OAAM,iBAAcuB,GAAA,KAAAA,EAAY,MAAS,EAC9C,WACGvB,EAAW,MAAO,CACrB,IAAM4B,EAAQ,KAAK,MACb,KAAK,KAET,QAAQ,KACN,+HACF,EAEI,KAAK,OACT,KAAK,KAAK,OAAO,MAAQA,GAE3B,KACF,MACK5B,EAAW,aACVuB,GACF,MAAMA,CAAQ,EACX,KAAMM,GAASA,EAAK,KAAK,CAAC,EAC1B,KAAMC,GAAU,KAAK,SAAWA,CAAK,EACrC,MAAOC,GAAS,QAAQ,MAAM,2DAA2DR,IAAW,CAAC,EAE1G,cAEA,MAEN,CAEA,sBAAuB,CACrB,KAAK,OAAO,CACd,CACF,EAhTElB,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YA6NMC,EAAA,YAAAC,EAAY,gBAAG,CACfM,EAAA,KAAKV,KACT,MAAOQ,EAAA,KAAKR,EAAiB,QAAQ,QAAQ,GAC7CQ,EAAA,KAAKR,EAAiB,MACtB,KAAK,KAAK,EACZ,EAkFG0B,EAAW,eAAe,IAAI,WAAW,IAC5CA,EAAW,eAAe,OAAO,YAAarB,CAAe,EAE7DqB,EAAW,gBAAkBrB,GAK/B,IAAOsB,GAAQC",
|
|
6
|
+
"names": ["src_exports", "__export", "AudioEvents", "src_default", "__toCommonJS", "EventTarget", "_event", "DocumentFragment", "HTMLElement", "HTMLVideoElement", "customElements", "_name", "_constructor", "_options", "_root", "_detail", "CustomEvent", "typeArg", "eventInitDict", "__privateAdd", "__privateSet", "__privateGet", "createElement", "_tagName", "globalThisShim", "isServer", "GlobalThis", "Document", "import_playback_core", "getEnvPlayerVersion", "player_version", "getPlayerVersion", "AudioEvents", "template", "Document", "_isInit", "_init", "init_fn", "CustomAudioElement", "GlobalThis", "__privateAdd", "__privateMethod", "attrs", "propName", "isFunc", "supAttrs", "attrName", "oldValue", "newValue", "ownProps", "arrayFindAnyCase", "isBaseElement", "__privateGet", "__privateSet", "nativeEl", "type", "evt", "slotEl", "el", "attrNode", "nativeElProps", "nativeElTest", "deprecatedProps", "proto", "key", "prop", "config", "val", "arr", "word", "found", "item", "CustomAudioElement_default", "Attributes", "AttributeNameValues", "playerSoftwareVersion", "getPlayerVersion", "playerSoftwareName", "_core", "_loadRequested", "_playerInitTime", "_metadata", "_requestLoad", "requestLoad_fn", "MuxAudioElement", "CustomAudioElement_default", "__privateAdd", "__privateSet", "_a", "__privateGet", "val", "num", "attrName", "currAttrs", "value", "oldValue", "newValue", "_b", "hadSrc", "hasSrc", "__privateMethod", "debug", "resp", "json", "_err", "GlobalThis", "src_default", "MuxAudioElement"]
|
|
7
7
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var S=(t,n,e)=>{if(!n.has(t))throw TypeError("Cannot "+e)};var a=(t,n,e)=>(S(t,n,"read from private field"),e?e.call(t):n.get(t)),l=(t,n,e)=>{if(n.has(t))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(t):n.set(t,e)},d=(t,n,e,s)=>(S(t,n,"write to private field"),s?s.call(t,e):n.set(t,e),e);var m=(t,n,e)=>(S(t,n,"access private method"),e);var p=class{addEventListener(){}removeEventListener(){}dispatchEvent(n){return!0}};if(typeof DocumentFragment=="undefined"){class t extends p{}globalThis.DocumentFragment=t}var y=class extends p{},x=class extends p{},j={get(t){},define(t,n,e){},upgrade(t){},whenDefined(t){return Promise.resolve(y)}},T,I=class{constructor(n,e={}){l(this,T,void 0);d(this,T,e==null?void 0:e.detail)}get detail(){return a(this,T)}initCustomEvent(){}};T=new WeakMap;function G(t,n){return new y}var N={document:{createElement:G},DocumentFragment,customElements:j,CustomEvent:I,EventTarget:p,HTMLElement:y,HTMLVideoElement:x},B=typeof window=="undefined"||typeof globalThis.customElements=="undefined",c=B?N:globalThis,v=B?N.document:globalThis.document;import{initialize as W,teardown as $,generatePlayerInitTime as J,PlaybackTypes as k,toMuxVideoURL as Q,MediaError as he}from"@mux/playback-core";var H=()=>{try{return"0.9.0"}catch{}return"UNKNOWN"},q=H(),K=()=>q;var Y=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],w=v.createElement("template");w.innerHTML=`
|
|
2
2
|
<style>
|
|
3
3
|
:host {
|
|
4
4
|
/* display:inline (like the native el) makes it so you can't fill
|
|
@@ -21,5 +21,5 @@ var L=(t,r,e)=>{if(!r.has(t))throw TypeError("Cannot "+e)};var n=(t,r,e)=>(L(t,r
|
|
|
21
21
|
|
|
22
22
|
<audio part="audio" crossorigin></audio>
|
|
23
23
|
<slot></slot>
|
|
24
|
-
`;var _,
|
|
24
|
+
`;var _,E,M,b=class extends c.HTMLElement{constructor(){super();l(this,E);l(this,_,void 0);this.attachShadow({mode:"open"}),this.isConnected&&m(this,E,M).call(this)}static get observedAttributes(){let e=[];Object.getOwnPropertyNames(this.prototype).forEach(i=>{let o=!1;try{typeof this.prototype[i]=="function"&&(o=!0)}catch{}!o&&i!==i.toUpperCase()&&e.push(i.toLowerCase())});let s=Object.getPrototypeOf(this).observedAttributes;return s&&(e=e.concat(s)),e}attributeChangedCallback(e,s,i){m(this,E,M).call(this),this.forwardAttribute(e,s,i)}forwardAttribute(e,s,i){let o=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),f=V(o,e),u=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;f&&!u?typeof this[f]=="boolean"?i===null?this[f]=!1:this[f]=!0:this[f]=i:i===null?this.nativeEl.removeAttribute(e):["id","class"].indexOf(e)===-1&&this.nativeEl.setAttribute(e,i)}connectedCallback(){m(this,E,M).call(this)}};_=new WeakMap,E=new WeakSet,M=function(){if(a(this,_))return;d(this,_,!0),this.shadowRoot.append(w.content.cloneNode(!0));let e=this.nativeEl=this.shadowRoot.querySelector("audio");Y.forEach(i=>{e.addEventListener(i,o=>{this.dispatchEvent(new CustomEvent(o.type,{detail:o.detail}))})});let s=this.shadowRoot.querySelector("slot");s.addEventListener("slotchange",()=>{s.assignedElements().forEach(i=>{!["track","source"].includes(i.localName)||e.append(i)})}),Array.from(this.attributes).forEach(i=>{this.forwardAttribute(i.name,null,i.value)}),e.defaultMuted&&(e.muted=!0)};var U=[],F=v.createElement("audio"),z=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let t=Object.getPrototypeOf(F);t&&t!==c.HTMLElement.prototype;t=Object.getPrototypeOf(t))Object.keys(t).forEach(n=>{z.indexOf(n)===-1&&U.push(n)});U.forEach(t=>{if(typeof F[t]=="function")b.prototype[t]=function(){return this.nativeEl[t].apply(this.nativeEl,arguments)};else{let e={get(){return this.nativeEl[t]}};t!==t.toUpperCase()&&(e.set=function(s){this.nativeEl[t]=s}),Object.defineProperty(b.prototype,t,e)}});function V(t,n){let e=null;return t.forEach(s=>{s.toLowerCase()==n.toLowerCase()&&(e=s)}),e}c.customElements.get("custom-audio")||(c.customElements.define("custom-audio",b),c.CustomAudioElement=b);var R=b;var r={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},X=Object.values(r),Z=K(),ee="mux-audio",h,g,O,A,C,D,P=class extends R{constructor(){super();l(this,C);l(this,h,void 0);l(this,g,void 0);l(this,O,void 0);l(this,A,{});d(this,O,J())}static get observedAttributes(){var e;return[...X,...(e=R.observedAttributes)!=null?e:[]]}get playerInitTime(){return a(this,O)}get playerSoftwareName(){return ee}get playerSoftwareVersion(){return Z}get _hls(){var e;return(e=a(this,h))==null?void 0:e.engine}get mux(){return this.nativeEl.mux}get src(){return this.getAttribute("src")}set src(e){e!==this.src&&(e==null?this.removeAttribute("src"):this.setAttribute("src",e))}get preload(){let e=this.getAttribute("preload");return e===""?"auto":["none","metadata","auto"].includes(e)?e:super.preload}set preload(e){e!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(e)?this.setAttribute("preload",e):this.removeAttribute("preload"))}get debug(){return this.getAttribute(r.DEBUG)!=null}set debug(e){e!==this.debug&&(e?this.setAttribute(r.DEBUG,""):this.removeAttribute(r.DEBUG))}get disableCookies(){return this.hasAttribute(r.DISABLE_COOKIES)}set disableCookies(e){e!==this.disableCookies&&(e?this.setAttribute(r.DISABLE_COOKIES,""):this.removeAttribute(r.DISABLE_COOKIES))}get startTime(){let e=this.getAttribute(r.START_TIME);if(e==null)return;let s=+e;return Number.isNaN(s)?void 0:s}set startTime(e){e!==this.startTime&&(e==null?this.removeAttribute(r.START_TIME):this.setAttribute(r.START_TIME,`${e}`))}get playbackId(){var e;return(e=this.getAttribute(r.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e!==this.playbackId&&(e?this.setAttribute(r.PLAYBACK_ID,e):this.removeAttribute(r.PLAYBACK_ID))}get envKey(){var e;return(e=this.getAttribute(r.ENV_KEY))!=null?e:void 0}set envKey(e){e!==this.envKey&&(e?this.setAttribute(r.ENV_KEY,e):this.removeAttribute(r.ENV_KEY))}get beaconCollectionDomain(){var e;return(e=this.getAttribute(r.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(r.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(r.BEACON_COLLECTION_DOMAIN))}get streamType(){var e;return(e=this.getAttribute(r.STREAM_TYPE))!=null?e:void 0}set streamType(e){e!==this.streamType&&(e?this.setAttribute(r.STREAM_TYPE,e):this.removeAttribute(r.STREAM_TYPE))}get preferPlayback(){let e=this.getAttribute(r.PREFER_PLAYBACK);if(e===k.MSE||e===k.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===k.MSE||e===k.NATIVE?this.setAttribute(r.PREFER_PLAYBACK,e):this.removeAttribute(r.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(s=>s.startsWith("metadata-")&&![r.METADATA_URL].includes(s)).reduce((s,i)=>{let o=this.getAttribute(i);return o!=null&&(s[i.replace(/^metadata-/,"").replace(/-/g,"_")]=o),s},{}),...a(this,A)}}set metadata(e){d(this,A,e!=null?e:{}),this.mux&&(console.info("Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src."),this.mux.emit("hb",a(this,A)))}load(){d(this,h,W(this,this.nativeEl,a(this,h)))}unload(){$(this.nativeEl,a(this,h)),d(this,h,void 0)}attributeChangedCallback(e,s,i){var o,f;switch(super.attributeChangedCallback(e,s,i),e){case"src":{let u=!!s,L=!!i;!u&&L?m(this,C,D).call(this):u&&!L?this.unload():u&&L&&(this.unload(),m(this,C,D).call(this));break}case"autoplay":if(i===s)break;(o=a(this,h))==null||o.setAutoplay(this.autoplay);break;case"preload":if(i===s)break;(f=a(this,h))==null||f.setPreload(i);break;case r.PLAYBACK_ID:this.src=Q(i!=null?i:void 0);break;case r.DEBUG:{let u=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=u);break}case r.METADATA_URL:i&&fetch(i).then(u=>u.json()).then(u=>this.metadata=u).catch(u=>console.error(`Unable to load or parse metadata JSON from metadata-url ${i}!`));break;default:break}}disconnectedCallback(){this.unload()}};h=new WeakMap,g=new WeakMap,O=new WeakMap,A=new WeakMap,C=new WeakSet,D=async function(){a(this,g)||(await d(this,g,Promise.resolve()),d(this,g,null),this.load())};c.customElements.get("mux-audio")||(c.customElements.define("mux-audio",P),c.MuxAudioElement=P);var be=P;export{Y as AudioEvents,he as MediaError,be as default};
|
|
25
25
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../shared/polyfills/index.js", "../src/index.ts", "../src/env.ts", "../src/CustomAudioElement.js"],
|
|
4
|
-
"sourcesContent": ["class EventTarget {\n addEventListener() {}\n removeEventListener() {}\n dispatchEvent(_event) {\n return true;\n }\n}\n\n// @github/template-parts requires DocumentFragment to be available on globalThis for SSR\nif (typeof DocumentFragment === 'undefined') {\n class DocumentFragment extends EventTarget {}\n // @ts-ignore\n globalThis.DocumentFragment = DocumentFragment;\n}\n\nclass HTMLElement extends EventTarget {}\nclass HTMLVideoElement extends EventTarget {}\n\nconst customElements = {\n get(_name) {\n return undefined;\n },\n define(_name, _constructor, _options) {},\n upgrade(_root) {},\n whenDefined(_name) {\n return Promise.resolve(HTMLElement);\n },\n};\n\nclass CustomEvent {\n #detail;\n get detail() {\n return this.#detail;\n }\n constructor(typeArg, eventInitDict = {}) {\n // super(typeArg, eventInitDict);\n this.#detail = eventInitDict?.detail;\n }\n initCustomEvent() {}\n}\n\nfunction createElement(_tagName, _options) {\n return new HTMLElement();\n}\n\nconst globalThisShim = {\n document: {\n createElement,\n },\n DocumentFragment,\n customElements,\n CustomEvent,\n EventTarget,\n HTMLElement,\n HTMLVideoElement,\n};\n\nconst isServer = typeof window === 'undefined' || typeof globalThis.customElements === 'undefined';\nconst GlobalThis = isServer ? globalThisShim : globalThis;\nconst Document = isServer ? globalThisShim.document : globalThis.document;\n\nexport { GlobalThis as globalThis, Document as document };\n", "import { globalThis } from 'shared-polyfills';\nimport {\n initialize,\n teardown,\n generatePlayerInitTime,\n MuxMediaProps,\n StreamTypes,\n PlaybackTypes,\n ValueOf,\n toMuxVideoURL,\n Metadata,\n MediaError,\n} from '@mux/playback-core';\nimport type { PlaybackCore, PlaybackEngine, Autoplay, ExtensionMimeTypeMap } from '@mux/playback-core';\nimport { getPlayerVersion } from './env';\n// this must be imported after playback-core for the polyfill to be included\nimport CustomAudioElement, { AudioEvents } from './CustomAudioElement';\n\n/** @TODO make the relationship between name+value smarter and more deriveable (CJP) */\ntype AttributeNames = {\n ENV_KEY: 'env-key';\n DEBUG: 'debug';\n METADATA_URL: 'metadata-url';\n METADATA_VIDEO_ID: 'metadata-video-id';\n METADATA_VIDEO_TITLE: 'metadata-video-title';\n METADATA_VIEWER_USER_ID: 'metadata-viewer-user-id';\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain';\n DISABLE_COOKIES: 'disable-cookies';\n PLAYBACK_ID: 'playback-id';\n PREFER_PLAYBACK: 'prefer-playback';\n TYPE: 'type';\n STREAM_TYPE: 'stream-type';\n START_TIME: 'start-time';\n};\n\nconst Attributes: AttributeNames = {\n ENV_KEY: 'env-key',\n DEBUG: 'debug',\n PLAYBACK_ID: 'playback-id',\n METADATA_URL: 'metadata-url',\n PREFER_PLAYBACK: 'prefer-playback',\n METADATA_VIDEO_ID: 'metadata-video-id',\n METADATA_VIDEO_TITLE: 'metadata-video-title',\n METADATA_VIEWER_USER_ID: 'metadata-viewer-user-id',\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain',\n DISABLE_COOKIES: 'disable-cookies',\n TYPE: 'type',\n STREAM_TYPE: 'stream-type',\n START_TIME: 'start-time',\n};\n\nconst AttributeNameValues = Object.values(Attributes);\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-audio';\n\nclass MuxAudioElement extends CustomAudioElement<HTMLAudioElement> implements Partial<MuxMediaProps> {\n static get observedAttributes() {\n return [...AttributeNameValues, ...(CustomAudioElement.observedAttributes ?? [])];\n }\n\n #core?: PlaybackCore;\n #loadRequested?: Promise<void> | null;\n #playerInitTime: number;\n #metadata: Readonly<Metadata> = {};\n\n constructor() {\n super();\n this.#playerInitTime = generatePlayerInitTime();\n }\n\n get playerInitTime() {\n return this.#playerInitTime;\n }\n\n get playerSoftwareName() {\n return playerSoftwareName;\n }\n\n get playerSoftwareVersion() {\n return playerSoftwareVersion;\n }\n\n // Keeping this named \"_hls\" since it's exposed for unadvertised \"advanced usage\" via getter that assumes specifically hls.js (CJP)\n get _hls(): PlaybackEngine | undefined {\n return this.#core?.engine;\n }\n\n get mux(): Readonly<HTMLAudioElement['mux']> | undefined {\n return this.nativeEl.mux;\n }\n\n get src() {\n // Use the attribute value as the source of truth.\n // No need to store it in two places.\n // This avoids needing a to read the attribute initially and update the src.\n return this.getAttribute('src') as string;\n }\n\n set src(val: string) {\n // If being set by attributeChangedCallback,\n // dont' cause an infinite loop\n if (val === this.src) return;\n\n if (val == null) {\n this.removeAttribute('src');\n } else {\n this.setAttribute('src', val);\n }\n }\n\n get preload() {\n const val = this.getAttribute('preload') as HTMLMediaElement['preload'];\n if (val === '') return 'auto';\n if (['none', 'metadata', 'auto'].includes(val)) return val;\n return super.preload;\n }\n\n set preload(val) {\n // don't cause an infinite loop\n // check the attribute because an empty string maps to the `auto` prop\n if (val == this.getAttribute('preload')) return;\n\n if (['', 'none', 'metadata', 'auto'].includes(val)) {\n this.setAttribute('preload', val);\n } else {\n this.removeAttribute('preload');\n }\n }\n\n get debug(): boolean {\n return this.getAttribute(Attributes.DEBUG) != null;\n }\n\n set debug(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.debug) return;\n\n if (val) {\n this.setAttribute(Attributes.DEBUG, '');\n } else {\n this.removeAttribute(Attributes.DEBUG);\n }\n }\n\n get disableCookies(): boolean {\n return this.hasAttribute(Attributes.DISABLE_COOKIES);\n }\n\n set disableCookies(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.disableCookies) return;\n\n if (val) {\n this.setAttribute(Attributes.DISABLE_COOKIES, '');\n } else {\n this.removeAttribute(Attributes.DISABLE_COOKIES);\n }\n }\n\n get startTime(): number | undefined {\n const val = this.getAttribute(Attributes.START_TIME);\n if (val == null) return undefined;\n const num = +val;\n return !Number.isNaN(num) ? num : undefined;\n }\n\n set startTime(val: number | undefined) {\n // dont' cause an infinite loop\n if (val === this.startTime) return;\n\n if (val == null) {\n this.removeAttribute(Attributes.START_TIME);\n } else {\n this.setAttribute(Attributes.START_TIME, `${val}`);\n }\n }\n\n get playbackId(): string | undefined {\n return this.getAttribute(Attributes.PLAYBACK_ID) ?? undefined;\n }\n\n set playbackId(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.playbackId) return;\n\n if (val) {\n this.setAttribute(Attributes.PLAYBACK_ID, val);\n } else {\n this.removeAttribute(Attributes.PLAYBACK_ID);\n }\n }\n\n get envKey(): string | undefined {\n return this.getAttribute(Attributes.ENV_KEY) ?? undefined;\n }\n\n set envKey(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.envKey) return;\n\n if (val) {\n this.setAttribute(Attributes.ENV_KEY, val);\n } else {\n this.removeAttribute(Attributes.ENV_KEY);\n }\n }\n\n get beaconCollectionDomain(): string | undefined {\n return this.getAttribute(Attributes.BEACON_COLLECTION_DOMAIN) ?? undefined;\n }\n\n set beaconCollectionDomain(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.beaconCollectionDomain) return;\n\n if (val) {\n this.setAttribute(Attributes.BEACON_COLLECTION_DOMAIN, val);\n } else {\n this.removeAttribute(Attributes.BEACON_COLLECTION_DOMAIN);\n }\n }\n\n get streamType(): ValueOf<StreamTypes> | undefined {\n // getAttribute doesn't know that this attribute is well defined. Should explore extending for MuxVideo (CJP)\n return (this.getAttribute(Attributes.STREAM_TYPE) as ValueOf<StreamTypes>) ?? undefined;\n }\n\n set streamType(val: ValueOf<StreamTypes> | undefined) {\n // dont' cause an infinite loop\n if (val === this.streamType) return;\n\n if (val) {\n this.setAttribute(Attributes.STREAM_TYPE, val);\n } else {\n this.removeAttribute(Attributes.STREAM_TYPE);\n }\n }\n\n get preferPlayback(): ValueOf<PlaybackTypes> | undefined {\n const val = this.getAttribute(Attributes.PREFER_PLAYBACK);\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) return val;\n return undefined;\n }\n\n set preferPlayback(val: ValueOf<PlaybackTypes> | undefined) {\n if (val === this.preferPlayback) return;\n\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) {\n this.setAttribute(Attributes.PREFER_PLAYBACK, val);\n } else {\n this.removeAttribute(Attributes.PREFER_PLAYBACK);\n }\n }\n\n get metadata() {\n return this.#metadata;\n }\n\n set metadata(val: Readonly<Metadata> | undefined) {\n this.#metadata = val ?? {};\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src.'\n );\n this.mux.emit('hb', this.#metadata);\n }\n }\n\n async #requestLoad() {\n if (this.#loadRequested) return;\n await (this.#loadRequested = Promise.resolve());\n this.#loadRequested = null;\n this.load();\n }\n\n load() {\n this.#core = initialize(this as Partial<MuxMediaProps>, this.nativeEl, this.#core);\n }\n\n unload() {\n teardown(this.nativeEl, this.#core);\n this.#core = undefined;\n }\n\n attributeChangedCallback(attrName: string, oldValue: string | null, newValue: string | null) {\n super.attributeChangedCallback(attrName, oldValue, newValue);\n\n switch (attrName) {\n case 'src': {\n const hadSrc = !!oldValue;\n const hasSrc = !!newValue;\n if (!hadSrc && hasSrc) {\n this.#requestLoad();\n } else if (hadSrc && !hasSrc) {\n this.unload();\n /** @TODO Test this thoroughly (async?) and confirm unload() necessary (CJP) */\n } else if (hadSrc && hasSrc) {\n this.unload();\n this.#requestLoad();\n }\n break;\n }\n case 'autoplay':\n if (newValue === oldValue) {\n break;\n }\n /** In case newValue is an empty string or null, use this.autoplay which translates to booleans (WL) */\n this.#core?.setAutoplay(this.autoplay);\n break;\n case 'preload':\n if (newValue === oldValue) {\n break;\n }\n this.#core?.setPreload(newValue as HTMLMediaElement['preload']);\n break;\n case Attributes.PLAYBACK_ID:\n /** @TODO Improv+Discuss - how should playback-id update wrt src attr changes (and vice versa) (CJP) */\n this.src = toMuxVideoURL(newValue ?? undefined) as string;\n break;\n case Attributes.DEBUG: {\n const debug = this.debug;\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src.'\n );\n }\n if (!!this._hls) {\n this._hls.config.debug = debug;\n }\n break;\n }\n case Attributes.METADATA_URL:\n if (newValue) {\n fetch(newValue)\n .then((resp) => resp.json())\n .then((json) => (this.metadata = json))\n .catch((_err) => console.error(`Unable to load or parse metadata JSON from metadata-url ${newValue}!`));\n }\n break;\n default:\n break;\n }\n }\n\n disconnectedCallback() {\n this.unload();\n }\n}\n\ntype MuxAudioElementType = typeof MuxAudioElement;\ndeclare global {\n var MuxAudioElement: MuxAudioElementType; // eslint-disable-line\n}\n\nif (!globalThis.customElements.get('mux-audio')) {\n globalThis.customElements.define('mux-audio', MuxAudioElement);\n /** @TODO consider externalizing this (breaks standard modularity) */\n globalThis.MuxAudioElement = MuxAudioElement;\n}\n\nexport { PlaybackEngine, PlaybackEngine as Hls, ExtensionMimeTypeMap as MimeTypes, MediaError, AudioEvents };\n\nexport default MuxAudioElement;\n", "export const isMaybeBrowser = () => typeof window != 'undefined';\n// @ts-ignore\nexport const isMaybeServer = () => typeof global != 'undefined';\n\nconst getEnvPlayerVersion = () => {\n try {\n // @ts-ignore\n return PLAYER_VERSION as string;\n } catch {}\n return 'UNKNOWN';\n};\n\nconst player_version: string = getEnvPlayerVersion();\n\nexport const getPlayerVersion = () => player_version;\n", "import { globalThis, document } from 'shared-polyfills';\n/**\n * Custom Audio Element\n * The goal is to create an element that works just like the audio element\n * but can be extended/sub-classed, because native elements cannot be\n * extended today across browsers.\n */\n\nexport const AudioEvents = [\n 'abort',\n 'canplay',\n 'canplaythrough',\n 'durationchange',\n 'emptied',\n 'ended',\n 'error',\n 'loadeddata',\n 'loadedmetadata',\n 'loadstart',\n 'pause',\n 'play',\n 'playing',\n 'progress',\n 'ratechange',\n 'seeked',\n 'seeking',\n 'stalled',\n 'suspend',\n 'timeupdate',\n 'volumechange',\n 'waiting',\n];\n\nconst template = document.createElement('template');\n// Could you get styles to apply by passing a global button from global to shadow?\n\ntemplate.innerHTML = `\n<style>\n :host {\n /* display:inline (like the native el) makes it so you can't fill\n the container with the native el */\n display: inline-block;\n box-sizing: border-box;\n\n width: auto;\n height: auto;\n }\n\n audio {\n max-width: 100%;\n max-height: 100%;\n min-width: 100%;\n min-height: 100%;\n }\n\n</style>\n\n<audio part=\"audio\" crossorigin></audio>\n<slot></slot>\n`;\n\nclass CustomAudioElement extends globalThis.HTMLElement {\n #isInit;\n\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n\n // If the custom element is defined before the <custom-video> HTML is parsed\n // no attributes will be available in the constructor (construction process).\n // Wait until initializing attributes in the attributeChangedCallback.\n // If this element is connected to the DOM, the attributes will be available.\n if (this.isConnected) {\n this.#init();\n }\n }\n\n #init() {\n if (this.#isInit) return;\n this.#isInit = true;\n\n this.shadowRoot.append(template.content.cloneNode(true));\n const nativeEl = (this.nativeEl = this.shadowRoot.querySelector('audio'));\n\n // The audio events are dispatched on the CustomAudioElement instance.\n // This makes it possible to add event listeners before the element is upgraded.\n AudioEvents.forEach((type) => {\n nativeEl.addEventListener(type, (evt) => {\n this.dispatchEvent(new CustomEvent(evt.type, { detail: evt.detail }));\n });\n });\n\n const slotEl = this.shadowRoot.querySelector('slot');\n slotEl.addEventListener('slotchange', () => {\n slotEl.assignedElements().forEach((el) => {\n if (!['track', 'source'].includes(el.localName)) return;\n nativeEl.append(el);\n });\n });\n\n // Initialize all the attribute properties\n // This is required before attributeChangedCallback is called after construction\n // so the initial state of all the attributes are forwarded to the native element.\n Array.from(this.attributes).forEach((attrNode) => {\n this.forwardAttribute(attrNode.name, null, attrNode.value);\n });\n\n // Neither Chrome or Firefox support setting the muted attribute\n // after using document.createElement.\n // One way to get around this would be to build the native tag as a string.\n // But just fixing it manually for now.\n // Apparently this may also be an issue with <input checked> for buttons\n if (nativeEl.defaultMuted) {\n nativeEl.muted = true;\n }\n }\n\n // observedAttributes is required to trigger attributeChangedCallback\n // for any attributes on the custom element.\n // Attributes need to be the lowercase word, e.g. crossorigin, not crossOrigin\n static get observedAttributes() {\n let attrs = [];\n\n // Instead of manually creating a list of all observed attributes,\n // observe any getter/setter prop name (lowercased)\n Object.getOwnPropertyNames(this.prototype).forEach((propName) => {\n let isFunc = false;\n\n // Non-func properties throw errors because it's not an instance\n try {\n if (typeof this.prototype[propName] === 'function') {\n isFunc = true;\n }\n } catch (e) {}\n\n // Exclude functions and constants\n if (!isFunc && propName !== propName.toUpperCase()) {\n attrs.push(propName.toLowerCase());\n }\n });\n\n // Include any attributes from the super class (recursive)\n const supAttrs = Object.getPrototypeOf(this).observedAttributes;\n\n if (supAttrs) {\n attrs = attrs.concat(supAttrs);\n }\n\n return attrs;\n }\n\n // We need to handle sub-class custom attributes differently from\n // attrs meant to be passed to the internal native el.\n attributeChangedCallback(attrName, oldValue, newValue) {\n // Initialize right after construction when the attributes become available.\n this.#init();\n\n this.forwardAttribute(attrName, oldValue, newValue);\n }\n\n forwardAttribute(attrName, oldValue, newValue) {\n // Find the matching prop for custom attributes\n const ownProps = Object.getOwnPropertyNames(Object.getPrototypeOf(this));\n const propName = arrayFindAnyCase(ownProps, attrName);\n\n // Check if this is the original custom native elemnt or a subclass\n const isBaseElement = Object.getPrototypeOf(this.constructor).toString().indexOf('function HTMLElement') === 0;\n\n // If this is a subclass custom attribute we want to set the\n // matching property on the subclass\n if (propName && !isBaseElement) {\n // Boolean props should never start as null\n if (typeof this[propName] == 'boolean') {\n // null is returned when attributes are removed i.e. boolean attrs\n if (newValue === null) {\n this[propName] = false;\n } else {\n // The new value might be an empty string, which is still true\n // for boolean attributes\n this[propName] = true;\n }\n } else {\n this[propName] = newValue;\n }\n } else {\n // When this is the original Custom Element, or the subclass doesn't\n // have a matching prop, pass it through.\n if (newValue === null) {\n this.nativeEl.removeAttribute(attrName);\n } else {\n // Ignore a few that don't need to be passed through just in case\n // it creates unexpected behavior.\n if (['id', 'class'].indexOf(attrName) === -1) {\n this.nativeEl.setAttribute(attrName, newValue);\n }\n }\n }\n }\n\n connectedCallback() {\n this.#init();\n }\n}\n\n// Map all native element properties to the custom element\n// so that they're applied to the native element.\n// Skipping HTMLElement because of things like \"attachShadow\"\n// causing issues. Most of those props still need to apply to\n// the custom element.\n// But includign EventTarget props because most events emit from\n// the native element.\nlet nativeElProps = [];\n\n// Can't check typeof directly on element prototypes without\n// throwing Illegal Invocation errors, so creating an element\n// to check on instead.\nconst nativeElTest = document.createElement('audio');\n\n// Deprecated props throw warnings if used, so exclude them\nconst deprecatedProps = ['webkitDisplayingFullscreen', 'webkitSupportsFullscreen'];\n\n// Walk the prototype chain up to HTMLElement.\n// This will grab all super class props in between.\n// i.e. AudioElement and MediaElement\nfor (\n let proto = Object.getPrototypeOf(nativeElTest);\n proto && proto !== globalThis.HTMLElement.prototype;\n proto = Object.getPrototypeOf(proto)\n) {\n Object.keys(proto).forEach((key) => {\n if (deprecatedProps.indexOf(key) === -1) {\n nativeElProps.push(key);\n }\n });\n}\n\n// Passthrough native el functions from the custom el to the native el\nnativeElProps.forEach((prop) => {\n const type = typeof nativeElTest[prop];\n\n if (type == 'function') {\n // Function\n CustomAudioElement.prototype[prop] = function () {\n return this.nativeEl[prop].apply(this.nativeEl, arguments);\n };\n } else {\n // Getter\n let config = {\n get() {\n return this.nativeEl[prop];\n },\n };\n\n if (prop !== prop.toUpperCase()) {\n // Setter (not a CONSTANT)\n config.set = function (val) {\n this.nativeEl[prop] = val;\n };\n }\n\n Object.defineProperty(CustomAudioElement.prototype, prop, config);\n }\n});\n\nfunction arrayFindAnyCase(arr, word) {\n let found = null;\n\n arr.forEach((item) => {\n if (item.toLowerCase() == word.toLowerCase()) {\n found = item;\n }\n });\n\n return found;\n}\n\nif (!globalThis.customElements.get('custom-audio')) {\n globalThis.customElements.define('custom-audio', CustomAudioElement);\n globalThis.CustomAudioElement = CustomAudioElement;\n}\n\nexport default CustomAudioElement;\n"],
|
|
5
|
-
"mappings": "qYAAA,IAAMA,EAAN,KAAkB,CAChB,kBAAmB,CAAC,CACpB,qBAAsB,CAAC,CACvB,cAAcC,EAAQ,CACpB,MAAO,EACT,CACF,EAGA,GAAI,OAAO,kBAAqB,YAAa,CAC3C,MAAMC,UAAyBF,C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AAG,IAAM,IACnCJ,EAAc,KAAKI,CAAG,CAE1B,CAAC,EAIHJ,EAAc,QAASK,GAAS,CAG9B,GAFa,OAAOJ,EAAaI,IAErB,WAEV3B,EAAmB,UAAU2B,GAAQ,UAAY,CAC/C,OAAO,KAAK,SAASA,GAAM,MAAM,KAAK,SAAU,SAAS,CAC3D,MACK,CAEL,IAAIC,EAAS,CACX,KAAM,CACJ,OAAO,KAAK,SAASD,EACvB,CACF,EAEIA,IAASA,EAAK,YAAY,IAE5BC,EAAO,IAAM,SAAUC,EAAK,CAC1B,KAAK,SAASF,GAAQE,CACxB,GAGF,OAAO,eAAe7B,EAAmB,UAAW2B,EAAMC,CAAM,CAClE,CACF,CAAC,EAED,SAAShB,EAAiBkB,EAAKC,EAAM,CACnC,IAAIC,EAAQ,KAEZ,OAAAF,EAAI,QAASG,GAAS,CAChBA,EAAK,YAAY,GAAKF,EAAK,YAAY,IACzCC,EAAQC,EAEZ,CAAC,EAEMD,CACT,CAEK/B,EAAW,eAAe,IAAI,cAAc,IAC/CA,EAAW,eAAe,OAAO,eAAgBD,CAAkB,EACnEC,EAAW,mBAAqBD,GAGlC,IAAOkC,EAAQlC,
|
|
6
|
-
"names": ["EventTarget", "_event", "DocumentFragment", "HTMLElement", "HTMLVideoElement", "customElements", "_name", "_constructor", "_options", "_root", "_detail", "CustomEvent", "typeArg", "eventInitDict", "__privateAdd", "__privateSet", "__privateGet", "createElement", "_tagName", "globalThisShim", "isServer", "GlobalThis", "Document", "initialize", "teardown", "generatePlayerInitTime", "PlaybackTypes", "toMuxVideoURL", "MediaError", "getEnvPlayerVersion", "player_version", "getPlayerVersion", "AudioEvents", "template", "Document", "_isInit", "_init", "init_fn", "CustomAudioElement", "GlobalThis", "__privateAdd", "__privateMethod", "attrs", "propName", "isFunc", "supAttrs", "attrName", "oldValue", "newValue", "ownProps", "arrayFindAnyCase", "isBaseElement", "__privateGet", "__privateSet", "nativeEl", "type", "evt", "slotEl", "el", "attrNode", "nativeElProps", "nativeElTest", "deprecatedProps", "proto", "key", "prop", "config", "val", "arr", "word", "found", "item", "CustomAudioElement_default", "Attributes", "AttributeNameValues", "playerSoftwareVersion", "getPlayerVersion", "playerSoftwareName", "_core", "_loadRequested", "_playerInitTime", "_metadata", "_requestLoad", "requestLoad_fn", "MuxAudioElement", "CustomAudioElement_default", "__privateAdd", "__privateSet", "generatePlayerInitTime", "_a", "__privateGet", "val", "num", "PlaybackTypes", "
|
|
4
|
+
"sourcesContent": ["class EventTarget {\n addEventListener() {}\n removeEventListener() {}\n dispatchEvent(_event) {\n return true;\n }\n}\n\n// @github/template-parts requires DocumentFragment to be available on globalThis for SSR\nif (typeof DocumentFragment === 'undefined') {\n class DocumentFragment extends EventTarget {}\n // @ts-ignore\n globalThis.DocumentFragment = DocumentFragment;\n}\n\nclass HTMLElement extends EventTarget {}\nclass HTMLVideoElement extends EventTarget {}\n\nconst customElements = {\n get(_name) {\n return undefined;\n },\n define(_name, _constructor, _options) {},\n upgrade(_root) {},\n whenDefined(_name) {\n return Promise.resolve(HTMLElement);\n },\n};\n\nclass CustomEvent {\n #detail;\n get detail() {\n return this.#detail;\n }\n constructor(typeArg, eventInitDict = {}) {\n // super(typeArg, eventInitDict);\n this.#detail = eventInitDict?.detail;\n }\n initCustomEvent() {}\n}\n\nfunction createElement(_tagName, _options) {\n return new HTMLElement();\n}\n\nconst globalThisShim = {\n document: {\n createElement,\n },\n DocumentFragment,\n customElements,\n CustomEvent,\n EventTarget,\n HTMLElement,\n HTMLVideoElement,\n};\n\nconst isServer = typeof window === 'undefined' || typeof globalThis.customElements === 'undefined';\nconst GlobalThis = isServer ? globalThisShim : globalThis;\nconst Document = isServer ? globalThisShim.document : globalThis.document;\n\nexport { GlobalThis as globalThis, Document as document };\n", "import { globalThis } from 'shared-polyfills';\nimport {\n initialize,\n teardown,\n generatePlayerInitTime,\n MuxMediaProps,\n StreamTypes,\n PlaybackTypes,\n ValueOf,\n toMuxVideoURL,\n Metadata,\n MediaError,\n} from '@mux/playback-core';\nimport type { PlaybackCore, PlaybackEngine, Autoplay, ExtensionMimeTypeMap } from '@mux/playback-core';\nimport { getPlayerVersion } from './env';\n// this must be imported after playback-core for the polyfill to be included\nimport CustomAudioElement, { AudioEvents } from './CustomAudioElement';\n\n/** @TODO make the relationship between name+value smarter and more deriveable (CJP) */\ntype AttributeNames = {\n ENV_KEY: 'env-key';\n DEBUG: 'debug';\n METADATA_URL: 'metadata-url';\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain';\n DISABLE_COOKIES: 'disable-cookies';\n PLAYBACK_ID: 'playback-id';\n PREFER_PLAYBACK: 'prefer-playback';\n TYPE: 'type';\n STREAM_TYPE: 'stream-type';\n START_TIME: 'start-time';\n};\n\nconst Attributes: AttributeNames = {\n ENV_KEY: 'env-key',\n DEBUG: 'debug',\n PLAYBACK_ID: 'playback-id',\n METADATA_URL: 'metadata-url',\n PREFER_PLAYBACK: 'prefer-playback',\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain',\n DISABLE_COOKIES: 'disable-cookies',\n TYPE: 'type',\n STREAM_TYPE: 'stream-type',\n START_TIME: 'start-time',\n};\n\nconst AttributeNameValues = Object.values(Attributes);\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-audio';\n\nclass MuxAudioElement extends CustomAudioElement<HTMLAudioElement> implements Partial<MuxMediaProps> {\n static get observedAttributes() {\n return [...AttributeNameValues, ...(CustomAudioElement.observedAttributes ?? [])];\n }\n\n #core?: PlaybackCore;\n #loadRequested?: Promise<void> | null;\n #playerInitTime: number;\n #metadata: Readonly<Metadata> = {};\n\n constructor() {\n super();\n this.#playerInitTime = generatePlayerInitTime();\n }\n\n get playerInitTime() {\n return this.#playerInitTime;\n }\n\n get playerSoftwareName() {\n return playerSoftwareName;\n }\n\n get playerSoftwareVersion() {\n return playerSoftwareVersion;\n }\n\n // Keeping this named \"_hls\" since it's exposed for unadvertised \"advanced usage\" via getter that assumes specifically hls.js (CJP)\n get _hls(): PlaybackEngine | undefined {\n return this.#core?.engine;\n }\n\n get mux(): Readonly<HTMLAudioElement['mux']> | undefined {\n return this.nativeEl.mux;\n }\n\n get src() {\n // Use the attribute value as the source of truth.\n // No need to store it in two places.\n // This avoids needing a to read the attribute initially and update the src.\n return this.getAttribute('src') as string;\n }\n\n set src(val: string) {\n // If being set by attributeChangedCallback,\n // dont' cause an infinite loop\n if (val === this.src) return;\n\n if (val == null) {\n this.removeAttribute('src');\n } else {\n this.setAttribute('src', val);\n }\n }\n\n get preload() {\n const val = this.getAttribute('preload') as HTMLMediaElement['preload'];\n if (val === '') return 'auto';\n if (['none', 'metadata', 'auto'].includes(val)) return val;\n return super.preload;\n }\n\n set preload(val) {\n // don't cause an infinite loop\n // check the attribute because an empty string maps to the `auto` prop\n if (val == this.getAttribute('preload')) return;\n\n if (['', 'none', 'metadata', 'auto'].includes(val)) {\n this.setAttribute('preload', val);\n } else {\n this.removeAttribute('preload');\n }\n }\n\n get debug(): boolean {\n return this.getAttribute(Attributes.DEBUG) != null;\n }\n\n set debug(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.debug) return;\n\n if (val) {\n this.setAttribute(Attributes.DEBUG, '');\n } else {\n this.removeAttribute(Attributes.DEBUG);\n }\n }\n\n get disableCookies(): boolean {\n return this.hasAttribute(Attributes.DISABLE_COOKIES);\n }\n\n set disableCookies(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.disableCookies) return;\n\n if (val) {\n this.setAttribute(Attributes.DISABLE_COOKIES, '');\n } else {\n this.removeAttribute(Attributes.DISABLE_COOKIES);\n }\n }\n\n get startTime(): number | undefined {\n const val = this.getAttribute(Attributes.START_TIME);\n if (val == null) return undefined;\n const num = +val;\n return !Number.isNaN(num) ? num : undefined;\n }\n\n set startTime(val: number | undefined) {\n // dont' cause an infinite loop\n if (val === this.startTime) return;\n\n if (val == null) {\n this.removeAttribute(Attributes.START_TIME);\n } else {\n this.setAttribute(Attributes.START_TIME, `${val}`);\n }\n }\n\n get playbackId(): string | undefined {\n return this.getAttribute(Attributes.PLAYBACK_ID) ?? undefined;\n }\n\n set playbackId(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.playbackId) return;\n\n if (val) {\n this.setAttribute(Attributes.PLAYBACK_ID, val);\n } else {\n this.removeAttribute(Attributes.PLAYBACK_ID);\n }\n }\n\n get envKey(): string | undefined {\n return this.getAttribute(Attributes.ENV_KEY) ?? undefined;\n }\n\n set envKey(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.envKey) return;\n\n if (val) {\n this.setAttribute(Attributes.ENV_KEY, val);\n } else {\n this.removeAttribute(Attributes.ENV_KEY);\n }\n }\n\n get beaconCollectionDomain(): string | undefined {\n return this.getAttribute(Attributes.BEACON_COLLECTION_DOMAIN) ?? undefined;\n }\n\n set beaconCollectionDomain(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.beaconCollectionDomain) return;\n\n if (val) {\n this.setAttribute(Attributes.BEACON_COLLECTION_DOMAIN, val);\n } else {\n this.removeAttribute(Attributes.BEACON_COLLECTION_DOMAIN);\n }\n }\n\n get streamType(): ValueOf<StreamTypes> | undefined {\n // getAttribute doesn't know that this attribute is well defined. Should explore extending for MuxVideo (CJP)\n return (this.getAttribute(Attributes.STREAM_TYPE) as ValueOf<StreamTypes>) ?? undefined;\n }\n\n set streamType(val: ValueOf<StreamTypes> | undefined) {\n // dont' cause an infinite loop\n if (val === this.streamType) return;\n\n if (val) {\n this.setAttribute(Attributes.STREAM_TYPE, val);\n } else {\n this.removeAttribute(Attributes.STREAM_TYPE);\n }\n }\n\n get preferPlayback(): ValueOf<PlaybackTypes> | undefined {\n const val = this.getAttribute(Attributes.PREFER_PLAYBACK);\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) return val;\n return undefined;\n }\n\n set preferPlayback(val: ValueOf<PlaybackTypes> | undefined) {\n if (val === this.preferPlayback) return;\n\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) {\n this.setAttribute(Attributes.PREFER_PLAYBACK, val);\n } else {\n this.removeAttribute(Attributes.PREFER_PLAYBACK);\n }\n }\n\n get metadata() {\n const inferredMetadataAttrs: { [key: string]: string } = this.getAttributeNames()\n .filter((attrName) => {\n return attrName.startsWith('metadata-') && !([Attributes.METADATA_URL] as string[]).includes(attrName);\n })\n .reduce((currAttrs, attrName) => {\n const value = this.getAttribute(attrName);\n if (value != null) {\n currAttrs[attrName.replace(/^metadata-/, '').replace(/-/g, '_') as string] = value;\n }\n return currAttrs;\n }, {} as { [key: string]: string });\n\n return {\n ...inferredMetadataAttrs,\n ...this.#metadata,\n };\n }\n\n set metadata(val: Readonly<Metadata> | undefined) {\n this.#metadata = val ?? {};\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src.'\n );\n this.mux.emit('hb', this.#metadata);\n }\n }\n\n async #requestLoad() {\n if (this.#loadRequested) return;\n await (this.#loadRequested = Promise.resolve());\n this.#loadRequested = null;\n this.load();\n }\n\n load() {\n this.#core = initialize(this as Partial<MuxMediaProps>, this.nativeEl, this.#core);\n }\n\n unload() {\n teardown(this.nativeEl, this.#core);\n this.#core = undefined;\n }\n\n attributeChangedCallback(attrName: string, oldValue: string | null, newValue: string | null) {\n super.attributeChangedCallback(attrName, oldValue, newValue);\n\n switch (attrName) {\n case 'src': {\n const hadSrc = !!oldValue;\n const hasSrc = !!newValue;\n if (!hadSrc && hasSrc) {\n this.#requestLoad();\n } else if (hadSrc && !hasSrc) {\n this.unload();\n /** @TODO Test this thoroughly (async?) and confirm unload() necessary (CJP) */\n } else if (hadSrc && hasSrc) {\n this.unload();\n this.#requestLoad();\n }\n break;\n }\n case 'autoplay':\n if (newValue === oldValue) {\n break;\n }\n /** In case newValue is an empty string or null, use this.autoplay which translates to booleans (WL) */\n this.#core?.setAutoplay(this.autoplay);\n break;\n case 'preload':\n if (newValue === oldValue) {\n break;\n }\n this.#core?.setPreload(newValue as HTMLMediaElement['preload']);\n break;\n case Attributes.PLAYBACK_ID:\n /** @TODO Improv+Discuss - how should playback-id update wrt src attr changes (and vice versa) (CJP) */\n this.src = toMuxVideoURL(newValue ?? undefined) as string;\n break;\n case Attributes.DEBUG: {\n const debug = this.debug;\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src.'\n );\n }\n if (!!this._hls) {\n this._hls.config.debug = debug;\n }\n break;\n }\n case Attributes.METADATA_URL:\n if (newValue) {\n fetch(newValue)\n .then((resp) => resp.json())\n .then((json) => (this.metadata = json))\n .catch((_err) => console.error(`Unable to load or parse metadata JSON from metadata-url ${newValue}!`));\n }\n break;\n default:\n break;\n }\n }\n\n disconnectedCallback() {\n this.unload();\n }\n}\n\ntype MuxAudioElementType = typeof MuxAudioElement;\ndeclare global {\n var MuxAudioElement: MuxAudioElementType; // eslint-disable-line\n}\n\nif (!globalThis.customElements.get('mux-audio')) {\n globalThis.customElements.define('mux-audio', MuxAudioElement);\n /** @TODO consider externalizing this (breaks standard modularity) */\n globalThis.MuxAudioElement = MuxAudioElement;\n}\n\nexport { PlaybackEngine, PlaybackEngine as Hls, ExtensionMimeTypeMap as MimeTypes, MediaError, AudioEvents };\n\nexport default MuxAudioElement;\n", "export const isMaybeBrowser = () => typeof window != 'undefined';\n// @ts-ignore\nexport const isMaybeServer = () => typeof global != 'undefined';\n\nconst getEnvPlayerVersion = () => {\n try {\n // @ts-ignore\n return PLAYER_VERSION as string;\n } catch {}\n return 'UNKNOWN';\n};\n\nconst player_version: string = getEnvPlayerVersion();\n\nexport const getPlayerVersion = () => player_version;\n", "import { globalThis, document } from 'shared-polyfills';\n/**\n * Custom Audio Element\n * The goal is to create an element that works just like the audio element\n * but can be extended/sub-classed, because native elements cannot be\n * extended today across browsers.\n */\n\nexport const AudioEvents = [\n 'abort',\n 'canplay',\n 'canplaythrough',\n 'durationchange',\n 'emptied',\n 'ended',\n 'error',\n 'loadeddata',\n 'loadedmetadata',\n 'loadstart',\n 'pause',\n 'play',\n 'playing',\n 'progress',\n 'ratechange',\n 'seeked',\n 'seeking',\n 'stalled',\n 'suspend',\n 'timeupdate',\n 'volumechange',\n 'waiting',\n];\n\nconst template = document.createElement('template');\n// Could you get styles to apply by passing a global button from global to shadow?\n\ntemplate.innerHTML = `\n<style>\n :host {\n /* display:inline (like the native el) makes it so you can't fill\n the container with the native el */\n display: inline-block;\n box-sizing: border-box;\n\n width: auto;\n height: auto;\n }\n\n audio {\n max-width: 100%;\n max-height: 100%;\n min-width: 100%;\n min-height: 100%;\n }\n\n</style>\n\n<audio part=\"audio\" crossorigin></audio>\n<slot></slot>\n`;\n\nclass CustomAudioElement extends globalThis.HTMLElement {\n #isInit;\n\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n\n // If the custom element is defined before the <custom-video> HTML is parsed\n // no attributes will be available in the constructor (construction process).\n // Wait until initializing attributes in the attributeChangedCallback.\n // If this element is connected to the DOM, the attributes will be available.\n if (this.isConnected) {\n this.#init();\n }\n }\n\n #init() {\n if (this.#isInit) return;\n this.#isInit = true;\n\n this.shadowRoot.append(template.content.cloneNode(true));\n const nativeEl = (this.nativeEl = this.shadowRoot.querySelector('audio'));\n\n // The audio events are dispatched on the CustomAudioElement instance.\n // This makes it possible to add event listeners before the element is upgraded.\n AudioEvents.forEach((type) => {\n nativeEl.addEventListener(type, (evt) => {\n this.dispatchEvent(new CustomEvent(evt.type, { detail: evt.detail }));\n });\n });\n\n const slotEl = this.shadowRoot.querySelector('slot');\n slotEl.addEventListener('slotchange', () => {\n slotEl.assignedElements().forEach((el) => {\n if (!['track', 'source'].includes(el.localName)) return;\n nativeEl.append(el);\n });\n });\n\n // Initialize all the attribute properties\n // This is required before attributeChangedCallback is called after construction\n // so the initial state of all the attributes are forwarded to the native element.\n Array.from(this.attributes).forEach((attrNode) => {\n this.forwardAttribute(attrNode.name, null, attrNode.value);\n });\n\n // Neither Chrome or Firefox support setting the muted attribute\n // after using document.createElement.\n // One way to get around this would be to build the native tag as a string.\n // But just fixing it manually for now.\n // Apparently this may also be an issue with <input checked> for buttons\n if (nativeEl.defaultMuted) {\n nativeEl.muted = true;\n }\n }\n\n // observedAttributes is required to trigger attributeChangedCallback\n // for any attributes on the custom element.\n // Attributes need to be the lowercase word, e.g. crossorigin, not crossOrigin\n static get observedAttributes() {\n let attrs = [];\n\n // Instead of manually creating a list of all observed attributes,\n // observe any getter/setter prop name (lowercased)\n Object.getOwnPropertyNames(this.prototype).forEach((propName) => {\n let isFunc = false;\n\n // Non-func properties throw errors because it's not an instance\n try {\n if (typeof this.prototype[propName] === 'function') {\n isFunc = true;\n }\n } catch (e) {}\n\n // Exclude functions and constants\n if (!isFunc && propName !== propName.toUpperCase()) {\n attrs.push(propName.toLowerCase());\n }\n });\n\n // Include any attributes from the super class (recursive)\n const supAttrs = Object.getPrototypeOf(this).observedAttributes;\n\n if (supAttrs) {\n attrs = attrs.concat(supAttrs);\n }\n\n return attrs;\n }\n\n // We need to handle sub-class custom attributes differently from\n // attrs meant to be passed to the internal native el.\n attributeChangedCallback(attrName, oldValue, newValue) {\n // Initialize right after construction when the attributes become available.\n this.#init();\n\n this.forwardAttribute(attrName, oldValue, newValue);\n }\n\n forwardAttribute(attrName, oldValue, newValue) {\n // Find the matching prop for custom attributes\n const ownProps = Object.getOwnPropertyNames(Object.getPrototypeOf(this));\n const propName = arrayFindAnyCase(ownProps, attrName);\n\n // Check if this is the original custom native elemnt or a subclass\n const isBaseElement = Object.getPrototypeOf(this.constructor).toString().indexOf('function HTMLElement') === 0;\n\n // If this is a subclass custom attribute we want to set the\n // matching property on the subclass\n if (propName && !isBaseElement) {\n // Boolean props should never start as null\n if (typeof this[propName] == 'boolean') {\n // null is returned when attributes are removed i.e. boolean attrs\n if (newValue === null) {\n this[propName] = false;\n } else {\n // The new value might be an empty string, which is still true\n // for boolean attributes\n this[propName] = true;\n }\n } else {\n this[propName] = newValue;\n }\n } else {\n // When this is the original Custom Element, or the subclass doesn't\n // have a matching prop, pass it through.\n if (newValue === null) {\n this.nativeEl.removeAttribute(attrName);\n } else {\n // Ignore a few that don't need to be passed through just in case\n // it creates unexpected behavior.\n if (['id', 'class'].indexOf(attrName) === -1) {\n this.nativeEl.setAttribute(attrName, newValue);\n }\n }\n }\n }\n\n connectedCallback() {\n this.#init();\n }\n}\n\n// Map all native element properties to the custom element\n// so that they're applied to the native element.\n// Skipping HTMLElement because of things like \"attachShadow\"\n// causing issues. Most of those props still need to apply to\n// the custom element.\n// But includign EventTarget props because most events emit from\n// the native element.\nlet nativeElProps = [];\n\n// Can't check typeof directly on element prototypes without\n// throwing Illegal Invocation errors, so creating an element\n// to check on instead.\nconst nativeElTest = document.createElement('audio');\n\n// Deprecated props throw warnings if used, so exclude them\nconst deprecatedProps = ['webkitDisplayingFullscreen', 'webkitSupportsFullscreen'];\n\n// Walk the prototype chain up to HTMLElement.\n// This will grab all super class props in between.\n// i.e. AudioElement and MediaElement\nfor (\n let proto = Object.getPrototypeOf(nativeElTest);\n proto && proto !== globalThis.HTMLElement.prototype;\n proto = Object.getPrototypeOf(proto)\n) {\n Object.keys(proto).forEach((key) => {\n if (deprecatedProps.indexOf(key) === -1) {\n nativeElProps.push(key);\n }\n });\n}\n\n// Passthrough native el functions from the custom el to the native el\nnativeElProps.forEach((prop) => {\n const type = typeof nativeElTest[prop];\n\n if (type == 'function') {\n // Function\n CustomAudioElement.prototype[prop] = function () {\n return this.nativeEl[prop].apply(this.nativeEl, arguments);\n };\n } else {\n // Getter\n let config = {\n get() {\n return this.nativeEl[prop];\n },\n };\n\n if (prop !== prop.toUpperCase()) {\n // Setter (not a CONSTANT)\n config.set = function (val) {\n this.nativeEl[prop] = val;\n };\n }\n\n Object.defineProperty(CustomAudioElement.prototype, prop, config);\n }\n});\n\nfunction arrayFindAnyCase(arr, word) {\n let found = null;\n\n arr.forEach((item) => {\n if (item.toLowerCase() == word.toLowerCase()) {\n found = item;\n }\n });\n\n return found;\n}\n\nif (!globalThis.customElements.get('custom-audio')) {\n globalThis.customElements.define('custom-audio', CustomAudioElement);\n globalThis.CustomAudioElement = CustomAudioElement;\n}\n\nexport default CustomAudioElement;\n"],
|
|
5
|
+
"mappings": "qYAAA,IAAMA,EAAN,KAAkB,CAChB,kBAAmB,CAAC,CACpB,qBAAsB,CAAC,CACvB,cAAcC,EAAQ,CACpB,MAAO,EACT,CACF,EAGA,GAAI,OAAO,kBAAqB,YAAa,CAC3C,MAAMC,UAAyBF,CAAY,CAAC,CAE5C,WAAW,iBAAmBE,CAChC,CAEA,IAAMC,EAAN,cAA0BH,CAAY,CAAC,EACjCI,EAAN,cAA+BJ,CAAY,CAAC,EAEtCK,EAAiB,CACrB,IAAIC,EAAO,CAEX,EACA,OAAOA,EAAOC,EAAcC,EAAU,CAAC,EACvC,QAAQC,EAAO,CAAC,EAChB,YAAYH,EAAO,CACjB,OAAO,QAAQ,QAAQH,CAAW,CACpC,CACF,EA3BAO,EA6BMC,EAAN,KAAkB,CAKhB,YAAYC,EAASC,EAAgB,CAAC,EAAG,CAJzCC,EAAA,KAAAJ,EAAA,QAMEK,EAAA,KAAKL,EAAUG,GAAA,YAAAA,EAAe,OAChC,CANA,IAAI,QAAS,CACX,OAAOG,EAAA,KAAKN,EACd,CAKA,iBAAkB,CAAC,CACrB,EATEA,EAAA,YAWF,SAASO,EAAcC,EAAUV,EAAU,CACzC,OAAO,IAAIL,CACb,CAEA,IAAMgB,EAAiB,CACrB,SAAU,CACR,cAAAF,CACF,EACA,iBACA,eAAAZ,EACA,YAAAM,EACA,YAAAX,EACA,YAAAG,EACA,iBAAAC,CACF,EAEMgB,EAAW,OAAO,QAAW,aAAe,OAAO,WAAW,gBAAmB,YACjFC,EAAaD,EAAWD,EAAiB,WACzCG,EAAWF,EAAWD,EAAe,SAAW,WAAW,SC1DjE,OACE,cAAAI,EACA,YAAAC,EACA,0BAAAC,EAGA,iBAAAC,EAEA,iBAA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AAW,CAAC,EAE1G,cAEA,MAEN,CAEA,sBAAuB,CACrB,KAAK,OAAO,CACd,CACF,EAhTEtB,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YA6NMC,EAAA,YAAAC,EAAY,gBAAG,CACfO,EAAA,KAAKX,KACT,MAAOQ,EAAA,KAAKR,EAAiB,QAAQ,QAAQ,GAC7CQ,EAAA,KAAKR,EAAiB,MACtB,KAAK,KAAK,EACZ,EAkFG+B,EAAW,eAAe,IAAI,WAAW,IAC5CA,EAAW,eAAe,OAAO,YAAa1B,CAAe,EAE7D0B,EAAW,gBAAkB1B,GAK/B,IAAO2B,GAAQC",
|
|
6
|
+
"names": ["EventTarget", "_event", "DocumentFragment", "HTMLElement", "HTMLVideoElement", "customElements", "_name", "_constructor", "_options", "_root", "_detail", "CustomEvent", "typeArg", "eventInitDict", "__privateAdd", "__privateSet", "__privateGet", "createElement", "_tagName", "globalThisShim", "isServer", "GlobalThis", "Document", "initialize", "teardown", "generatePlayerInitTime", "PlaybackTypes", "toMuxVideoURL", "MediaError", "getEnvPlayerVersion", "player_version", "getPlayerVersion", "AudioEvents", "template", "Document", "_isInit", "_init", "init_fn", "CustomAudioElement", "GlobalThis", "__privateAdd", "__privateMethod", "attrs", "propName", "isFunc", "supAttrs", "attrName", "oldValue", "newValue", "ownProps", "arrayFindAnyCase", "isBaseElement", "__privateGet", "__privateSet", "nativeEl", "type", "evt", "slotEl", "el", "attrNode", "nativeElProps", "nativeElTest", "deprecatedProps", "proto", "key", "prop", "config", "val", "arr", "word", "found", "item", "CustomAudioElement_default", "Attributes", "AttributeNameValues", "playerSoftwareVersion", "getPlayerVersion", "playerSoftwareName", "_core", "_loadRequested", "_playerInitTime", "_metadata", "_requestLoad", "requestLoad_fn", "MuxAudioElement", "CustomAudioElement_default", "__privateAdd", "__privateSet", "generatePlayerInitTime", "_a", "__privateGet", "val", "num", "PlaybackTypes", "attrName", "currAttrs", "value", "initialize", "teardown", "oldValue", "newValue", "_b", "hadSrc", "hasSrc", "__privateMethod", "toMuxVideoURL", "debug", "resp", "json", "_err", "GlobalThis", "src_default", "MuxAudioElement"]
|
|
7
7
|
}
|