@mattebox/player-cast 0.1.0 → 0.2.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/cast.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cast.js","sourceRoot":"","sources":["../src/cast.ts"],"names":[],"mappings":"AAqBA,uFAAuF;AACvF,SAAS,IAAI,CAAC,MAA4B;IACxC,MAAM,GAAG,GAAI,MAAoD,EAAE,IAAI,CAAC;IACxE,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC;AAChD,CAAC;AA4GD,uFAAuF;AACvF,MAAM,gBAAgB,GAAG,UAAU,CAAC;AACpC,MAAM,OAAO,GAAG,4EAA4E,CAAC;AA0C7F,2EAA2E;AAC3E,mDAAmD;AAEnD,IAAI,SAAS,GAAqC,IAAI,CAAC;AACvD,IAAI,UAAU,GAAkB,IAAI,CAAC;AACrC,IAAI,YAAY,GAA2B,IAAI,CAAC;AAChD,IAAI,gBAAgB,GAA+B,IAAI,CAAC;AACxD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAc,CAAC;AACvC,6FAA6F;AAC7F,IAAI,KAAK,GAAkB,IAAI,CAAC;AAChC,wFAAwF;AACxF,MAAM,OAAO,GAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;AACvF,IAAI,IAAI,GAAW,OAAO,CAAC;AAE3B,SAAS,OAAO;IACd,OAAO,UAAqB,CAAC;AAC/B,CAAC;AAED,SAAS,MAAM;IACb,KAAK,MAAM,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC;QAAE,EAAE,EAAE,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,SAAS,IAAI,CAAC,GAAkB;IAC9B,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;I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romecast from the page, over Google's Cast sender framework. The SDK is\n * a script the page loads, never a dependency (rule 2): the helper puts it\n * on the page the first time a cast button connects, unless it is already\n * there or the button says `sdk=\"none\"`. Its context is one per page by\n * Google's design, so the receiver id the first button gives is the one\n * the page keeps.\n *\n * One `Cast` per player. It owns the handoff and nothing on the video is\n * wrapped (rule 3): on start it pauses the video, freezes the engine, and\n * sends the session's source to the receiver at the video's time; on end\n * it thaws the engine, seeks the video to the receiver's last time, and\n * plays if the receiver was playing. The cast screen drives the receiver\n * through the SDK's remote player meanwhile.\n *\n * The receiver plays the URL by itself, so DRM and signed URLs are the\n * page's to arrange: the button dispatches `castload` with the request\n * before it goes out, and the page sets `customData` or cancels.\n */\nimport type { PlayerHost } from './host.js';\n\n/** Whether the session is live: the engine's `live` namespace, once it has an edge. */\nfunction live(engine: PlayerHost['engine']): boolean {\n const api = (engine as { live?: { edge: number | null } } | null)?.live;\n return api !== undefined && api.edge !== null;\n}\n\n// The slice of the sender SDK the helper reads. No `@types/chromecast`:\n// the SDK is not a dependency, and these names are what the page's script\n// puts on `window.cast.framework` and `window.chrome.cast`.\n\ninterface SdkEvent {\n readonly castState?: string;\n readonly sessionState?: string;\n}\n\ninterface SdkDevice {\n readonly friendlyName: string;\n}\n\ninterface SdkMediaSession {\n readonly media?: { readonly contentId?: string } | null;\n}\n\ninterface SdkSession {\n getCastDevice(): SdkDevice;\n getMediaSession(): SdkMediaSession | null;\n loadMedia(request: LoadRequest): Promise<unknown>;\n}\n\ninterface SdkContext {\n setOptions(options: { receiverApplicationId: string; autoJoinPolicy: string }): void;\n addEventListener(type: string, fn: (event: SdkEvent) => void): void;\n getCastState(): string;\n getCurrentSession(): SdkSession | null;\n requestSession(): Promise<unknown>;\n endCurrentSession(stopCasting: boolean): void;\n}\n\ninterface SdkRemotePlayer {\n isConnected: boolean;\n isMediaLoaded: boolean;\n isPaused: boolean;\n currentTime: number;\n duration: number;\n playerState: string | null;\n}\n\ninterface SdkRemoteController {\n addEventListener(type: string, fn: () => void): void;\n playOrPause(): void;\n seek(): void;\n stop(): void;\n}\n\n/** What the receiver plays. The page sees it as `castload`'s `detail`. */\nexport interface MediaInfo {\n contentId: string;\n contentType: string;\n streamType: string;\n tracks: Track[] | null;\n hlsSegmentFormat?: string;\n hlsVideoSegmentFormat?: string;\n}\n\nexport interface Track {\n trackContentId: string;\n trackContentType: string;\n subtype: string;\n name: string;\n language: string;\n}\n\nexport interface LoadRequest {\n media: MediaInfo;\n currentTime: number;\n autoplay: boolean;\n customData: unknown;\n}\n\ninterface Framework {\n CastContext: { getInstance(): SdkContext };\n RemotePlayer: new () => SdkRemotePlayer;\n RemotePlayerController: new (player: SdkRemotePlayer) => SdkRemoteController;\n CastContextEventType: { CAST_STATE_CHANGED: string; SESSION_STATE_CHANGED: string };\n CastState: { NO_DEVICES_AVAILABLE: string; CONNECTING: string; CONNECTED: string };\n SessionState: {\n SESSION_STARTED: string;\n SESSION_RESUMED: string;\n SESSION_ENDED: string;\n SESSION_START_FAILED: string;\n };\n RemotePlayerEventType: { ANY_CHANGE: string };\n}\n\ninterface ChromeCast {\n AutoJoinPolicy: { ORIGIN_SCOPED: string };\n media: {\n MediaInfo: new (contentId: string, contentType: string) => MediaInfo;\n LoadRequest: new (media: MediaInfo) => LoadRequest;\n Track: new (trackId: number, type: string) => Track;\n TrackType: { TEXT: string };\n TextTrackType: { SUBTITLES: string; CAPTIONS: string };\n StreamType: { BUFFERED: string; LIVE: string };\n };\n}\n\ninterface Globals {\n cast?: { framework?: Framework };\n chrome?: { cast?: ChromeCast };\n __onGCastApiAvailable?: (available: boolean) => void;\n}\n\n/** The Default Media Receiver: Google's player, which plays HLS and DASH by itself. */\nconst DEFAULT_RECEIVER = 'CC1AD845';\nconst SDK_URL = 'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1';\n\nexport type CastState = 'unavailable' | 'idle' | 'connecting' | 'casting';\n\n/** What the cast screen shows of the receiver. */\nexport interface Remote {\n readonly loaded: boolean;\n readonly paused: boolean;\n readonly time: number;\n /** Infinity for a live stream, the way the video reports it. */\n readonly duration: number;\n}\n\nexport interface Cast {\n /**\n * Puts the SDK on the page unless `sdk` is `none` or it is already there,\n * and sets the context up with `receiver`, or the default receiver. The\n * first call on the page decides both; a later different receiver is an\n * error on the console, not a second context.\n */\n connect(receiver: string | null, sdk: string | null): void;\n /** The button left the player: a rejoined session no longer looks here. */\n disconnect(): void;\n state(): CastState;\n /** The receiver's name while casting, or null. */\n device(): string | null;\n remote(): Remote;\n /** Opens the device picker. `castload` goes out on `target` once a session starts. */\n start(target: HTMLElement): void;\n /** Ends the session and stops the receiver. */\n stop(): void;\n playPause(): void;\n seek(time: number): void;\n /** Runs `fn` on every change: devices, session, and the receiver's playback. Returns the unsubscribe. */\n watch(fn: () => void): () => void;\n}\n\n/** What the video is doing at the start of a cast, to give back at the end. */\ninterface Handoff {\n readonly live: boolean;\n}\n\n// The page-wide part: one SDK, one context, one remote player. Held in the\n// module because the SDK holds them in the window.\n\nlet framework: Promise<Framework | null> | null = null;\nlet configured: string | null = null;\nlet remotePlayer: SdkRemotePlayer | null = null;\nlet remoteController: SdkRemoteController | null = null;\nconst watchers = new Set<() => void>();\n/** The player whose session this is, so two players on a page do not both take a session. */\nlet owner: CastOf | null = null;\n/** The receiver's last known playback, read while it reports and kept once it stops. */\nconst NOTHING: Remote = { loaded: false, paused: true, time: 0, duration: Number.NaN };\nlet last: Remote = NOTHING;\n\nfunction globals(): Globals {\n return globalThis as Globals;\n}\n\nfunction notify(): void {\n for (const fn of [...watchers]) fn();\n}\n\n/**\n * The framework, once the page has it. Resolves null where the SDK never\n * arrives: a browser without Cast, a page whose CSP refused the script, or\n * `sdk=\"none\"` with no script of the page's own.\n */\nfunction load(sdk: string | null): Promise<Framework | null> {\n if (framework !== null) return framework;\n const held = globals();\n if (held.cast?.framework !== undefined) {\n framework = Promise.resolve(held.cast.framework);\n return framework;\n }\n // The SDK is Chromium's. Elsewhere the script only reports that it is\n // unavailable, so it is not fetched.\n if (!('chrome' in held)) {\n framework = Promise.resolve(null);\n return framework;\n }\n framework = new Promise((resolve) => {\n const previous = held.__onGCastApiAvailable;\n // The SDK calls this once it is in, on its own script or the page's.\n held.__onGCastApiAvailable = (available: boolean): void => {\n previous?.(available);\n resolve(available ? (globals().cast?.framework ?? null) : null);\n };\n if (sdk === 'none') return;\n const script = document.createElement('script');\n script.src = SDK_URL;\n script.async = true;\n script.addEventListener('error', () => resolve(null));\n document.head.append(script);\n });\n return framework;\n}\n\n/** The context, set up once per page. */\nfunction context(fw: Framework, receiver: string | null): SdkContext {\n const ctx = fw.CastContext.getInstance();\n const wanted = receiver ?? DEFAULT_RECEIVER;\n if (configured === null) {\n const policy = globals().chrome?.cast?.AutoJoinPolicy.ORIGIN_SCOPED ?? 'origin_scoped';\n ctx.setOptions({ receiverApplicationId: wanted, autoJoinPolicy: policy });\n configured = wanted;\n ctx.addEventListener(fw.CastContextEventType.CAST_STATE_CHANGED, notify);\n ctx.addEventListener(fw.CastContextEventType.SESSION_STATE_CHANGED, (event) => {\n onSession(fw, ctx, event.sessionState ?? '');\n });\n remotePlayer = new fw.RemotePlayer();\n remoteController = new fw.RemotePlayerController(remotePlayer);\n remoteController.addEventListener(fw.RemotePlayerEventType.ANY_CHANGE, () => {\n const remote = remotePlayer;\n if (remote?.isConnected === true && remote.isMediaLoaded) {\n last = {\n loaded: true,\n paused: remote.isPaused,\n time: remote.currentTime,\n duration: remote.duration > 0 ? remote.duration : Number.POSITIVE_INFINITY,\n };\n }\n notify();\n });\n } else if (receiver !== null && receiver !== configured) {\n console.error(`mattebox-player: the Cast context already uses receiver ${configured}`);\n }\n return ctx;\n}\n\nfunction onSession(fw: Framework, ctx: SdkContext, state: string): void {\n const states = fw.SessionState;\n if (state === states.SESSION_STARTED && owner !== null && owner.pending) {\n // A new session has loaded nothing yet, whatever the last one played.\n last = NOTHING;\n owner.begin(ctx);\n } else if (state === states.SESSION_RESUMED) {\n // Chrome rejoins a session of this origin on load. It is this player's\n // when the receiver plays what the player has.\n const playing = ctx.getCurrentSession()?.getMediaSession()?.media?.contentId;\n const found = [...connected].find((cast) => cast.plays(playing));\n if (found !== undefined && owner === null) {\n owner = found;\n found.adopt();\n }\n } else if (state === states.SESSION_ENDED || state === states.SESSION_START_FAILED) {\n const ended = owner;\n owner = null;\n ended?.end(state === states.SESSION_ENDED);\n }\n notify();\n}\n\n/** One per player, found again by its button and its screen. Weak, so a player that leaves is not held. */\nconst players = new WeakMap<PlayerHost, CastOf>();\n/** The players with a cast button attached, for a session Chrome rejoins on load. */\nconst connected = new Set<CastOf>();\n\nclass CastOf implements Cast {\n declare private readonly player: PlayerHost;\n declare private target: HTMLElement | null;\n declare private ctx: SdkContext | null;\n declare private fw: Framework | null;\n /** This player asked for a session and waits for it to start. */\n declare pending: boolean;\n declare private casting: boolean;\n declare private handoff: Handoff | null;\n\n constructor(player: PlayerHost) {\n this.player = player;\n this.target = null;\n this.ctx = null;\n this.fw = null;\n this.pending = false;\n this.casting = false;\n this.handoff = null;\n }\n\n connect(receiver: string | null, sdk: string | null): void {\n connected.add(this);\n void load(sdk).then((fw) => {\n if (fw === null) return;\n this.fw = fw;\n this.ctx = context(fw, receiver);\n notify();\n });\n }\n\n disconnect(): void {\n connected.delete(this);\n }\n\n state(): CastState {\n const ctx = this.ctx;\n const fw = this.fw;\n if (ctx === null || fw === null) return 'unavailable';\n if (this.casting) return 'casting';\n const cast = ctx.getCastState();\n if (cast === fw.CastState.NO_DEVICES_AVAILABLE) return 'unavailable';\n if (cast === fw.CastState.CONNECTING || this.pending) return 'connecting';\n return 'idle';\n }\n\n device(): string | null {\n if (!this.casting) return null;\n return this.ctx?.getCurrentSession()?.getCastDevice().friendlyName ?? null;\n }\n\n remote(): Remote {\n return last;\n }\n\n start(target: HTMLElement): void {\n const ctx = this.ctx;\n if (ctx === null || this.casting) return;\n // Another player on the page holds the session. The SDK has one, so\n // this click ends it, the way Chrome's own dialog offers to.\n if (owner !== null && owner !== this) {\n ctx.endCurrentSession(true);\n return;\n }\n this.target = target;\n this.pending = true;\n owner = this;\n notify();\n // Rejected when the viewer closes the picker; SESSION_START_FAILED\n // does not fire for that, so the wait ends here.\n ctx.requestSession().catch(() => {\n if (owner === this) owner = null;\n this.pending = false;\n notify();\n });\n }\n\n stop(): void {\n if (this.casting) this.ctx?.endCurrentSession(true);\n }\n\n playPause(): void {\n if (this.casting) remoteController?.playOrPause();\n }\n\n seek(time: number): void {\n if (!this.casting || remotePlayer === null) return;\n remotePlayer.currentTime = time;\n remoteController?.seek();\n }\n\n watch(fn: () => void): () => void {\n watchers.add(fn);\n return () => {\n watchers.delete(fn);\n };\n }\n\n /** Whether this player's session plays `url`. */\n plays(url: string | undefined): boolean {\n return url !== undefined && this.player.player?.session?.source.url === url;\n }\n\n /** A session started for this player: freeze the picture and send the source. */\n begin(ctx: SdkContext): void {\n this.pending = false;\n const session = this.player.player?.session ?? null;\n const video = this.player.video;\n const time = video.currentTime;\n const autoplay = !video.paused;\n this.freeze();\n if (session === null) return;\n const request = this.request(session.source, time, autoplay);\n if (request === null) return;\n const event = new CustomEvent<LoadRequest>('castload', {\n detail: request,\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n if (this.target?.dispatchEvent(event) === false) return;\n void ctx\n .getCurrentSession()\n ?.loadMedia(request)\n .catch(() => {\n // The receiver refused the media. The session stays, so the viewer\n // can stop it; the screen shows no time.\n });\n }\n\n /** A session Chrome rejoined, already playing this player's source. */\n adopt(): void {\n this.freeze();\n }\n\n private freeze(): void {\n const engine = this.player.engine;\n this.handoff = { live: live(engine) };\n this.player.video.pause();\n // The engine keeps its buffers and makes no request while the receiver\n // plays (engine guide 01, suspend and resume).\n engine?.suspend();\n this.casting = true;\n this.player.toggleAttribute('casting', true);\n notify();\n }\n\n /** The session ended: give the video back where the receiver left it. */\n end(cleanly: boolean): void {\n this.pending = false;\n if (!this.casting) return;\n this.casting = false;\n const handoff = this.handoff;\n this.handoff = null;\n const video = this.player.video;\n const engine = this.player.engine;\n engine?.resume();\n this.player.removeAttribute('casting');\n if (!cleanly || !last.loaded) return;\n // Live rejoins at the edge on its own; the receiver's time is on the\n // receiver's own timeline and means nothing here.\n if (handoff?.live !== true && Number.isFinite(last.time)) video.currentTime = last.time;\n if (!last.paused) video.play().catch(() => undefined);\n }\n\n /** The load request: the source, the time, the stream type, and the video's own text tracks. */\n private request(\n source: { readonly url: string; readonly type?: string },\n time: number,\n autoplay: boolean,\n ): LoadRequest | null {\n const media = globals().chrome?.cast?.media;\n if (media === undefined) return null;\n const engine = this.player.engine;\n const type = source.type ?? '';\n const info = new media.MediaInfo(source.url, type);\n info.streamType = live(engine) ? media.StreamType.LIVE : media.StreamType.BUFFERED;\n if (/mpegurl/i.test(type)) {\n // The receiver assumes MPEG-TS segments for HLS unless told. The\n // engine's presentation says which the stream has; a native session\n // has none, and CMAF is the assumption there.\n const ts = tsSegments(engine);\n info.hlsSegmentFormat = ts ? 'ts' : 'fmp4';\n info.hlsVideoSegmentFormat = ts ? 'mpeg2_ts' : 'fmp4';\n }\n const tracks: Track[] = [];\n for (const node of this.player.video.querySelectorAll('track[src]')) {\n const track = node as HTMLTrackElement;\n if (track.kind !== 'subtitles' && track.kind !== 'captions') continue;\n const out = new media.Track(tracks.length + 1, media.TrackType.TEXT);\n out.trackContentId = track.src;\n out.trackContentType = 'text/vtt';\n out.subtype =\n track.kind === 'captions' ? media.TextTrackType.CAPTIONS : media.TextTrackType.SUBTITLES;\n out.name = track.label;\n out.language = track.srclang;\n tracks.push(out);\n }\n info.tracks = tracks.length > 0 ? tracks : null;\n const request = new media.LoadRequest(info);\n request.currentTime = time;\n request.autoplay = autoplay;\n return request;\n }\n}\n\n/** Whether the engine's presentation carries MPEG-TS renditions. */\nfunction tsSegments(engine: PlayerHost['engine']): boolean {\n const presentation = engine?.stats.snapshot().presentation;\n if (presentation === null || presentation === undefined) return false;\n for (const period of presentation.periods) {\n for (const track of period.tracks) {\n for (const rendition of track.renditions) {\n if (/mp2t/i.test(rendition.mimeType)) return true;\n }\n }\n }\n return false;\n}\n\n/** The player's Cast, one per player, shared by its cast button and cast screen. */\nexport function cast(player: PlayerHost): Cast {\n let held = players.get(player);\n if (held === undefined) {\n held = new CastOf(player);\n players.set(player, held);\n }\n return held;\n}\n"],"mappings":";;AAsBA,SAAS,KAAK,QAAuC;CACnD,MAAM,MAAO,QAAsD;CACnE,OAAO,QAAQ,KAAA,KAAa,IAAI,SAAS;AAC3C;;AA6GA,MAAM,mBAAmB;AACzB,MAAM,UAAU;AA6ChB,IAAI,YAA8C;AAClD,IAAI,aAA4B;AAChC,IAAI,eAAuC;AAC3C,IAAI,mBAA+C;AACnD,MAAM,2BAAW,IAAI,IAAgB;;AAErC,IAAI,QAAuB;;AAE3B,MAAM,UAAkB;CAAE,QAAQ;CAAO,QAAQ;CAAM,MAAM;CAAG,UAAU;AAAW;AACrF,IAAI,OAAe;AAEnB,SAAS,UAAmB;CAC1B,OAAO;AACT;AAEA,SAAS,SAAe;CACtB,KAAK,MAAM,MAAM,CAAC,GAAG,QAAQ,GAAG,GAAG;AACrC;;;;;;AAOA,SAAS,KAAK,KAA+C;CAC3D,IAAI,cAAc,MAAM,OAAO;CAC/B,MAAM,OAAO,QAAQ;CACrB,IAAI,KAAK,MAAM,cAAc,KAAA,GAAW;EACtC,YAAY,QAAQ,QAAQ,KAAK,KAAK,SAAS;EAC/C,OAAO;CACT;CAGA,IAAI,EAAE,YAAY,OAAO;EACvB,YAAY,QAAQ,QAAQ,IAAI;EAChC,OAAO;CACT;CACA,YAAY,IAAI,SAAS,YAAY;EACnC,MAAM,WAAW,KAAK;EAEtB,KAAK,yBAAyB,cAA6B;GACzD,WAAW,SAAS;GACpB,QAAQ,YAAa,QAAQ,CAAC,CAAC,MAAM,aAAa,OAAQ,IAAI;EAChE;EACA,IAAI,QAAQ,QAAQ;EACpB,MAAM,SAAS,SAAS,cAAc,QAAQ;EAC9C,OAAO,MAAM;EACb,OAAO,QAAQ;EACf,OAAO,iBAAi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AAM,SAAS,YAAY;GAC7D,MAAM,MAAM,IAAI,MAAM,MAAM,OAAO,SAAS,GAAG,MAAM,UAAU,IAAI;GACnE,IAAI,iBAAiB,MAAM;GAC3B,IAAI,mBAAmB;GACvB,IAAI,UACF,MAAM,SAAS,aAAa,MAAM,cAAc,WAAW,MAAM,cAAc;GACjF,IAAI,OAAO,MAAM;GACjB,IAAI,WAAW,MAAM;GACrB,OAAO,KAAK,GAAG;EACjB;EACA,KAAK,SAAS,OAAO,SAAS,IAAI,SAAS;EAC3C,MAAM,UAAU,IAAI,MAAM,YAAY,IAAI;EAC1C,QAAQ,cAAc;EACtB,QAAQ,WAAW;EACnB,OAAO;CACT;AACF;;AAGA,SAAS,WAAW,QAAuC;CACzD,MAAM,eAAe,QAAQ,MAAM,SAAS,CAAC,CAAC;CAC9C,IAAI,iBAAiB,QAAQ,iBAAiB,KAAA,GAAW,OAAO;CAChE,KAAK,MAAM,UAAU,aAAa,SAChC,KAAK,MAAM,SAAS,OAAO,QACzB,KAAK,MAAM,aAAa,MAAM,YAC5B,IAAI,QAAQ,KAAK,UAAU,QAAQ,GAAG,OAAO;CAInD,OAAO;AACT;;AAGA,SAAgB,KAAK,QAA0B;CAC7C,IAAI,OAAO,QAAQ,IAAI,MAAM;CAC7B,IAAI,SAAS,KAAA,GAAW;EACtB,OAAO,IAAI,OAAO,MAAM;EACxB,QAAQ,IAAI,QAAQ,IAAI;CAC1B;CACA,OAAO;AACT"}
@@ -1,91 +1 @@
1
- var matteboxPlayerCast=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=e==null?void 0:e.live;return t!==void 0&&t.edge!==null}let n=null,r=null,i=null,a=null,o=new Set,s=null,c={loaded:!1,paused:!0,time:0,duration:NaN},l=c;function u(){return globalThis}function d(){for(let e of[...o])e()}function f(e){var t;if(n!==null)return n;let r=u();return((t=r.cast)==null?void 0:t.framework)===void 0?`chrome`in r?(n=new Promise(t=>{let n=r.__onGCastApiAvailable;if(r.__onGCastApiAvailable=e=>{var r,i;n==null||n(e),t(e?(r=(i=u().cast)==null?void 0:i.framework)==null?null:r:null)},e===`none`)return;let i=document.createElement(`script`);i.src=`https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1`,i.async=!0,i.addEventListener(`error`,()=>t(null)),document.head.append(i)}),n):(n=Promise.resolve(null),n):(n=Promise.resolve(r.cast.framework),n)}function p(e,t){let n=e.CastContext.getInstance(),o=t==null?`CC1AD845`:t;if(r===null){var s,c;let t=(s=(c=u().chrome)==null||(c=c.cast)==null?void 0:c.AutoJoinPolicy.ORIGIN_SCOPED)==null?`origin_scoped`:s;n.setOptions({receiverApplicationId:o,autoJoinPolicy:t}),r=o,n.addEventListener(e.CastContextEventType.CAST_STATE_CHANGED,d),n.addEventListener(e.CastContextEventType.SESSION_STATE_CHANGED,t=>{var r;m(e,n,(r=t.sessionState)==null?``:r)}),i=new e.RemotePlayer,a=new e.RemotePlayerController(i),a.addEventListener(e.RemotePlayerEventType.ANY_CHANGE,()=>{let e=i;(e==null?void 0:e.isConnected)===!0&&e.isMediaLoaded&&(l={loaded:!0,paused:e.isPaused,time:e.currentTime,duration:e.duration>0?e.duration:1/0}),d()})}else t!==null&&t!==r&&console.error(`mattebox-player: the Cast context already uses receiver ${r}`);return n}function m(e,t,n){let r=e.SessionState;if(n===r.SESSION_STARTED&&s!==null&&s.pending)l=c,s.begin(t);else if(n===r.SESSION_RESUMED){var i;let e=(i=t.getCurrentSession())==null||(i=i.getMediaSession())==null||(i=i.media)==null?void 0:i.contentId,n=[...g].find(t=>t.plays(e));n!==void 0&&s===null&&(s=n,n.adopt())}else if(n===r.SESSION_ENDED||n===r.SESSION_START_FAILED){let e=s;s=null,e==null||e.end(n===r.SESSION_ENDED)}d()}let h=new WeakMap,g=new Set;var _=class{constructor(e){this.player=e,this.target=null,this.ctx=null,this.fw=null,this.pending=!1,this.casting=!1,this.handoff=null}connect(e,t){g.add(this),f(t).then(t=>{t!==null&&(this.fw=t,this.ctx=p(t,e),d())})}disconnect(){g.delete(this)}state(){let e=this.ctx,t=this.fw;if(e===null||t===null)return`unavailable`;if(this.casting)return`casting`;let n=e.getCastState();return n===t.CastState.NO_DEVICES_AVAILABLE?`unavailable`:n===t.CastState.CONNECTING||this.pending?`connecting`:`idle`}device(){var e,t;return this.casting?(e=(t=this.ctx)==null||(t=t.getCurrentSession())==null?void 0:t.getCastDevice().friendlyName)==null?null:e:null}remote(){return l}start(e){let t=this.ctx;if(!(t===null||this.casting)){if(s!==null&&s!==this){t.endCurrentSession(!0);return}this.target=e,this.pending=!0,s=this,d(),t.requestSession().catch(()=>{s===this&&(s=null),this.pending=!1,d()})}}stop(){var e;this.casting&&((e=this.ctx)==null||e.endCurrentSession(!0))}playPause(){this.casting&&(a==null||a.playOrPause())}seek(e){this.casting&&i!==null&&(i.currentTime=e,a==null||a.seek())}watch(e){return o.add(e),()=>{o.delete(e)}}plays(e){var t;return e!==void 0&&((t=this.player.player)==null||(t=t.session)==null?void 0:t.source.url)===e}begin(e){var t,n,r,i;this.pending=!1;let a=(t=(n=this.player.player)==null?void 0:n.session)==null?null:t,o=this.player.video,s=o.currentTime,c=!o.paused;if(this.freeze(),a===null)return;let l=this.request(a.source,s,c);if(l===null)return;let u=new CustomEvent(`castload`,{detail:l,bubbles:!0,composed:!0,cancelable:!0});((r=this.target)==null?void 0:r.dispatchEvent(u))!==!1&&((i=e.getCurrentSession())==null||i.loadMedia(l).catch(()=>{}))}adopt(){this.freeze()}freeze(){let e=this.player.engine;this.handoff={live:t(e)},this.player.video.pause(),e==null||e.suspend(),this.casting=!0,this.player.toggleAttribute(`casting`,!0),d()}end(e){if(this.pending=!1,!this.casting)return;this.casting=!1;let t=this.handoff;this.handoff=null;let n=this.player.video,r=this.player.engine;r==null||r.resume(),this.player.removeAttribute(`casting`),e&&l.loaded&&((t==null?void 0:t.live)!==!0&&Number.isFinite(l.time)&&(n.currentTime=l.time),l.paused||n.play().catch(()=>void 0))}request(e,n,r){var i,a;let o=(i=u().chrome)==null||(i=i.cast)==null?void 0:i.media;if(o===void 0)return null;let s=this.player.engine,c=(a=e.type)==null?``:a,l=new o.MediaInfo(e.url,c);if(l.streamType=t(s)?o.StreamType.LIVE:o.StreamType.BUFFERED,/mpegurl/i.test(c)){let e=v(s);l.hlsSegmentFormat=e?`ts`:`fmp4`,l.hlsVideoSegmentFormat=e?`mpeg2_ts`:`fmp4`}let d=[];for(let e of this.player.video.querySelectorAll(`track[src]`)){let t=e;if(t.kind!==`subtitles`&&t.kind!==`captions`)continue;let n=new o.Track(d.length+1,o.TrackType.TEXT);n.trackContentId=t.src,n.trackContentType=`text/vtt`,n.subtype=t.kind===`captions`?o.TextTrackType.CAPTIONS:o.TextTrackType.SUBTITLES,n.name=t.label,n.language=t.srclang,d.push(n)}l.tracks=d.length>0?d:null;let f=new o.LoadRequest(l);return f.currentTime=n,f.autoplay=r,f}};function v(e){let t=e==null?void 0:e.stats.snapshot().presentation;if(t==null)return!1;for(let e of t.periods)for(let t of e.tracks)for(let e of t.renditions)if(/mp2t/i.test(e.mimeType))return!0;return!1}function y(e){let t=h.get(e);return t===void 0&&(t=new _(e),h.set(e,t)),t}function b(e){let t=e.parentNode;return t===null?e instanceof ShadowRoot?e.host:null:t}function x(e){let t=e;for(;t!==null;){if(t instanceof HTMLElement&&t.localName===`mattebox-player`)return t;t=b(t)}return null}var S=class extends HTMLElement{constructor(){super(),this.player=null,this.offs=[],this.epoch=0}connectedCallback(){let e=x(this);if(e===null)return;this.epoch+=1;let t=this.epoch,n=()=>{t===this.epoch&&this.isConnected&&(customElements.upgrade(e),`video`in e&&(this.player=e,this.attach(this.player)))};`video`in e?n():customElements.whenDefined(`mattebox-player`).then(n)}disconnectedCallback(){this.epoch+=1;for(let e of this.offs)e();this.offs=[];let e=this.player;e!==null&&(this.player=null,this.detach(e))}attributeChangedCallback(){this.player!==null&&this.render()}listen(e,t,n){for(let r of t)e.addEventListener(r,n);this.offs.push(()=>{for(let r of t)e.removeEventListener(r,n)})}keep(e){this.offs.push(e)}follow(e,t){let n,r=()=>{n==null||n(),n=t(e.engine)};this.listen(e,[`sourcechange`],r),this.offs.push(()=>{n==null||n(),n=void 0}),r()}observe(e,t,n,r=!1){let i=new MutationObserver(n);i.observe(e,{attributes:!0,attributeFilter:[...t],subtree:r}),this.offs.push(()=>{i.disconnect()})}detach(e){}render(){}};let C={play:`M10.6667 6.6548C10.6667 6.10764 11.2894 5.79346 11.7295 6.11862L24.377 15.4634C24.7377 15.7298 24.7377 16.2692 24.3771 16.5357L11.7295 25.8813C11.2895 26.2065 10.6667 25.8923 10.6667 25.3451L10.6667 6.6548Z`,pause:`M8.66667 6.66667C8.29848 6.66667 8 6.96514 8 7.33333V24.6667C8 25.0349 8.29848 25.3333 8.66667 25.3333H12.6667C13.0349 25.3333 13.3333 25.0349 13.3333 24.6667V7.33333C13.3333 6.96514 13.0349 6.66667 12.6667 6.66667H8.66667Z M19.3333 6.66667C18.9651 6.66667 18.6667 6.96514 18.6667 7.33333V24.6667C18.6667 25.0349 18.9651 25.3333 19.3333 25.3333H23.3333C23.7015 25.3333 24 25.0349 24 24.6667V7.33333C24 6.96514 23.7015 6.66667 23.3333 6.66667H19.3333Z`,cast:`M4 6h24v18H20v-2h6V8H6v1H4V6zM4 21a3 3 0 0 1 3 3H4zM4 15a9 9 0 0 1 9 9h-2a7 7 0 0 0-7-7zM4 10a14 14 0 0 1 14 14h-2A12 12 0 0 0 4 12z`,"cast-active":`M4 6h24v18H20A16 16 0 0 0 4 8zM4 21a3 3 0 0 1 3 3H4zM4 15a9 9 0 0 1 9 9h-2a7 7 0 0 0-7-7zM4 10a14 14 0 0 1 14 14h-2A12 12 0 0 0 4 12z`},w=`http://www.w3.org/2000/svg`;function T(e){let t=document.createElementNS(w,`svg`);t.setAttribute(`viewBox`,`0 0 32 32`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`part`,`icon`);let n=document.createElementNS(w,`path`);return n.setAttribute(`fill-rule`,`evenodd`),n.setAttribute(`d`,C[e]),t.append(n),t}let E=`
2
- :host { display: inline-flex; }
3
- :host([hidden]) { display: none; }
4
- [part~="button"] {
5
- display: inline-flex;
6
- align-items: center;
7
- justify-content: center;
8
- flex: none;
9
- width: 40px;
10
- height: 40px;
11
- padding: 0;
12
- font: inherit;
13
- color: inherit;
14
- background: transparent;
15
- border: 0;
16
- border-radius: var(--mbx-radius);
17
- cursor: pointer;
18
- opacity: 0.9;
19
- }
20
- [part~="button"]:hover { opacity: 1; }
21
- [part~="button"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
22
- [part~="icon"], ::slotted(*) { width: 1.75em; height: 1.75em; fill: currentColor; }
23
- slot[hidden] { display: none; }
24
- `;function D(e){let t=document.createElement(`style`);return t.textContent=e,t}function O(e,t){let n={};for(let r of e){let e=document.createElement(`slot`);e.name=`icon-${r}`,e.append(t(r)),e.hidden=!0,n[r]=e}return n}function k(e,t){for(let n of Object.keys(e))e[n].hidden=n!==t}function A(e,t,n){let r=document.createElement(e);return r.setAttribute(`part`,t),n!==void 0&&(r.textContent=n),r}function j(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:String(r)})}function M(e){return e<10?`0${e}`:`${e}`}function N(e){let t=Number.isFinite(e)&&e>0?Math.floor(e):0,n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}:${M(r)}:${M(i)}`:`${r}:${M(i)}`}function P(e,t){return Number.isFinite(t)?`${N(e)} of ${N(t)}`:N(e)}let F=[`default`,`active`];var I=class extends S{static get observedAttributes(){return[`label-start`,`label-stop`]}constructor(){super(),this.api=null;let e=this.attachShadow({mode:`open`});this.button=document.createElement(`button`),this.button.type=`button`,this.button.setAttribute(`part`,`button`),this.slots=O(F,e=>T(e===`active`?`cast-active`:`cast`));for(let e of F)this.button.append(this.slots[e]);this.button.addEventListener(`click`,()=>{let e=this.api;e!==null&&(e.state()===`casting`?e.stop():e.start(this))}),e.append(D(E),this.button)}attach(e){let t=y(e);this.api=t,t.connect(this.getAttribute(`receiver`),this.getAttribute(`sdk`)),this.keep(t.watch(()=>{this.render()})),this.follow(e,()=>{this.render()})}detach(){var e;(e=this.api)==null||e.disconnect(),this.api=null}render(){var e,t,n;let r=this.player,i=this.api;if(r===null||i===null)return;let a=i.state(),o=a===`casting`;this.hidden=a===`unavailable`,this.button.disabled=!o&&((e=r.player)==null?void 0:e.session)==null,this.button.toggleAttribute(`aria-busy`,a===`connecting`),k(this.slots,o?`active`:`default`),this.button.setAttribute(`aria-label`,o?(t=this.getAttribute(`label-stop`))==null?`Stop casting`:t:(n=this.getAttribute(`label-start`))==null?`Cast`:n)}};function L(e,t,n){return Math.min(n,Math.max(t,e))}function R(e){let{onInput:t}=e,n=A(`div`,`slider`);n.setAttribute(`role`,`slider`),n.tabIndex=0;let r=A(`div`,`rail`),i=A(`div`,`track`),a=A(`div`,`fill`),o=A(`div`,`thumb`);i.append(a),r.append(i,o),n.append(r);let s=0,c=1,l=0,u=!1;function d(){let e=`${(c>s?(l-s)/(c-s):0)*100}%`;a.style.width=e,o.style.left=e}function f(e){let t=r.getBoundingClientRect();return t.width===0?s:s+L((e-t.left)/t.width,0,1)*(c-s)}function p(t){u=t,e.onDrag(t)}function m(e){if(e.button===0){e.preventDefault(),p(!0);try{n.setPointerCapture(e.pointerId)}catch(e){}t(f(e.clientX))}}function h(e){if(u){if(e.buttons===0){g(e);return}t(f(e.clientX))}}function g(e){u&&(p(!1),t(f(e.clientX)))}function _(){u&&p(!1)}function v(n){let r;switch(n.key){case`ArrowRight`:case`ArrowUp`:r=l+e.step();break;case`ArrowLeft`:case`ArrowDown`:r=l-e.step();break;case`PageUp`:r=l+e.page();break;case`PageDown`:r=l-e.page();break;case`Home`:r=s;break;case`End`:r=c;break;default:return}n.preventDefault(),t(L(r,s,c))}return n.addEventListener(`pointerdown`,m),n.addEventListener(`pointermove`,h),n.addEventListener(`pointerup`,g),n.addEventListener(`pointercancel`,_),n.addEventListener(`lostpointercapture`,_),n.addEventListener(`keydown`,v),{root:n,track:i,rail:r,label(e){n.setAttribute(`aria-label`,e)},dragging(){return u},range(e,t){s=e,c=t,n.setAttribute(`aria-valuemin`,String(e)),n.setAttribute(`aria-valuemax`,String(t)),d()},set(e,t){l=L(e,s,c),n.setAttribute(`aria-valuenow`,String(l)),n.setAttribute(`aria-valuetext`,t),d()},dispose(){n.removeEventListener(`pointerdown`,m),n.removeEventListener(`pointermove`,h),n.removeEventListener(`pointerup`,g),n.removeEventListener(`pointercancel`,_),n.removeEventListener(`lostpointercapture`,_),n.removeEventListener(`keydown`,v)}}}let z=[`play`,`pause`],B=`${E}
25
-
26
- :host { display: block; }
27
- :host([hidden]) { display: none; }
28
- [part~="slider"] {
29
- position: relative;
30
- height: 40px;
31
- border-radius: var(--mbx-radius);
32
- cursor: pointer;
33
- touch-action: none;
34
- }
35
- [part~="slider"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
36
- [part~="rail"] { position: absolute; top: 0; bottom: 0; left: 8px; right: 8px; }
37
- [part~="track"] {
38
- position: absolute;
39
- top: 50%;
40
- left: 0;
41
- right: 0;
42
- height: 4px;
43
- transform: translateY(-50%);
44
- background: rgba(255, 255, 255, 0.35);
45
- border-radius: 2px;
46
- overflow: hidden;
47
- }
48
- [part~="fill"] { position: absolute; top: 0; bottom: 0; left: 0; background: var(--mbx-accent); }
49
- [part~="thumb"] {
50
- position: absolute;
51
- top: 50%;
52
- width: 12px;
53
- height: 12px;
54
- margin: -6px 0 0 -6px;
55
- border-radius: 50%;
56
- background: var(--mbx-text);
57
- pointer-events: none;
58
- }
59
-
60
- :host {
61
- position: absolute;
62
- inset: 0;
63
- display: flex;
64
- align-items: center;
65
- justify-content: center;
66
- padding: 16px;
67
- background: rgba(0, 0, 0, 0.85);
68
- color: var(--mbx-text);
69
- font: 400 15px/1.4 var(--mbx-font);
70
- text-align: center;
71
- }
72
- :host([hidden]) { display: none; }
73
- [part~="box"] { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(100%, 420px); }
74
- [part~="title"] { font-size: 18px; font-weight: 600; }
75
- [part~="row"] { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
76
- [part~="slider"] { flex: 1; }
77
- [part~="time"] { font-variant-numeric: tabular-nums; color: var(--mbx-muted); font-size: 13px; }
78
- [part~="stop"] {
79
- height: 36px;
80
- padding: 0 16px;
81
- font: inherit;
82
- font-weight: 600;
83
- color: inherit;
84
- background: transparent;
85
- border: 1px solid currentColor;
86
- border-radius: var(--mbx-radius);
87
- cursor: pointer;
88
- }
89
- [part~="stop"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
90
- [hidden] { display: none; }
91
- `;var V=class extends S{static get observedAttributes(){return[`label`,`label-stop`,`label-play`,`label-pause`,`label-seek`]}constructor(){super(),this.api=null,this.held=null;let e=this.attachShadow({mode:`open`}),t=A(`div`,`box`);this.title_=A(`div`,`title`),this.play=document.createElement(`button`),this.play.type=`button`,this.play.setAttribute(`part`,`button play`),this.slots=O(z,T);for(let e of z)this.play.append(this.slots[e]);this.play.addEventListener(`click`,()=>{var e;(e=this.api)==null||e.playPause()}),this.seek=R({step:()=>5,page:()=>30,onInput:e=>{var t;if(this.seek.dragging()){this.held=e,this.paint();return}this.held=null,(t=this.api)==null||t.seek(e)},onDrag:e=>{this.toggleAttribute(`dragging`,e),e||(this.held=null)}}),this.time=A(`span`,`time`),this.row=A(`div`,`row`),this.row.append(this.play,this.seek.root,this.time),this.stop=A(`button`,`stop`),this.stop.type=`button`,this.stop.addEventListener(`click`,()=>{var e;(e=this.api)==null||e.stop()}),t.append(this.title_,this.row,this.stop),e.append(D(B),t)}connectedCallback(){this.player===null&&(this.hidden=!0),super.connectedCallback()}attach(e){let t=y(e);this.api=t,this.keep(t.watch(()=>{this.render()})),this.render()}detach(){this.api=null,this.hidden=!0}paint(){var e;let t=this.api;if(t===null)return;let n=t.remote(),r=n.loaded&&Number.isFinite(n.duration);if(this.seek.root.hidden=!r,this.time.hidden=!r,!r)return;let i=(e=this.held)==null?n.time:e;this.seek.range(0,n.duration),this.seek.set(i,P(i,n.duration)),this.time.textContent=`${N(i)} / ${N(n.duration)}`}render(){var e,t,n,r,i;let a=this.api;if(a===null)return;let o=a.remote(),s=o.loaded&&!o.paused?`pause`:`play`;k(this.slots,s),this.play.setAttribute(`aria-label`,(e=this.getAttribute(`label-${s}`))==null?s===`play`?`Play`:`Pause`:e),this.seek.label((t=this.getAttribute(`label-seek`))==null?`Seek`:t),this.stop.textContent=(n=this.getAttribute(`label-stop`))==null?`Stop casting`:n;let c=a.state()===`casting`;this.hidden=!c,c&&(this.title_.textContent=j((r=this.getAttribute(`label`))==null?`Casting to {device}`:r,{device:(i=a.device())==null?``:i}),this.play.disabled=!o.loaded,this.paint())}};let H=`mbx-cast-button`,U=`mbx-cast-screen`;return customElements.get(`mbx-cast-button`)===void 0&&customElements.define(H,I),customElements.get(`mbx-cast-screen`)===void 0&&customElements.define(U,V),e.CAST_BUTTON=H,e.CAST_SCREEN=U,e.MbxCastButton=I,e.MbxCastScreen=V,e})({});
1
+ var matteboxPlayerCast=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=e==null?void 0:e.live;return t!==void 0&&t.edge!==null}let n=null,r=null,i=null,a=null,o=/* @__PURE__ */ new Set,s=null,c={loaded:!1,paused:!0,time:0,duration:NaN},l=c;function u(){return globalThis}function d(){for(let e of[...o])e()}function f(e){var t;if(n!==null)return n;let r=u();return((t=r.cast)==null?void 0:t.framework)===void 0?`chrome`in r?(n=new Promise(t=>{let n=r.__onGCastApiAvailable;if(r.__onGCastApiAvailable=e=>{var r,i;n==null||n(e),t(e?(r=(i=u().cast)==null?void 0:i.framework)==null?null:r:null)},e===`none`)return;let i=document.createElement(`script`);i.src=`https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1`,i.async=!0,i.addEventListener(`error`,()=>t(null)),document.head.append(i)}),n):(n=Promise.resolve(null),n):(n=Promise.resolve(r.cast.framework),n)}function p(e,t){let n=e.CastContext.getInstance(),o=t==null?`CC1AD845`:t;if(r===null){var s,c;let t=(s=(c=u().chrome)==null||(c=c.cast)==null?void 0:c.AutoJoinPolicy.ORIGIN_SCOPED)==null?`origin_scoped`:s;n.setOptions({receiverApplicationId:o,autoJoinPolicy:t}),r=o,n.addEventListener(e.CastContextEventType.CAST_STATE_CHANGED,d),n.addEventListener(e.CastContextEventType.SESSION_STATE_CHANGED,t=>{var r;m(e,n,(r=t.sessionState)==null?``:r)}),i=new e.RemotePlayer,a=new e.RemotePlayerController(i),a.addEventListener(e.RemotePlayerEventType.ANY_CHANGE,()=>{let e=i;(e==null?void 0:e.isConnected)===!0&&e.isMediaLoaded&&(l={loaded:!0,paused:e.isPaused,time:e.currentTime,duration:e.duration>0?e.duration:1/0}),d()})}else t!==null&&t!==r&&console.error(`mattebox-player: the Cast context already uses receiver ${r}`);return n}function m(e,t,n){let r=e.SessionState;if(n===r.SESSION_STARTED&&s!==null&&s.pending)l=c,s.begin(t);else if(n===r.SESSION_RESUMED){var i;let e=(i=t.getCurrentSession())==null||(i=i.getMediaSession())==null||(i=i.media)==null?void 0:i.contentId,n=[...g].find(t=>t.plays(e));n!==void 0&&s===null&&(s=n,n.adopt())}else if(n===r.SESSION_ENDED||n===r.SESSION_START_FAILED){let e=s;s=null,e==null||e.end(n===r.SESSION_ENDED)}d()}let h=/* @__PURE__ */ new WeakMap,g=/* @__PURE__ */ new Set;var _=class{constructor(e){this.player=e,this.target=null,this.ctx=null,this.fw=null,this.pending=!1,this.casting=!1,this.handoff=null}connect(e,t){g.add(this),f(t).then(t=>{t!==null&&(this.fw=t,this.ctx=p(t,e),d())})}disconnect(){g.delete(this)}state(){let e=this.ctx,t=this.fw;if(e===null||t===null)return`unavailable`;if(this.casting)return`casting`;let n=e.getCastState();return n===t.CastState.NO_DEVICES_AVAILABLE?`unavailable`:n===t.CastState.CONNECTING||this.pending?`connecting`:`idle`}device(){var e,t;return this.casting?(e=(t=this.ctx)==null||(t=t.getCurrentSession())==null?void 0:t.getCastDevice().friendlyName)==null?null:e:null}remote(){return l}start(e){let t=this.ctx;if(!(t===null||this.casting)){if(s!==null&&s!==this){t.endCurrentSession(!0);return}this.target=e,this.pending=!0,s=this,d(),t.requestSession().catch(()=>{s===this&&(s=null),this.pending=!1,d()})}}stop(){var e;this.casting&&((e=this.ctx)==null||e.endCurrentSession(!0))}playPause(){this.casting&&(a==null||a.playOrPause())}seek(e){this.casting&&i!==null&&(i.currentTime=e,a==null||a.seek())}watch(e){return o.add(e),()=>{o.delete(e)}}plays(e){var t;return e!==void 0&&((t=this.player.player)==null||(t=t.session)==null?void 0:t.source.url)===e}begin(e){var t,n,r,i;this.pending=!1;let a=(t=(n=this.player.player)==null?void 0:n.session)==null?null:t,o=this.player.video,s=o.currentTime,c=!o.paused;if(this.freeze(),a===null)return;let l=this.request(a.source,s,c);if(l===null)return;let u=new CustomEvent(`castload`,{detail:l,bubbles:!0,composed:!0,cancelable:!0});((r=this.target)==null?void 0:r.dispatchEvent(u))!==!1&&((i=e.getCurrentSession())==null||i.loadMedia(l).catch(()=>{}))}adopt(){this.freeze()}freeze(){let e=this.player.engine;this.handoff={live:t(e)},this.player.video.pause(),e==null||e.suspend(),this.casting=!0,this.player.toggleAttribute(`casting`,!0),d()}end(e){if(this.pending=!1,!this.casting)return;this.casting=!1;let t=this.handoff;this.handoff=null;let n=this.player.video,r=this.player.engine;r==null||r.resume(),this.player.removeAttribute(`casting`),e&&l.loaded&&((t==null?void 0:t.live)!==!0&&Number.isFinite(l.time)&&(n.currentTime=l.time),l.paused||n.play().catch(()=>void 0))}request(e,n,r){var i,a;let o=(i=u().chrome)==null||(i=i.cast)==null?void 0:i.media;if(o===void 0)return null;let s=this.player.engine,c=(a=e.type)==null?``:a,l=new o.MediaInfo(e.url,c);if(l.streamType=t(s)?o.StreamType.LIVE:o.StreamType.BUFFERED,/mpegurl/i.test(c)){let e=v(s);l.hlsSegmentFormat=e?`ts`:`fmp4`,l.hlsVideoSegmentFormat=e?`mpeg2_ts`:`fmp4`}let d=[];for(let e of this.player.video.querySelectorAll(`track[src]`)){let t=e;if(t.kind!==`subtitles`&&t.kind!==`captions`)continue;let n=new o.Track(d.length+1,o.TrackType.TEXT);n.trackContentId=t.src,n.trackContentType=`text/vtt`,n.subtype=t.kind===`captions`?o.TextTrackType.CAPTIONS:o.TextTrackType.SUBTITLES,n.name=t.label,n.language=t.srclang,d.push(n)}l.tracks=d.length>0?d:null;let f=new o.LoadRequest(l);return f.currentTime=n,f.autoplay=r,f}};function v(e){let t=e==null?void 0:e.stats.snapshot().presentation;if(t==null)return!1;for(let e of t.periods)for(let t of e.tracks)for(let e of t.renditions)if(/mp2t/i.test(e.mimeType))return!0;return!1}function y(e){let t=h.get(e);return t===void 0&&(t=new _(e),h.set(e,t)),t}function b(e){let t=e.parentNode;return t===null?e instanceof ShadowRoot?e.host:null:t}function x(e){let t=e;for(;t!==null;){if(t instanceof HTMLElement&&t.localName===`mattebox-player`)return t;t=b(t)}return null}var S=class extends HTMLElement{constructor(){super(),this.player=null,this.offs=[],this.epoch=0}connectedCallback(){let e=x(this);if(e===null)return;this.epoch+=1;let t=this.epoch,n=()=>{t===this.epoch&&this.isConnected&&(customElements.upgrade(e),`video`in e&&(this.player=e,this.attach(this.player)))};`video`in e?n():customElements.whenDefined(`mattebox-player`).then(n)}disconnectedCallback(){this.epoch+=1;for(let e of this.offs)e();this.offs=[];let e=this.player;e!==null&&(this.player=null,this.detach(e))}attributeChangedCallback(){this.player!==null&&this.render()}listen(e,t,n){for(let r of t)e.addEventListener(r,n);this.offs.push(()=>{for(let r of t)e.removeEventListener(r,n)})}keep(e){this.offs.push(e)}follow(e,t){let n,r=()=>{n==null||n(),n=t(e.engine)};this.listen(e,[`sourcechange`],r),this.offs.push(()=>{n==null||n(),n=void 0}),r()}observe(e,t,n,r=!1){let i=new MutationObserver(n);i.observe(e,{attributes:!0,attributeFilter:[...t],subtree:r}),this.offs.push(()=>{i.disconnect()})}detach(e){}render(){}};let C={play:`M10.6667 6.6548C10.6667 6.10764 11.2894 5.79346 11.7295 6.11862L24.377 15.4634C24.7377 15.7298 24.7377 16.2692 24.3771 16.5357L11.7295 25.8813C11.2895 26.2065 10.6667 25.8923 10.6667 25.3451L10.6667 6.6548Z`,pause:`M8.66667 6.66667C8.29848 6.66667 8 6.96514 8 7.33333V24.6667C8 25.0349 8.29848 25.3333 8.66667 25.3333H12.6667C13.0349 25.3333 13.3333 25.0349 13.3333 24.6667V7.33333C13.3333 6.96514 13.0349 6.66667 12.6667 6.66667H8.66667Z M19.3333 6.66667C18.9651 6.66667 18.6667 6.96514 18.6667 7.33333V24.6667C18.6667 25.0349 18.9651 25.3333 19.3333 25.3333H23.3333C23.7015 25.3333 24 25.0349 24 24.6667V7.33333C24 6.96514 23.7015 6.66667 23.3333 6.66667H19.3333Z`,cast:`M4 6h24v18H20v-2h6V8H6v1H4V6zM4 21a3 3 0 0 1 3 3H4zM4 15a9 9 0 0 1 9 9h-2a7 7 0 0 0-7-7zM4 10a14 14 0 0 1 14 14h-2A12 12 0 0 0 4 12z`,"cast-active":`M4 6h24v18H20A16 16 0 0 0 4 8zM4 21a3 3 0 0 1 3 3H4zM4 15a9 9 0 0 1 9 9h-2a7 7 0 0 0-7-7zM4 10a14 14 0 0 1 14 14h-2A12 12 0 0 0 4 12z`},w=`http://www.w3.org/2000/svg`;function T(e){let t=document.createElementNS(w,`svg`);t.setAttribute(`viewBox`,`0 0 32 32`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`part`,`icon`);let n=document.createElementNS(w,`path`);return n.setAttribute(`fill-rule`,`evenodd`),n.setAttribute(`d`,C[e]),t.append(n),t}function E(e){let t=document.createElement(`style`);return t.textContent=e,t}function D(e,t){let n={};for(let r of e){let e=document.createElement(`slot`);e.name=`icon-${r}`,e.append(t(r)),e.hidden=!0,n[r]=e}return n}function O(e,t){for(let n of Object.keys(e))e[n].hidden=n!==t}function k(e,t,n){let r=document.createElement(e);return r.setAttribute(`part`,t),n!==void 0&&(r.textContent=n),r}function A(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:String(r)})}function j(e){return e<10?`0${e}`:`${e}`}function M(e){let t=Number.isFinite(e)&&e>0?Math.floor(e):0,n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}:${j(r)}:${j(i)}`:`${r}:${j(i)}`}function N(e,t){return Number.isFinite(t)?`${M(e)} of ${M(t)}`:M(e)}let P=[`default`,`active`];var F=class extends S{static get observedAttributes(){return[`label-start`,`label-stop`]}constructor(){super(),this.api=null;let e=this.attachShadow({mode:`open`});this.button=document.createElement(`button`),this.button.type=`button`,this.button.setAttribute(`part`,`button`),this.slots=D(P,e=>T(e===`active`?`cast-active`:`cast`));for(let e of P)this.button.append(this.slots[e]);this.button.addEventListener(`click`,()=>{let e=this.api;e!==null&&(e.state()===`casting`?e.stop():e.start(this))}),e.append(E(`:host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:40px;height:40px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}`),this.button)}attach(e){let t=y(e);this.api=t,t.connect(this.getAttribute(`receiver`),this.getAttribute(`sdk`)),this.keep(t.watch(()=>{this.render()})),this.follow(e,()=>{this.render()})}detach(){var e;(e=this.api)==null||e.disconnect(),this.api=null}render(){var e,t,n;let r=this.player,i=this.api;if(r===null||i===null)return;let a=i.state(),o=a===`casting`;this.hidden=a===`unavailable`,this.button.disabled=!o&&((e=r.player)==null?void 0:e.session)==null,this.button.toggleAttribute(`aria-busy`,a===`connecting`),O(this.slots,o?`active`:`default`),this.button.setAttribute(`aria-label`,o?(t=this.getAttribute(`label-stop`))==null?`Stop casting`:t:(n=this.getAttribute(`label-start`))==null?`Cast`:n)}};function I(e,t,n){return Math.min(n,Math.max(t,e))}function L(e){let{onInput:t}=e,n=k(`div`,`slider`);n.setAttribute(`role`,`slider`),n.tabIndex=0;let r=k(`div`,`rail`),i=k(`div`,`track`),a=k(`div`,`fill`),o=k(`div`,`thumb`);i.append(a),r.append(i,o),n.append(r);let s=0,c=1,l=0,u=!1;function d(){let e=`${(c>s?(l-s)/(c-s):0)*100}%`;a.style.width=e,o.style.left=e}function f(e){let t=r.getBoundingClientRect();return t.width===0?s:s+I((e-t.left)/t.width,0,1)*(c-s)}function p(t){u=t,e.onDrag(t)}function m(e){if(e.button===0){e.preventDefault(),p(!0);try{n.setPointerCapture(e.pointerId)}catch(e){}t(f(e.clientX))}}function h(e){if(u){if(e.buttons===0){g(e);return}t(f(e.clientX))}}function g(e){u&&(p(!1),t(f(e.clientX)))}function _(){u&&p(!1)}function v(n){let r;switch(n.key){case`ArrowRight`:case`ArrowUp`:r=l+e.step();break;case`ArrowLeft`:case`ArrowDown`:r=l-e.step();break;case`PageUp`:r=l+e.page();break;case`PageDown`:r=l-e.page();break;case`Home`:r=s;break;case`End`:r=c;break;default:return}n.preventDefault(),t(I(r,s,c))}return n.addEventListener(`pointerdown`,m),n.addEventListener(`pointermove`,h),n.addEventListener(`pointerup`,g),n.addEventListener(`pointercancel`,_),n.addEventListener(`lostpointercapture`,_),n.addEventListener(`keydown`,v),{root:n,track:i,rail:r,label(e){n.setAttribute(`aria-label`,e)},dragging(){return u},range(e,t){s=e,c=t,n.setAttribute(`aria-valuemin`,String(e)),n.setAttribute(`aria-valuemax`,String(t)),d()},set(e,t){l=I(e,s,c),n.setAttribute(`aria-valuenow`,String(l)),n.setAttribute(`aria-valuetext`,t),d()},dispose(){n.removeEventListener(`pointerdown`,m),n.removeEventListener(`pointermove`,h),n.removeEventListener(`pointerup`,g),n.removeEventListener(`pointercancel`,_),n.removeEventListener(`lostpointercapture`,_),n.removeEventListener(`keydown`,v)}}}let R=[`play`,`pause`];var z=class extends S{static get observedAttributes(){return[`label`,`label-stop`,`label-play`,`label-pause`,`label-seek`]}constructor(){super(),this.api=null,this.held=null;let e=this.attachShadow({mode:`open`}),t=k(`div`,`box`);this.title_=k(`div`,`title`),this.play=document.createElement(`button`),this.play.type=`button`,this.play.setAttribute(`part`,`button play`),this.slots=D(R,T);for(let e of R)this.play.append(this.slots[e]);this.play.addEventListener(`click`,()=>{var e;(e=this.api)==null||e.playPause()}),this.seek=L({step:()=>5,page:()=>30,onInput:e=>{var t;if(this.seek.dragging()){this.held=e,this.paint();return}this.held=null,(t=this.api)==null||t.seek(e)},onDrag:e=>{this.toggleAttribute(`dragging`,e),e||(this.held=null)}}),this.time=k(`span`,`time`),this.row=k(`div`,`row`),this.row.append(this.play,this.seek.root,this.time),this.stop=k(`button`,`stop`),this.stop.type=`button`,this.stop.addEventListener(`click`,()=>{var e;(e=this.api)==null||e.stop()}),t.append(this.title_,this.row,this.stop),e.append(E(`:host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:40px;height:40px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}:host{display:block}:host([hidden]){display:none}[part~=slider]{border-radius:var(--mbx-radius);cursor:pointer;touch-action:none;height:40px;position:relative}[part~=slider]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=slider]:focus:not(:focus-visible){outline:none}[part~=rail]{position:absolute;top:0;bottom:0;left:8px;right:8px}[part~=track]{background:#ffffff59;border-radius:2px;height:4px;position:absolute;top:50%;left:0;right:0;overflow:hidden;transform:translateY(-50%)}[part~=fill]{background:var(--mbx-accent);position:absolute;top:0;bottom:0;left:0}[part~=thumb]{background:var(--mbx-text);pointer-events:none;border-radius:50%;width:12px;height:12px;margin:-6px 0 0 -6px;position:absolute;top:50%}:host{color:var(--mbx-text);font:400 15px / 1.4 var(--mbx-font);text-align:center;background:#000000d9;justify-content:center;align-items:center;padding:16px;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}:host([hidden]){display:none}[part~=box]{flex-direction:column;align-items:center;width:100%;max-width:420px;display:flex}[part~=box]>:not([hidden])~:not([hidden]){margin-top:12px}[part~=title]{font-size:18px;font-weight:600}[part~=row]{justify-content:center;align-items:center;width:100%;display:flex}[part~=row]>:not([hidden])~:not([hidden]){margin-left:12px}[part~=slider]{flex:1}[part~=time]{font-variant-numeric:tabular-nums;color:var(--mbx-muted);font-size:13px}[part~=stop]{height:36px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:1px solid;padding:0 16px;font-weight:600}[part~=stop]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=stop]:focus:not(:focus-visible){outline:none}[hidden]{display:none}`),t)}connectedCallback(){this.player===null&&(this.hidden=!0),super.connectedCallback()}attach(e){let t=y(e);this.api=t,this.keep(t.watch(()=>{this.render()})),this.render()}detach(){this.api=null,this.hidden=!0}paint(){var e;let t=this.api;if(t===null)return;let n=t.remote(),r=n.loaded&&Number.isFinite(n.duration);if(this.seek.root.hidden=!r,this.time.hidden=!r,!r)return;let i=(e=this.held)==null?n.time:e;this.seek.range(0,n.duration),this.seek.set(i,N(i,n.duration)),this.time.textContent=`${M(i)} / ${M(n.duration)}`}render(){var e,t,n,r,i;let a=this.api;if(a===null)return;let o=a.remote(),s=o.loaded&&!o.paused?`pause`:`play`;O(this.slots,s),this.play.setAttribute(`aria-label`,(e=this.getAttribute(`label-${s}`))==null?s===`play`?`Play`:`Pause`:e),this.seek.label((t=this.getAttribute(`label-seek`))==null?`Seek`:t),this.stop.textContent=(n=this.getAttribute(`label-stop`))==null?`Stop casting`:n;let c=a.state()===`casting`;this.hidden=!c,c&&(this.title_.textContent=A((r=this.getAttribute(`label`))==null?`Casting to {device}`:r,{device:(i=a.device())==null?``:i}),this.play.disabled=!o.loaded,this.paint())}};let B=`mbx-cast-button`,V=`mbx-cast-screen`;return customElements.get(`mbx-cast-button`)===void 0&&customElements.define(B,F),customElements.get(`mbx-cast-screen`)===void 0&&customElements.define(V,z),e.CAST_BUTTON=B,e.CAST_SCREEN=V,e.MbxCastButton=F,e.MbxCastScreen=z,e})({});
package/dist/component.js CHANGED
@@ -1,89 +1,86 @@
1
- import { findPlayer, PLAYER } from './host.js';
2
- export class Component extends HTMLElement {
3
- constructor() {
4
- super();
5
- this.player = null;
6
- this.offs = [];
7
- this.epoch = 0;
8
- }
9
- connectedCallback() {
10
- const found = findPlayer(this);
11
- if (found === null)
12
- return;
13
- this.epoch += 1;
14
- const epoch = this.epoch;
15
- const attach = () => {
16
- if (epoch !== this.epoch || !this.isConnected)
17
- return;
18
- // Defined, and this instance upgraded: `video` is on the prototype.
19
- customElements.upgrade(found);
20
- if (!('video' in found))
21
- return;
22
- this.player = found;
23
- this.attach(this.player);
24
- };
25
- if ('video' in found)
26
- attach();
27
- else
28
- void customElements.whenDefined(PLAYER).then(attach);
29
- }
30
- disconnectedCallback() {
31
- this.epoch += 1;
32
- for (const off of this.offs)
33
- off();
34
- this.offs = [];
35
- const player = this.player;
36
- if (player === null)
37
- return;
38
- this.player = null;
39
- this.detach(player);
40
- }
41
- attributeChangedCallback() {
42
- if (this.player !== null)
43
- this.render();
44
- }
45
- /** Adds `fn` for every name on `target`, to be removed on detach. */
46
- listen(target, names, fn) {
47
- for (const name of names)
48
- target.addEventListener(name, fn);
49
- this.offs.push(() => {
50
- for (const name of names)
51
- target.removeEventListener(name, fn);
52
- });
53
- }
54
- /** Keeps `off` to run on detach. */
55
- keep(off) {
56
- this.offs.push(off);
57
- }
58
- /**
59
- * Runs `fn` over the current engine now and on every session change,
60
- * running what the last call returned first, so a control's engine
61
- * subscriptions live exactly as long as the session. Detach runs it too.
62
- */
63
- follow(player, fn) {
64
- let off;
65
- const run = () => {
66
- off?.();
67
- off = fn(player.engine);
68
- };
69
- this.listen(player, ['sourcechange'], run);
70
- this.offs.push(() => {
71
- off?.();
72
- off = undefined;
73
- });
74
- run();
75
- }
76
- /** Runs `fn` when any of `names` changes on `target`, or under it with `subtree`, until detach. */
77
- observe(target, names, fn, subtree = false) {
78
- const observer = new MutationObserver(fn);
79
- observer.observe(target, { attributes: true, attributeFilter: [...names], subtree });
80
- this.offs.push(() => {
81
- observer.disconnect();
82
- });
83
- }
84
- /** The control left its player. Listeners are already gone; undo anything else. */
85
- detach(_player) { }
86
- /** Draws the current state. Called on every observed attribute change while attached. */
87
- render() { }
88
- }
1
+ import { PLAYER, findPlayer } from "./host.js";
2
+ //#region src/component.ts
3
+ var Component = class extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ this.player = null;
7
+ this.offs = [];
8
+ this.epoch = 0;
9
+ }
10
+ connectedCallback() {
11
+ const found = findPlayer(this);
12
+ if (found === null) return;
13
+ this.epoch += 1;
14
+ const epoch = this.epoch;
15
+ const attach = () => {
16
+ if (epoch !== this.epoch || !this.isConnected) return;
17
+ customElements.upgrade(found);
18
+ if (!("video" in found)) return;
19
+ this.player = found;
20
+ this.attach(this.player);
21
+ };
22
+ if ("video" in found) attach();
23
+ else customElements.whenDefined(PLAYER).then(attach);
24
+ }
25
+ disconnectedCallback() {
26
+ this.epoch += 1;
27
+ for (const off of this.offs) off();
28
+ this.offs = [];
29
+ const player = this.player;
30
+ if (player === null) return;
31
+ this.player = null;
32
+ this.detach(player);
33
+ }
34
+ attributeChangedCallback() {
35
+ if (this.player !== null) this.render();
36
+ }
37
+ /** Adds `fn` for every name on `target`, to be removed on detach. */
38
+ listen(target, names, fn) {
39
+ for (const name of names) target.addEventListener(name, fn);
40
+ this.offs.push(() => {
41
+ for (const name of names) target.removeEventListener(name, fn);
42
+ });
43
+ }
44
+ /** Keeps `off` to run on detach. */
45
+ keep(off) {
46
+ this.offs.push(off);
47
+ }
48
+ /**
49
+ * Runs `fn` over the current engine now and on every session change,
50
+ * running what the last call returned first, so a control's engine
51
+ * subscriptions live exactly as long as the session. Detach runs it too.
52
+ */
53
+ follow(player, fn) {
54
+ let off;
55
+ const run = () => {
56
+ off?.();
57
+ off = fn(player.engine);
58
+ };
59
+ this.listen(player, ["sourcechange"], run);
60
+ this.offs.push(() => {
61
+ off?.();
62
+ off = void 0;
63
+ });
64
+ run();
65
+ }
66
+ /** Runs `fn` when any of `names` changes on `target`, or under it with `subtree`, until detach. */
67
+ observe(target, names, fn, subtree = false) {
68
+ const observer = new MutationObserver(fn);
69
+ observer.observe(target, {
70
+ attributes: true,
71
+ attributeFilter: [...names],
72
+ subtree
73
+ });
74
+ this.offs.push(() => {
75
+ observer.disconnect();
76
+ });
77
+ }
78
+ /** The control left its player. Listeners are already gone; undo anything else. */
79
+ detach(_player) {}
80
+ /** Draws the current state. Called on every observed attribute change while attached. */
81
+ render() {}
82
+ };
83
+ //#endregion
84
+ export { Component };
85
+
89
86
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,OAAgB,SAAU,SAAQ,WAAW;IAMjD;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACjB,CAAC;IAED,iBAAiB;QACf,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO;QAC3B,IAAI,CAAC,KAAK,IAAI,CA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yFAAyF;IAC/E,MAAM,KAAU,CAAC;CAC5B"}
1
+ {"version":3,"file":"component.js","names":[],"sources":["../src/component.ts"],"sourcesContent":["/**\n * What the two elements share: finding their player, and letting go of it.\n * A copy of the player's own base, because the player exports no base\n * class: a control of the page's own implements the contract from outside\n * (player guide, chapter 03), and so does this package.\n *\n * A control attaches when it is connected inside a player, once the player\n * is defined and upgraded, and detaches when it is removed. Every listener\n * a control adds goes through `listen`, so detaching drops them all. A\n * control connected outside a player is inert. Moving one to another\n * player detaches and attaches again, so a framework that reorders\n * children is safe.\n *\n * No class fields: the ES2015 build would lower them into helpers, and the\n * emit check bans helpers. State is declared, then assigned in the\n * constructor.\n */\nimport type { Mattebox } from 'mattebox';\nimport type { PlayerHost } from './host.js';\nimport { findPlayer, PLAYER } from './host.js';\n\nexport abstract class Component extends HTMLElement {\n declare protected player: PlayerHost | null;\n declare private offs: Array<() => void>;\n /** Bumped on every connect and disconnect, so a late upgrade attaches only to the current connection. */\n declare private epoch: number;\n\n constructor() {\n super();\n this.player = null;\n this.offs = [];\n this.epoch = 0;\n }\n\n connectedCallback(): void {\n const found = findPlayer(this);\n if (found === null) return;\n this.epoch += 1;\n const epoch = this.epoch;\n const attach = (): void => {\n if (epoch !== this.epoch || !this.isConnected) return;\n // Defined, and this instance upgraded: `video` is on the prototype.\n customElements.upgrade(found);\n if (!('video' in found)) return;\n this.player = found as PlayerHost;\n this.attach(this.player);\n };\n if ('video' in found) attach();\n else void customElements.whenDefined(PLAYER).then(attach);\n }\n\n disconnectedCallback(): void {\n this.epoch += 1;\n for (const off of this.offs) off();\n this.offs = [];\n const player = this.player;\n if (player === null) return;\n this.player = null;\n this.detach(player);\n }\n\n attributeChangedCallback(): void {\n if (this.player !== null) this.render();\n }\n\n /** Adds `fn` for every name on `target`, to be removed on detach. */\n protected listen(target: EventTarget, names: readonly string[], fn: () => void): void {\n for (const name of names) target.addEventListener(name, fn);\n this.offs.push(() => {\n for (const name of names) target.removeEventListener(name, fn);\n });\n }\n\n /** Keeps `off` to run on detach. */\n protected keep(off: () => void): void {\n this.offs.push(off);\n }\n\n /**\n * Runs `fn` over the current engine now and on every session change,\n * running what the last call returned first, so a control's engine\n * subscriptions live exactly as long as the session. Detach runs it too.\n */\n protected follow(\n player: PlayerHost,\n fn: (engine: Mattebox | null) => (() => void) | undefined,\n ): void {\n let off: (() => void) | undefined;\n const run = (): void => {\n off?.();\n off = fn(player.engine);\n };\n this.listen(player, ['sourcechange'], run);\n this.offs.push(() => {\n off?.();\n off = undefined;\n });\n run();\n }\n\n /** Runs `fn` when any of `names` changes on `target`, or under it with `subtree`, until detach. */\n protected observe(\n target: Element,\n names: readonly string[],\n fn: () => void,\n subtree = false,\n ): void {\n const observer = new MutationObserver(fn);\n observer.observe(target, { attributes: true, attributeFilter: [...names], subtree });\n this.offs.push(() => {\n observer.disconnect();\n });\n }\n\n /** The control is connected inside an upgraded player. Subscribe and render. */\n protected abstract attach(player: PlayerHost): void;\n\n /** The control left its player. Listeners are already gone; undo anything else. */\n protected detach(_player: PlayerHost): void {}\n\n /** Draws the current state. Called on every observed attribute change while attached. */\n protected render(): void {}\n}\n"],"mappings":";;AAqBA,IAAsB,YAAtB,cAAwC,YAAY;CAMlD,cAAc;EACZ,MAAM;EACN,KAAK,SAAS;EACd,KAAK,OAAO,CAAC;EACb,KAAK,QAAQ;CACf;CAEA,oBAA0B;EACxB,MAAM,QAAQ,WAAW,IAAI;EAC7B,IAAI,UAAU,MAAM;EACpB,KAAK,SAAS;EACd,MAAM,QAAQ,KAAK;EACnB,MAAM,eAAqB;GACzB,IAAI,UAAU,KAAK,SAAS,CAAC,KAAK,aAAa;GAE/C,eAAe,QAAQ,KAAK;GAC5B,IAAI,EAAE,WAAW,QAAQ;GACzB,KAAK,SAAS;GACd,KAAK,OAAO,KAAK,MAAM;EACzB;EACA,IAAI,WAAW,OAAO,OAAO;OACxB,eAAoB,YAAY,MAAM,CAAC,CAAC,KAAK,MAAM;CAC1D;CAEA,uBAA6B;EAC3B,KAAK,SAAS;EACd,KAAK,MAAM,OAAO,KAAK,MAAM,IAAI;EACjC,KAAK,OAAO,CAAC;EACb,MAAM,SAAS,KAAK;EACpB,IAAI,WAAW,MAAM;EACrB,KAAK,SAAS;EACd,KAAK,OAAO,MAAM;CACpB;CAEA,2BAAiC;EAC/B,IAAI,KAAK,WAAW,MAAM,KAAK,OAAO;CACxC;;CAGA,OAAiB,QAAqB,OAA0B,IAAsB;EACpF,KAAK,MAAM,QAAQ,OAAO,OAAO,iBAAiB,MAAM,EAAE;EAC1D,KAAK,KAAK,WAAW;GACnB,KAAK,MAAM,QAAQ,OAAO,OAAO,oBAAoB,MAAM,EAAE;EAC/D,CAAC;CACH;;CAGA,KAAe,KAAuB;EACpC,KAAK,KAAK,KAAK,GAAG;CACpB;;;;;;CAOA,OACE,QACA,IACM;EACN,IAAI;EACJ,MAAM,YAAkB;GACtB,MAAM;GACN,MAAM,GAAG,OAAO,MAAM;EACxB;EACA,KAAK,OAAO,QAAQ,CAAC,cAAc,GAAG,GAAG;EACzC,KAAK,KAAK,WAAW;GACnB,MAAM;GACN,MAAM,KAAA;EACR,CAAC;EACD,IAAI;CACN;;CAGA,QACE,QACA,OACA,IACA,UAAU,OACJ;EACN,MAAM,WAAW,IAAI,iBAAiB,EAAE;EACxC,SAAS,QAAQ,QAAQ;GAAE,YAAY;GAAM,iBAAiB,CAAC,GAAG,KAAK;GAAG;EAAQ,CAAC;EACnF,KAAK,KAAK,WAAW;GACnB,SAAS,WAAW;EACtB,CAAC;CACH;;CAMA,OAAiB,SAA2B,CAAC;;CAG7C,SAAyB,CAAC;AAC5B"}
@@ -4,43 +4,11 @@ import { icon } from "./icons.js";
4
4
  import { BUTTON_STYLE, SLIDER_STYLE, describe, el, fill, format, iconSlots, show, style } from "./shared.js";
5
5
  import { slider } from "./slider.js";
6
6
  //#region src/cast-screen.ts
7
+ const STYLE_CSS = ":host{color:var(--mbx-text);font:400 15px / 1.4 var(--mbx-font);text-align:center;background:#000000d9;justify-content:center;align-items:center;padding:16px;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}:host([hidden]){display:none}[part~=box]{flex-direction:column;align-items:center;width:100%;max-width:420px;display:flex}[part~=box]>:not([hidden])~:not([hidden]){margin-top:12px}[part~=title]{font-size:18px;font-weight:600}[part~=row]{justify-content:center;align-items:center;width:100%;display:flex}[part~=row]>:not([hidden])~:not([hidden]){margin-left:12px}[part~=slider]{flex:1}[part~=time]{font-variant-numeric:tabular-nums;color:var(--mbx-muted);font-size:13px}[part~=stop]{height:36px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:1px solid;padding:0 16px;font-weight:600}[part~=stop]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=stop]:focus:not(:focus-visible){outline:none}[hidden]{display:none}";
7
8
  const STATES = ["play", "pause"];
8
9
  const STEP = 5;
9
10
  const PAGE = 30;
10
- const STYLE = `${BUTTON_STYLE}
11
- ${SLIDER_STYLE}
12
- :host {
13
- position: absolute;
14
- inset: 0;
15
- display: flex;
16
- align-items: center;
17
- justify-content: center;
18
- padding: 16px;
19
- background: rgba(0, 0, 0, 0.85);
20
- color: var(--mbx-text);
21
- font: 400 15px/1.4 var(--mbx-font);
22
- text-align: center;
23
- }
24
- :host([hidden]) { display: none; }
25
- [part~="box"] { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(100%, 420px); }
26
- [part~="title"] { font-size: 18px; font-weight: 600; }
27
- [part~="row"] { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
28
- [part~="slider"] { flex: 1; }
29
- [part~="time"] { font-variant-numeric: tabular-nums; color: var(--mbx-muted); font-size: 13px; }
30
- [part~="stop"] {
31
- height: 36px;
32
- padding: 0 16px;
33
- font: inherit;
34
- font-weight: 600;
35
- color: inherit;
36
- background: transparent;
37
- border: 1px solid currentColor;
38
- border-radius: var(--mbx-radius);
39
- cursor: pointer;
40
- }
41
- [part~="stop"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
42
- [hidden] { display: none; }
43
- `;
11
+ const STYLE = BUTTON_STYLE + SLIDER_STYLE + STYLE_CSS;
44
12
  var MbxCastScreen = class extends Component {
45
13
  static get observedAttributes() {
46
14
  return [
@@ -7,67 +7,12 @@
7
7
  * package. The tokens come through the `--mbx-*` custom properties the
8
8
  * player sets, which inherit into every control.
9
9
  */
10
- const BUTTON_STYLE = `
11
- :host { display: inline-flex; }
12
- :host([hidden]) { display: none; }
13
- [part~="button"] {
14
- display: inline-flex;
15
- align-items: center;
16
- justify-content: center;
17
- flex: none;
18
- width: 40px;
19
- height: 40px;
20
- padding: 0;
21
- font: inherit;
22
- color: inherit;
23
- background: transparent;
24
- border: 0;
25
- border-radius: var(--mbx-radius);
26
- cursor: pointer;
27
- opacity: 0.9;
28
- }
29
- [part~="button"]:hover { opacity: 1; }
30
- [part~="button"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
31
- [part~="icon"], ::slotted(*) { width: 1.75em; height: 1.75em; fill: currentColor; }
32
- slot[hidden] { display: none; }
33
- `;
10
+ const BUTTON_STYLE_CSS = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:40px;height:40px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}";
11
+ const SLIDER_STYLE_CSS = ":host{display:block}:host([hidden]){display:none}[part~=slider]{border-radius:var(--mbx-radius);cursor:pointer;touch-action:none;height:40px;position:relative}[part~=slider]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=slider]:focus:not(:focus-visible){outline:none}[part~=rail]{position:absolute;top:0;bottom:0;left:8px;right:8px}[part~=track]{background:#ffffff59;border-radius:2px;height:4px;position:absolute;top:50%;left:0;right:0;overflow:hidden;transform:translateY(-50%)}[part~=fill]{background:var(--mbx-accent);position:absolute;top:0;bottom:0;left:0}[part~=thumb]{background:var(--mbx-text);pointer-events:none;border-radius:50%;width:12px;height:12px;margin:-6px 0 0 -6px;position:absolute;top:50%}";
12
+ const BUTTON_STYLE = BUTTON_STYLE_CSS;
34
13
  /** The style of a slider: the rail, the track with its fill, and the thumb. */
35
14
  /** The style of a slider: the rail, the track with its fill, and the thumb. */
36
- const SLIDER_STYLE = `
37
- :host { display: block; }
38
- :host([hidden]) { display: none; }
39
- [part~="slider"] {
40
- position: relative;
41
- height: 40px;
42
- border-radius: var(--mbx-radius);
43
- cursor: pointer;
44
- touch-action: none;
45
- }
46
- [part~="slider"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
47
- [part~="rail"] { position: absolute; top: 0; bottom: 0; left: 8px; right: 8px; }
48
- [part~="track"] {
49
- position: absolute;
50
- top: 50%;
51
- left: 0;
52
- right: 0;
53
- height: 4px;
54
- transform: translateY(-50%);
55
- background: rgba(255, 255, 255, 0.35);
56
- border-radius: 2px;
57
- overflow: hidden;
58
- }
59
- [part~="fill"] { position: absolute; top: 0; bottom: 0; left: 0; background: var(--mbx-accent); }
60
- [part~="thumb"] {
61
- position: absolute;
62
- top: 50%;
63
- width: 12px;
64
- height: 12px;
65
- margin: -6px 0 0 -6px;
66
- border-radius: 50%;
67
- background: var(--mbx-text);
68
- pointer-events: none;
69
- }
70
- `;
15
+ const SLIDER_STYLE = SLIDER_STYLE_CSS;
71
16
  /** A `<style>` with `text`, for a shadow root. */
72
17
  function style(text) {
73
18
  const node = document.createElement("style");
package/dist/host.js CHANGED
@@ -1,19 +1,21 @@
1
- export const PLAYER = 'mattebox-player';
1
+ //#region src/host.ts
2
+ const PLAYER = "mattebox-player";
2
3
  /** The parent, or the host of the shadow root `node` sits in, or null at the document. */
3
4
  function above(node) {
4
- const parent = node.parentNode;
5
- if (parent !== null)
6
- return parent;
7
- return node instanceof ShadowRoot ? node.host : null;
5
+ const parent = node.parentNode;
6
+ if (parent !== null) return parent;
7
+ return node instanceof ShadowRoot ? node.host : null;
8
8
  }
9
9
  /** The nearest player above `node`, or null outside one. It may not be upgraded yet. */
10
- export function findPlayer(node) {
11
- let current = node;
12
- while (current !== null) {
13
- if (current instanceof HTMLElement && current.localName === PLAYER)
14
- return current;
15
- current = above(current);
16
- }
17
- return null;
10
+ function findPlayer(node) {
11
+ let current = node;
12
+ while (current !== null) {
13
+ if (current instanceof HTMLElement && current.localName === "mattebox-player") return current;
14
+ current = above(current);
15
+ }
16
+ return null;
18
17
  }
18
+ //#endregion
19
+ export { PLAYER, findPlayer };
20
+
19
21
  //# sourceMappingURL=host.js.map
package/dist/host.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAAC;AAExC,0FAA0F;AAC1F,SAAS,KAAK,CAAC,IAAU;IACvB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;IAC/B,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IACnC,OAAO,IAAI,YAAY,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACvD,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,UAAU,CAAC,IAAU;IACnC,IAAI,OAAO,GAAgB,IAAI,CAAC;IAChC,OAAO,OAAO,KAAK,IAAI,EAAE,CAAC;QACxB,IAAI,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,SAAS,KAAK,MAAM;YAAE,OAAO,OAAO,CAAC;QACnF,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
1
+ {"version":3,"file":"host.js","names":[],"sources":["../src/host.ts"],"sourcesContent":["/**\n * The contract of a control of the page's own, as guide chapter 03 of the\n * player states it: the nearest <mattebox-player> above, through shadow\n * hosts, then read for `video`, `engine`, `player` and `error`, with\n * `sourcechange` heard on it. This package implements the contract from\n * outside, on purpose: the player exports no base class, and a control that\n * needs more than this surface has found a gap in the player's API.\n */\nimport type { PlayerHost } from '@mattebox/player';\n\nexport type { PlayerHost };\n\nexport const PLAYER = 'mattebox-player';\n\n/** The parent, or the host of the shadow root `node` sits in, or null at the document. */\nfunction above(node: Node): Node | null {\n const parent = node.parentNode;\n if (parent !== null) return parent;\n return node instanceof ShadowRoot ? node.host : null;\n}\n\n/** The nearest player above `node`, or null outside one. It may not be upgraded yet. */\nexport function findPlayer(node: Node): HTMLElement | null {\n let current: Node | null = node;\n while (current !== null) {\n if (current instanceof HTMLElement && current.localName === PLAYER) return current;\n current = above(current);\n }\n return null;\n}\n"],"mappings":";AAYA,MAAa,SAAS;;AAGtB,SAAS,MAAM,MAAyB;CACtC,MAAM,SAAS,KAAK;CACpB,IAAI,WAAW,MAAM,OAAO;CAC5B,OAAO,gBAAgB,aAAa,KAAK,OAAO;AAClD;;AAGA,SAAgB,WAAW,MAAgC;CACzD,IAAI,UAAuB;CAC3B,OAAO,YAAY,MAAM;EACvB,IAAI,mBAAmB,eAAe,QAAQ,cAAA,mBAAsB,OAAO;EAC3E,UAAU,MAAM,OAAO;CACzB;CACA,OAAO;AACT"}