html-video-element-webworker-polyfill 0.0.0-stage → 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-D-rmvsLs.js","names":[],"sources":["../src/host/video-host.ts"],"sourcesContent":["import {\n CHANNEL,\n COMMON_MIME_TYPES,\n type CanPlayTypeResult,\n type ClientMessage,\n type FrameMetadata,\n type HostMessage,\n MEDIA_EVENTS,\n MIRRORED_PROPERTIES,\n type MediaState,\n type MessageEndpoint,\n type Ranges,\n type SerializedError,\n isProtocolMessage,\n} from \"../shared/protocol.ts\";\nimport { assertMainThread, isMainThread, isMessageEndpoint } from \"../shared/environment.ts\";\n\nexport interface VideoHostOptions {\n container?: HTMLElement | null;\n onVideoCreated?: (video: HTMLVideoElement, id: number) => void;\n onVideoDisposed?: (video: HTMLVideoElement, id: number) => void;\n}\n\nexport interface VideoHost {\n readonly videos: ReadonlyMap<number, HTMLVideoElement>;\n dispose(): void;\n}\n\ntype Distribute<T> = T extends unknown ? Omit<T, typeof CHANNEL> : never;\ntype OutgoingHostMessage = Distribute<HostMessage>;\n\nconst FRAME_EVENTS = new Set([\"loadeddata\", \"seeked\"]);\n\nconst SILENT_STATE_POLL_INTERVAL = 16;\nconst SILENT_STATE_POLLS = 32;\n\ninterface Entry {\n video: HTMLVideoElement;\n frameCallback: number | null;\n frameInFlight: boolean;\n pendingFrame: { frame: VideoFrame; metadata: FrameMetadata } | null;\n sendPendingFrame: () => void;\n lastFrameTimestamp: number | null;\n frameDuration: number | null;\n detach: () => void;\n}\n\nconst FRAME_WAIT_TIMEOUT = 500;\nconst TIMESTAMP_EPSILON = 1000;\n\nconst hosted = new WeakSet<object>();\n\nexport function createVideoHost(endpoint: MessageEndpoint, options: VideoHostOptions = {}): VideoHost {\n assertMainThread(\"createVideoHost()\");\n if (!isMessageEndpoint(endpoint) || (isMainThread() && endpoint === (globalThis as object))) {\n throw new TypeError(\n \"html-video-element-webworker-polyfill: createVideoHost() expects the Worker (or a MessagePort connected to it) that uses the polyfill.\",\n );\n }\n if (hosted.has(endpoint)) {\n throw new DOMException(\n \"html-video-element-webworker-polyfill: createVideoHost() was already called for this endpoint; call dispose() on the existing host first.\",\n \"InvalidStateError\",\n );\n }\n hosted.add(endpoint);\n const entries = new Map<number, Entry>();\n const videos = new Map<number, HTMLVideoElement>();\n let ack = 0;\n let disposed = false;\n\n const sentNetworkState = new Map<number, number>();\n const post = (message: OutgoingHostMessage, transfer: Transferable[] = []): void => {\n if (disposed) {\n for (const item of transfer) (item as Partial<VideoFrame>).close?.();\n return;\n }\n if (\"state\" in message) sentNetworkState.set(message.id, message.state.networkState);\n endpoint.postMessage({ ...message, [CHANNEL]: 1 }, transfer);\n };\n\n const watching = new Map<number, { polls: number }>();\n const sendState = (id: number, video: HTMLVideoElement): void => {\n post({ kind: \"state\", id, ack, state: snapshot(video) });\n const existing = watching.get(id);\n if (existing) {\n existing.polls = 0;\n return;\n }\n const watch = { polls: 0 };\n watching.set(id, watch);\n const poll = (): void => {\n if (entries.get(id)?.video !== video || ++watch.polls > SILENT_STATE_POLLS) {\n watching.delete(id);\n return;\n }\n if (video.networkState !== sentNetworkState.get(id)) {\n post({ kind: \"state\", id, ack, state: snapshot(video) });\n }\n setTimeout(poll, SILENT_STATE_POLL_INTERVAL);\n };\n setTimeout(poll, SILENT_STATE_POLL_INTERVAL);\n };\n\n const welcome = (): void => {\n const probe = document.createElement(\"video\");\n const canPlayType: Record<string, CanPlayTypeResult> = {};\n for (const type of COMMON_MIME_TYPES) canPlayType[type] = probe.canPlayType(type);\n post({ kind: \"welcome\", timeOrigin: performance.timeOrigin, canPlayType });\n };\n\n const captureFrame = (entry: Entry): VideoFrame | null => {\n const { video } = entry;\n if (video.readyState < 2 || typeof VideoFrame !== \"function\") return null;\n try {\n return new VideoFrame(video);\n } catch {\n return null;\n }\n };\n\n const create = (id: number): void => {\n const video = document.createElement(\"video\");\n video.playsInline = true;\n const entry: Entry = {\n video,\n frameCallback: null,\n lastFrameTimestamp: null,\n frameInFlight: false,\n pendingFrame: null,\n sendPendingFrame: () => {},\n frameDuration: null,\n detach: () => {},\n };\n\n const noteFrame = (frame: VideoFrame): void => {\n entry.lastFrameTimestamp = frame.timestamp;\n };\n\n let previousPresented: { frames: number; timestamp: number } | null = null;\n const learnFrameDuration = (frame: VideoFrame, presentedFrames: number): void => {\n const previous = previousPresented;\n previousPresented = { frames: presentedFrames, timestamp: frame.timestamp };\n if (!previous || presentedFrames !== previous.frames + 1 || frame.timestamp <= previous.timestamp) return;\n const delta = frame.timestamp - previous.timestamp;\n entry.frameDuration = entry.frameDuration === null ? delta : Math.min(entry.frameDuration, delta);\n };\n\n const shows = (frame: VideoFrame, target: number): boolean => {\n if (!video.paused && frame.timestamp >= target - TIMESTAMP_EPSILON) return true;\n if (frame.timestamp > target + TIMESTAMP_EPSILON) return false;\n const duration = frame.duration || entry.frameDuration;\n if (duration) return target < frame.timestamp + duration + TIMESTAMP_EPSILON;\n return frame.timestamp !== entry.lastFrameTimestamp;\n };\n\n const dropPendingFrame = (): void => {\n entry.pendingFrame?.frame.close();\n entry.pendingFrame = null;\n };\n\n const sendFrame = (frame: VideoFrame, metadata: FrameMetadata): void => {\n entry.frameInFlight = true;\n post({ kind: \"frame\", id, ack, state: snapshot(video), frame, metadata }, [frame]);\n };\n\n entry.sendPendingFrame = () => {\n entry.frameInFlight = false;\n const pending = entry.pendingFrame;\n if (!pending) return;\n entry.pendingFrame = null;\n sendFrame(pending.frame, pending.metadata);\n };\n\n const sendEvent = (type: string, frame: VideoFrame | null): void => {\n if (frame || type === \"emptied\") dropPendingFrame();\n if (!frame) {\n if (type === \"emptied\") entry.lastFrameTimestamp = null;\n post({ kind: \"event\", id, ack, type, state: snapshot(video) });\n return;\n }\n noteFrame(frame);\n post({ kind: \"event\", id, ack, type, state: snapshot(video), frame, metadata: syntheticMetadata(video, frame) }, [\n frame,\n ]);\n };\n\n let held: { type: string; target: number; queue: string[]; timer: ReturnType<typeof setTimeout> } | null = null;\n\n const releaseHeld = (frame: VideoFrame | null): void => {\n if (!held) return;\n const { type, queue, timer } = held;\n held = null;\n clearTimeout(timer);\n sendEvent(type, frame);\n for (const queued of queue) dispatch(queued);\n };\n\n const dispatch = (type: string): void => {\n if (held) {\n held.queue.push(type);\n return;\n }\n if (!FRAME_EVENTS.has(type)) {\n sendEvent(type, null);\n return;\n }\n const frame = captureFrame(entry);\n const target = video.currentTime * 1e6;\n if (!frame || shows(frame, target)) {\n sendEvent(type, frame);\n return;\n }\n frame.close();\n held = { type, target, queue: [], timer: setTimeout(() => releaseHeld(captureFrame(entry)), FRAME_WAIT_TIMEOUT) };\n };\n\n const onEvent = (event: Event): void => dispatch(event.type);\n for (const type of MEDIA_EVENTS) video.addEventListener(type, onEvent);\n\n const onFrame = (_now: number, metadata: VideoFrameCallbackMetadata): void => {\n entry.frameCallback = video.requestVideoFrameCallback(onFrame);\n const frame = captureFrame(entry);\n if (!frame) return;\n learnFrameDuration(frame, metadata.presentedFrames);\n if (held) {\n if (shows(frame, held.target)) releaseHeld(frame);\n else frame.close();\n return;\n }\n if (frame.timestamp === entry.lastFrameTimestamp) {\n frame.close();\n return;\n }\n noteFrame(frame);\n if (entry.frameInFlight) {\n dropPendingFrame();\n entry.pendingFrame = { frame, metadata: toMetadata(metadata) };\n } else {\n sendFrame(frame, toMetadata(metadata));\n }\n };\n if (typeof video.requestVideoFrameCallback === \"function\") {\n entry.frameCallback = video.requestVideoFrameCallback(onFrame);\n }\n\n entry.detach = () => {\n dropPendingFrame();\n for (const type of MEDIA_EVENTS) video.removeEventListener(type, onEvent);\n if (entry.frameCallback !== null) video.cancelVideoFrameCallback(entry.frameCallback);\n if (held) clearTimeout(held.timer);\n held = null;\n };\n\n entries.set(id, entry);\n videos.set(id, video);\n options.container?.append(video);\n options.onVideoCreated?.(video, id);\n };\n\n const release = (id: number): void => {\n const entry = entries.get(id);\n if (!entry) return;\n entries.delete(id);\n videos.delete(id);\n sentNetworkState.delete(id);\n const { video } = entry;\n options.onVideoDisposed?.(video, id);\n entry.detach();\n video.pause();\n video.removeAttribute(\"src\");\n video.srcObject = null;\n video.load();\n video.remove();\n };\n\n const handle = (message: ClientMessage): void => {\n if (\"seq\" in message) ack = Math.max(ack, message.seq);\n switch (message.kind) {\n case \"hello\":\n welcome();\n return;\n case \"frameAck\":\n entries.get(message.id)?.sendPendingFrame();\n return;\n case \"canPlayType\":\n post({ kind: \"result\", callId: message.callId, value: probeCanPlayType(message.type) });\n return;\n case \"create\":\n create(message.id);\n break;\n case \"dispose\":\n release(message.id);\n return;\n case \"set\": {\n const video = entries.get(message.id)?.video;\n if (!video) return;\n applyProperty(video, message.prop, message.value);\n break;\n }\n case \"call\": {\n const video = entries.get(message.id)?.video;\n if (!video) {\n if (message.callId !== undefined) {\n post({\n kind: \"result\",\n callId: message.callId,\n error: { name: \"InvalidStateError\", message: \"The element has been disposed.\" },\n });\n }\n return;\n }\n invoke(video, message.method, message.args).then(\n (value) => message.callId !== undefined && post({ kind: \"result\", callId: message.callId, value }),\n (error: unknown) =>\n message.callId !== undefined &&\n post({ kind: \"result\", callId: message.callId, error: serializeError(error) }),\n );\n break;\n }\n }\n const video = entries.get(message.id)?.video;\n if (video) sendState(message.id, video);\n };\n\n const onMessage = (event: MessageEvent): void => {\n if (isProtocolMessage(event.data)) handle(event.data as ClientMessage);\n };\n endpoint.addEventListener(\"message\", onMessage);\n endpoint.start?.();\n welcome();\n\n return {\n videos,\n dispose() {\n if (disposed) return;\n for (const id of entries.keys()) release(id);\n endpoint.removeEventListener(\"message\", onMessage);\n hosted.delete(endpoint);\n disposed = true;\n },\n };\n}\n\nfunction applyProperty(video: HTMLVideoElement, prop: string, value: unknown): void {\n try {\n if (prop === \"src\") video.src = value as string;\n else if (prop === \"srcObject\") video.srcObject = value as MediaProvider | null;\n else if (prop === \"currentTime\") video.currentTime = value as number;\n else if (MIRRORED_PROPERTIES.includes(prop)) (video as unknown as Record<string, unknown>)[prop] = value;\n } catch (error) {\n console.warn(`[html-video-element-webworker-polyfill] failed to set \"${prop}\":`, error);\n }\n}\n\nasync function invoke(video: HTMLVideoElement, method: string, args: unknown[]): Promise<unknown> {\n switch (method) {\n case \"play\":\n await video.play();\n return undefined;\n case \"pause\":\n return video.pause();\n case \"load\":\n return video.load();\n case \"fastSeek\":\n if (typeof video.fastSeek === \"function\") video.fastSeek(args[0] as number);\n else video.currentTime = args[0] as number;\n return undefined;\n case \"removeAttribute\":\n return video.removeAttribute(args[0] as string);\n default:\n throw new DOMException(`Unknown method ${method}`, \"NotSupportedError\");\n }\n}\n\nlet canPlayTypeProbe: HTMLVideoElement | undefined;\nfunction probeCanPlayType(type: string): CanPlayTypeResult {\n canPlayTypeProbe ??= document.createElement(\"video\");\n return canPlayTypeProbe.canPlayType(type);\n}\n\nfunction ranges(timeRanges: TimeRanges): Ranges {\n const result: Ranges = [];\n for (let i = 0; i < timeRanges.length; i++) result.push([timeRanges.start(i), timeRanges.end(i)]);\n return result;\n}\n\nfunction snapshot(video: HTMLVideoElement): MediaState {\n const quality = typeof video.getVideoPlaybackQuality === \"function\" ? video.getVideoPlaybackQuality() : null;\n return {\n currentSrc: video.currentSrc,\n currentTime: video.currentTime,\n duration: video.duration,\n ended: video.ended,\n error: video.error ? { code: video.error.code, message: video.error.message } : null,\n muted: video.muted,\n networkState: video.networkState,\n paused: video.paused,\n playbackRate: video.playbackRate,\n readyState: video.readyState,\n seeking: video.seeking,\n videoHeight: video.videoHeight,\n videoWidth: video.videoWidth,\n volume: video.volume,\n buffered: ranges(video.buffered),\n played: ranges(video.played),\n seekable: ranges(video.seekable),\n quality: quality\n ? {\n creationTime: quality.creationTime,\n droppedVideoFrames: quality.droppedVideoFrames,\n totalVideoFrames: quality.totalVideoFrames,\n }\n : null,\n };\n}\n\nfunction toMetadata(metadata: VideoFrameCallbackMetadata): FrameMetadata {\n const result: FrameMetadata = {\n presentationTime: metadata.presentationTime,\n expectedDisplayTime: metadata.expectedDisplayTime,\n width: metadata.width,\n height: metadata.height,\n mediaTime: metadata.mediaTime,\n presentedFrames: metadata.presentedFrames,\n };\n if (metadata.processingDuration !== undefined) result.processingDuration = metadata.processingDuration;\n if (metadata.captureTime !== undefined) result.captureTime = metadata.captureTime;\n if (metadata.receiveTime !== undefined) result.receiveTime = metadata.receiveTime;\n if (metadata.rtpTimestamp !== undefined) result.rtpTimestamp = metadata.rtpTimestamp;\n return result;\n}\n\nfunction syntheticMetadata(video: HTMLVideoElement, frame: VideoFrame): FrameMetadata {\n const now = performance.now();\n const quality = typeof video.getVideoPlaybackQuality === \"function\" ? video.getVideoPlaybackQuality() : null;\n return {\n presentationTime: now,\n expectedDisplayTime: now,\n width: frame.displayWidth,\n height: frame.displayHeight,\n mediaTime: frame.timestamp / 1e6,\n presentedFrames: quality?.totalVideoFrames ?? 0,\n };\n}\n\nfunction serializeError(error: unknown): SerializedError {\n if (error instanceof Error || error instanceof DOMException) return { name: error.name, message: error.message };\n return { name: \"Error\", message: String(error) };\n}\n"],"mappings":";;;AA+BA,MAAM,+BAAe,IAAI,IAAI,CAAC,cAAc,QAAQ,CAAC;AAErD,MAAM,6BAA6B;AACnC,MAAM,qBAAqB;AAa3B,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB;AAE1B,MAAM,yBAAS,IAAI,QAAgB;AAEnC,SAAgB,gBAAgB,UAA2B,UAA4B,CAAC,GAAc;CACpG,iBAAiB,mBAAmB;CACpC,IAAI,CAAC,kBAAkB,QAAQ,KAAM,aAAa,KAAK,aAAc,YACnE,MAAM,IAAI,UACR,wIACF;CAEF,IAAI,OAAO,IAAI,QAAQ,GACrB,MAAM,IAAI,aACR,6IACA,mBACF;CAEF,OAAO,IAAI,QAAQ;CACnB,MAAM,0BAAU,IAAI,IAAmB;CACvC,MAAM,yBAAS,IAAI,IAA8B;CACjD,IAAI,MAAM;CACV,IAAI,WAAW;CAEf,MAAM,mCAAmB,IAAI,IAAoB;CACjD,MAAM,Q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YAAY;EAC7B,iBAAiB,SAAS,oBAAoB;CAChD;AACF;AAEA,SAAS,eAAe,OAAiC;CACvD,IAAI,iBAAiB,SAAS,iBAAiB,cAAc,OAAO;EAAE,MAAM,MAAM;EAAM,SAAS,MAAM;CAAQ;CAC/G,OAAO;EAAE,MAAM;EAAS,SAAS,OAAO,KAAK;CAAE;AACjD"}
package/dist/host.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { n as isMainThread, o as MessageEndpoint, r as isWorker, t as InvalidEnvironmentError } from "./environment-W_2WcDor.js";
2
+ import { n as VideoHostOptions, r as createVideoHost, t as VideoHost } from "./index-RizJW9Vb.js";
3
+ export { InvalidEnvironmentError, type MessageEndpoint, type VideoHost, type VideoHostOptions, createVideoHost, isMainThread, isWorker };
package/dist/host.js ADDED
@@ -0,0 +1,3 @@
1
+ import { i as isMainThread, o as isWorker, t as InvalidEnvironmentError } from "./environment-De2r8LaA.js";
2
+ import { t as createVideoHost } from "./host-D-rmvsLs.js";
3
+ export { InvalidEnvironmentError, createVideoHost, isMainThread, isWorker };
@@ -0,0 +1,5 @@
1
+ //#region src/polyfills/image-bitmap.d.ts
2
+ export declare function polyfillCreateImageBitmap(): void;
3
+ export declare function polyfillVideoFrame(): void;
4
+ //#endregion
5
+ //# sourceMappingURL=image-bitmap.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { r as assertWorker } from "./environment-De2r8LaA.js";
2
+ import { i as noFrameError, n as frameOf } from "./frame-source-BG--PzqD.js";
3
+ //#region src/polyfills/image-bitmap.ts
4
+ const PATCHED = Symbol.for("html-video-element-webworker-polyfill.patched");
5
+ function polyfillCreateImageBitmap() {
6
+ assertWorker("polyfillCreateImageBitmap()");
7
+ const scope = globalThis;
8
+ const original = scope.createImageBitmap;
9
+ if (typeof original !== "function" || original[PATCHED]) return;
10
+ const patched = function createImageBitmap(...args) {
11
+ const frame = frameOf(args[0]);
12
+ if (frame === null) return Promise.reject(noFrameError());
13
+ if (frame) args[0] = frame;
14
+ return original.apply(this, args);
15
+ };
16
+ patched[PATCHED] = true;
17
+ scope.createImageBitmap = patched;
18
+ }
19
+ function polyfillVideoFrame() {
20
+ assertWorker("polyfillVideoFrame()");
21
+ const scope = globalThis;
22
+ const original = scope.VideoFrame;
23
+ if (typeof original !== "function" || original[PATCHED]) return;
24
+ scope.VideoFrame = new Proxy(original, {
25
+ construct(target, args, newTarget) {
26
+ const frame = frameOf(args[0]);
27
+ if (frame === null) throw noFrameError();
28
+ if (frame) args[0] = frame;
29
+ return Reflect.construct(target, args, newTarget === scope.VideoFrame ? target : newTarget);
30
+ },
31
+ get(target, key, receiver) {
32
+ if (key === PATCHED) return true;
33
+ return Reflect.get(target, key, receiver);
34
+ }
35
+ });
36
+ }
37
+ //#endregion
38
+ export { polyfillCreateImageBitmap, polyfillVideoFrame };
39
+
40
+ //# sourceMappingURL=image-bitmap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-bitmap.js","names":[],"sources":["../src/polyfills/image-bitmap.ts"],"sourcesContent":["import { assertWorker } from \"../shared/environment.ts\";\nimport { frameOf, noFrameError } from \"../shared/frame-source.ts\";\n\nconst PATCHED: unique symbol = Symbol.for(\"html-video-element-webworker-polyfill.patched\") as never;\n\nexport function polyfillCreateImageBitmap(): void {\n assertWorker(\"polyfillCreateImageBitmap()\");\n const scope = globalThis as { createImageBitmap?: typeof createImageBitmap & { [PATCHED]?: true } };\n const original = scope.createImageBitmap;\n if (typeof original !== \"function\" || original[PATCHED]) return;\n const patched = function createImageBitmap(this: unknown, ...args: unknown[]): Promise<ImageBitmap> {\n const frame = frameOf(args[0]);\n if (frame === null) return Promise.reject(noFrameError());\n if (frame) args[0] = frame;\n return (original as (...args: unknown[]) => Promise<ImageBitmap>).apply(this, args);\n } as typeof createImageBitmap & { [PATCHED]?: true };\n patched[PATCHED] = true;\n scope.createImageBitmap = patched;\n}\n\nexport function polyfillVideoFrame(): void {\n assertWorker(\"polyfillVideoFrame()\");\n const scope = globalThis as { VideoFrame?: typeof VideoFrame & { [PATCHED]?: true } };\n const original = scope.VideoFrame;\n if (typeof original !== \"function\" || original[PATCHED]) return;\n scope.VideoFrame = new Proxy(original, {\n construct(target, args: unknown[], newTarget) {\n const frame = frameOf(args[0]);\n if (frame === null) throw noFrameError();\n if (frame) args[0] = frame;\n return Reflect.construct(target, args, newTarget === scope.VideoFrame ? target : newTarget) as object;\n },\n get(target, key, receiver) {\n if (key === PATCHED) return true;\n return Reflect.get(target, key, receiver) as unknown;\n },\n });\n}\n"],"mappings":";;;AAGA,MAAM,UAAyB,OAAO,IAAI,+CAA+C;AAEzF,SAAgB,4BAAkC;CAChD,aAAa,6BAA6B;CAC1C,MAAM,QAAQ;CACd,MAAM,WAAW,MAAM;CACvB,IAAI,OAAO,aAAa,cAAc,SAAS,UAAU;CACzD,MAAM,UAAU,SAAS,kBAAiC,GAAG,MAAuC;EAClG,MAAM,QAAQ,QAAQ,KAAK,EAAE;EAC7B,IAAI,UAAU,MAAM,OAAO,QAAQ,OAAO,aAAa,CAAC;EACxD,IAAI,OAAO,KAAK,KAAK;EACrB,OAAQ,SAA0D,MAAM,MAAM,IAAI;CACpF;CACA,QAAQ,WAAW;CACnB,MAAM,oBAAoB;AAC5B;AAEA,SAAgB,qBAA2B;CACzC,aAAa,sBAAsB;CACnC,MAAM,QAAQ;CACd,MAAM,WAAW,MAAM;CACvB,IAAI,OAAO,aAAa,cAAc,SAAS,UAAU;CACzD,MAAM,aAAa,IAAI,MAAM,UAAU;EACrC,UAAU,QAAQ,MAAiB,WAAW;GAC5C,MAAM,QAAQ,QAAQ,KAAK,EAAE;GAC7B,IAAI,UAAU,MAAM,MAAM,aAAa;GACvC,IAAI,OAAO,KAAK,KAAK;GACrB,OAAO,QAAQ,UAAU,QAAQ,MAAM,cAAc,MAAM,aAAa,SAAS,SAAS;EAC5F;EACA,IAAI,QAAQ,KAAK,UAAU;GACzB,IAAI,QAAQ,SAAS,OAAO;GAC5B,OAAO,QAAQ,IAAI,QAAQ,KAAK,QAAQ;EAC1C;CACF,CAAC;AACH"}
@@ -0,0 +1,186 @@
1
+ import { a as FrameMetadata, c as SerializedMediaError, i as CanPlayTypeResult, o as MessageEndpoint, s as Ranges } from "./environment-W_2WcDor.js";
2
+ //#region src/worker/bridge.d.ts
3
+ declare function configureVideoTransport(endpoint: MessageEndpoint): void;
4
+ //#endregion
5
+ //#region src/shared/frame-source.d.ts
6
+ declare const FRAME_SOURCE: unique symbol;
7
+ interface FrameSource {
8
+ readonly [FRAME_SOURCE]: () => VideoFrame | null;
9
+ }
10
+ declare function isFrameSource(value: unknown): value is FrameSource;
11
+ declare function frameOf(value: unknown): VideoFrame | null | undefined;
12
+ //#endregion
13
+ //#region src/worker/video-element.d.ts
14
+ interface CreateVideoElementOptions {
15
+ transport?: MessageEndpoint;
16
+ }
17
+ type VideoFrameRequestCallback = (now: number, metadata: FrameMetadata) => void;
18
+ type EventHandler = ((this: WorkerVideoElement, event: Event) => unknown) | null;
19
+ interface MirroredProps {
20
+ autoplay: boolean;
21
+ controls: boolean;
22
+ crossOrigin: string | null;
23
+ defaultMuted: boolean;
24
+ defaultPlaybackRate: number;
25
+ disablePictureInPicture: boolean;
26
+ disableRemotePlayback: boolean;
27
+ height: number;
28
+ loop: boolean;
29
+ playsInline: boolean;
30
+ poster: string;
31
+ preload: "" | "none" | "metadata" | "auto";
32
+ preservesPitch: boolean;
33
+ width: number;
34
+ }
35
+ declare class WorkerVideoElement extends EventTarget {
36
+ #private;
37
+ static readonly NETWORK_EMPTY: 0;
38
+ static readonly NETWORK_IDLE: 1;
39
+ static readonly NETWORK_LOADING: 2;
40
+ static readonly NETWORK_NO_SOURCE: 3;
41
+ static readonly HAVE_NOTHING: 0;
42
+ static readonly HAVE_METADATA: 1;
43
+ static readonly HAVE_CURRENT_DATA: 2;
44
+ static readonly HAVE_FUTURE_DATA: 3;
45
+ static readonly HAVE_ENOUGH_DATA: 4;
46
+ readonly NETWORK_EMPTY: 0;
47
+ readonly NETWORK_IDLE: 1;
48
+ readonly NETWORK_LOADING: 2;
49
+ readonly NETWORK_NO_SOURCE: 3;
50
+ readonly HAVE_NOTHING: 0;
51
+ readonly HAVE_METADATA: 1;
52
+ readonly HAVE_CURRENT_DATA: 2;
53
+ readonly HAVE_FUTURE_DATA: 3;
54
+ readonly HAVE_ENOUGH_DATA: 4;
55
+ readonly tagName: "VIDEO";
56
+ readonly nodeName: "VIDEO";
57
+ readonly localName: "video";
58
+ constructor(options?: CreateVideoElementOptions);
59
+ get currentFrame(): VideoFrame | null;
60
+ get disposed(): boolean;
61
+ dispose(): void;
62
+ [Symbol.dispose](): void;
63
+ get src(): string;
64
+ set src(value: string);
65
+ get srcObject(): unknown;
66
+ set srcObject(value: unknown);
67
+ get currentSrc(): string;
68
+ get duration(): number;
69
+ get paused(): boolean;
70
+ get ended(): boolean;
71
+ get seeking(): boolean;
72
+ get readyState(): number;
73
+ get networkState(): number;
74
+ get videoWidth(): number;
75
+ get videoHeight(): number;
76
+ get error(): MediaError | null;
77
+ get buffered(): TimeRanges;
78
+ get played(): TimeRanges;
79
+ get seekable(): TimeRanges;
80
+ get currentTime(): number;
81
+ set currentTime(value: number);
82
+ fastSeek(time: number): void;
83
+ get volume(): number;
84
+ set volume(value: number);
85
+ get muted(): boolean;
86
+ set muted(value: boolean);
87
+ get playbackRate(): number;
88
+ set playbackRate(value: number);
89
+ get autoplay(): boolean;
90
+ set autoplay(value: boolean);
91
+ get controls(): boolean;
92
+ set controls(value: boolean);
93
+ get crossOrigin(): string | null;
94
+ set crossOrigin(value: string | null);
95
+ get defaultMuted(): boolean;
96
+ set defaultMuted(value: boolean);
97
+ get defaultPlaybackRate(): number;
98
+ set defaultPlaybackRate(value: number);
99
+ get disablePictureInPicture(): boolean;
100
+ set disablePictureInPicture(value: boolean);
101
+ get disableRemotePlayback(): boolean;
102
+ set disableRemotePlayback(value: boolean);
103
+ get height(): number;
104
+ set height(value: number);
105
+ get width(): number;
106
+ set width(value: number);
107
+ get loop(): boolean;
108
+ set loop(value: boolean);
109
+ get playsInline(): boolean;
110
+ set playsInline(value: boolean);
111
+ get poster(): string;
112
+ set poster(value: string);
113
+ get preload(): MirroredProps["preload"];
114
+ set preload(value: MirroredProps["preload"]);
115
+ get preservesPitch(): boolean;
116
+ set preservesPitch(value: boolean);
117
+ getAttribute(name: string): string | null;
118
+ hasAttribute(name: string): boolean;
119
+ setAttribute(name: string, value: string): void;
120
+ removeAttribute(name: string): void;
121
+ play(): Promise<void>;
122
+ pause(): void;
123
+ load(): void;
124
+ canPlayType(type: string): CanPlayTypeResult;
125
+ getVideoPlaybackQuality(): VideoPlaybackQuality;
126
+ requestVideoFrameCallback(callback: VideoFrameRequestCallback): number;
127
+ cancelVideoFrameCallback(handle: number): void;
128
+ requestPictureInPicture(): Promise<never>;
129
+ }
130
+ interface WorkerVideoElement {
131
+ [FRAME_SOURCE](): VideoFrame | null;
132
+ onabort: EventHandler;
133
+ oncanplay: EventHandler;
134
+ oncanplaythrough: EventHandler;
135
+ ondurationchange: EventHandler;
136
+ onemptied: EventHandler;
137
+ onencrypted: EventHandler;
138
+ onended: EventHandler;
139
+ onerror: EventHandler;
140
+ onloadeddata: EventHandler;
141
+ onloadedmetadata: EventHandler;
142
+ onloadstart: EventHandler;
143
+ onpause: EventHandler;
144
+ onplay: EventHandler;
145
+ onplaying: EventHandler;
146
+ onprogress: EventHandler;
147
+ onratechange: EventHandler;
148
+ onresize: EventHandler;
149
+ onseeked: EventHandler;
150
+ onseeking: EventHandler;
151
+ onstalled: EventHandler;
152
+ onsuspend: EventHandler;
153
+ ontimeupdate: EventHandler;
154
+ onvolumechange: EventHandler;
155
+ onwaiting: EventHandler;
156
+ onwaitingforkey: EventHandler;
157
+ }
158
+ declare function createVideoElement(options?: CreateVideoElementOptions): WorkerVideoElement;
159
+ //#endregion
160
+ //#region src/worker/document.d.ts
161
+ declare function polyfillDocument(options?: CreateVideoElementOptions): void;
162
+ //#endregion
163
+ //#region src/worker/media-types.d.ts
164
+ declare class WorkerTimeRanges implements TimeRanges {
165
+ #private;
166
+ constructor(ranges?: Ranges);
167
+ get length(): number;
168
+ start(index: number): number;
169
+ end(index: number): number;
170
+ }
171
+ declare class WorkerMediaError implements MediaError {
172
+ static readonly MEDIA_ERR_ABORTED: 1;
173
+ static readonly MEDIA_ERR_NETWORK: 2;
174
+ static readonly MEDIA_ERR_DECODE: 3;
175
+ static readonly MEDIA_ERR_SRC_NOT_SUPPORTED: 4;
176
+ readonly MEDIA_ERR_ABORTED: 1;
177
+ readonly MEDIA_ERR_NETWORK: 2;
178
+ readonly MEDIA_ERR_DECODE: 3;
179
+ readonly MEDIA_ERR_SRC_NOT_SUPPORTED: 4;
180
+ readonly code: number;
181
+ readonly message: string;
182
+ constructor({ code, message }: SerializedMediaError);
183
+ }
184
+ //#endregion
185
+ export { VideoFrameRequestCallback as a, FRAME_SOURCE as c, isFrameSource as d, configureVideoTransport as f, CreateVideoElementOptions as i, FrameSource as l, WorkerTimeRanges as n, WorkerVideoElement as o, polyfillDocument as r, createVideoElement as s, WorkerMediaError as t, frameOf as u };
186
+ //# sourceMappingURL=index-B9gWpxKE.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { o as MessageEndpoint } from "./environment-W_2WcDor.js";
2
+ //#region src/host/video-host.d.ts
3
+ interface VideoHostOptions {
4
+ container?: HTMLElement | null;
5
+ onVideoCreated?: (video: HTMLVideoElement, id: number) => void;
6
+ onVideoDisposed?: (video: HTMLVideoElement, id: number) => void;
7
+ }
8
+ interface VideoHost {
9
+ readonly videos: ReadonlyMap<number, HTMLVideoElement>;
10
+ dispose(): void;
11
+ }
12
+ declare function createVideoHost(endpoint: MessageEndpoint, options?: VideoHostOptions): VideoHost;
13
+ //#endregion
14
+ export { VideoHostOptions as n, createVideoHost as r, VideoHost as t };
15
+ //# sourceMappingURL=index-RizJW9Vb.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { a as FrameMetadata, n as isMainThread, o as MessageEndpoint, r as isWorker, t as InvalidEnvironmentError } from "./environment-W_2WcDor.js";
2
+ import { n as VideoHostOptions, r as createVideoHost, t as VideoHost } from "./index-RizJW9Vb.js";
3
+ import { a as VideoFrameRequestCallback, c as FRAME_SOURCE, d as isFrameSource, f as configureVideoTransport, i as CreateVideoElementOptions, l as FrameSource, n as WorkerTimeRanges, o as WorkerVideoElement, r as polyfillDocument, s as createVideoElement, t as WorkerMediaError, u as frameOf } from "./index-B9gWpxKE.js";
4
+ import { polyfill2dCanvasApi } from "./canvas2d.js";
5
+ import { polyfillWebglAPI } from "./webgl.js";
6
+ import { polyfillWebgpu } from "./webgpu.js";
7
+ import { polyfillCreateImageBitmap, polyfillVideoFrame } from "./image-bitmap.js";
8
+ //#region src/install.d.ts
9
+ export declare function installWorkerPolyfills(): void;
10
+ //#endregion
11
+ export { type CreateVideoElementOptions, FRAME_SOURCE, type FrameMetadata, type FrameSource, InvalidEnvironmentError, type MessageEndpoint, type VideoFrameRequestCallback, type VideoHost, type VideoHostOptions, WorkerMediaError, WorkerTimeRanges, WorkerVideoElement, configureVideoTransport, createVideoElement, createVideoHost, frameOf, isFrameSource, isMainThread, isWorker, polyfill2dCanvasApi, polyfillCreateImageBitmap, polyfillDocument, polyfillVideoFrame, polyfillWebglAPI, polyfillWebgpu };
12
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import { i as isMainThread, o as isWorker, t as InvalidEnvironmentError } from "./environment-De2r8LaA.js";
2
+ import { t as createVideoHost } from "./host-D-rmvsLs.js";
3
+ import { a as WorkerTimeRanges, i as WorkerMediaError, n as WorkerVideoElement, o as configureVideoTransport, r as createVideoElement, t as polyfillDocument } from "./document-GIe-DKmi.js";
4
+ import { n as frameOf, r as isFrameSource, t as FRAME_SOURCE } from "./frame-source-BG--PzqD.js";
5
+ import "./worker.js";
6
+ import { polyfill2dCanvasApi } from "./canvas2d.js";
7
+ import { polyfillWebglAPI } from "./webgl.js";
8
+ import { polyfillWebgpu } from "./webgpu.js";
9
+ import { polyfillCreateImageBitmap, polyfillVideoFrame } from "./image-bitmap.js";
10
+ import { t as installWorkerPolyfills } from "./install-BDVttfHM.js";
11
+ export { FRAME_SOURCE, InvalidEnvironmentError, WorkerMediaError, WorkerTimeRanges, WorkerVideoElement, configureVideoTransport, createVideoElement, createVideoHost, frameOf, installWorkerPolyfills, isFrameSource, isMainThread, isWorker, polyfill2dCanvasApi, polyfillCreateImageBitmap, polyfillDocument, polyfillVideoFrame, polyfillWebglAPI, polyfillWebgpu };
@@ -0,0 +1,20 @@
1
+ import { r as assertWorker } from "./environment-De2r8LaA.js";
2
+ import { t as polyfillDocument } from "./document-GIe-DKmi.js";
3
+ import { polyfill2dCanvasApi } from "./canvas2d.js";
4
+ import { polyfillWebglAPI } from "./webgl.js";
5
+ import { polyfillWebgpu } from "./webgpu.js";
6
+ import { polyfillCreateImageBitmap, polyfillVideoFrame } from "./image-bitmap.js";
7
+ //#region src/install.ts
8
+ function installWorkerPolyfills() {
9
+ assertWorker("installWorkerPolyfills()");
10
+ polyfillDocument();
11
+ polyfill2dCanvasApi();
12
+ polyfillWebglAPI();
13
+ polyfillWebgpu();
14
+ polyfillCreateImageBitmap();
15
+ polyfillVideoFrame();
16
+ }
17
+ //#endregion
18
+ export { installWorkerPolyfills as t };
19
+
20
+ //# sourceMappingURL=install-BDVttfHM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-BDVttfHM.js","names":[],"sources":["../src/install.ts"],"sourcesContent":["import { polyfill2dCanvasApi } from \"./polyfills/canvas2d.ts\";\nimport { polyfillCreateImageBitmap, polyfillVideoFrame } from \"./polyfills/image-bitmap.ts\";\nimport { polyfillWebglAPI } from \"./polyfills/webgl.ts\";\nimport { polyfillWebgpu } from \"./polyfills/webgpu.ts\";\nimport { polyfillDocument } from \"./worker/document.ts\";\nimport { assertWorker } from \"./shared/environment.ts\";\n\nexport function installWorkerPolyfills(): void {\n assertWorker(\"installWorkerPolyfills()\");\n polyfillDocument();\n polyfill2dCanvasApi();\n polyfillWebglAPI();\n polyfillWebgpu();\n polyfillCreateImageBitmap();\n polyfillVideoFrame();\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,yBAA+B;CAC7C,aAAa,0BAA0B;CACvC,iBAAiB;CACjB,oBAAoB;CACpB,iBAAiB;CACjB,eAAe;CACf,0BAA0B;CAC1B,mBAAmB;AACrB"}
@@ -0,0 +1,79 @@
1
+ //#region src/shared/protocol.ts
2
+ const CHANNEL = "__htmlVideoElementWorkerPolyfill";
3
+ const MEDIA_EVENTS = [
4
+ "abort",
5
+ "canplay",
6
+ "canplaythrough",
7
+ "durationchange",
8
+ "emptied",
9
+ "encrypted",
10
+ "ended",
11
+ "error",
12
+ "loadeddata",
13
+ "loadedmetadata",
14
+ "loadstart",
15
+ "pause",
16
+ "play",
17
+ "playing",
18
+ "progress",
19
+ "ratechange",
20
+ "resize",
21
+ "seeked",
22
+ "seeking",
23
+ "stalled",
24
+ "suspend",
25
+ "timeupdate",
26
+ "volumechange",
27
+ "waiting",
28
+ "waitingforkey"
29
+ ];
30
+ const MIRRORED_PROPERTIES = [
31
+ "autoplay",
32
+ "controls",
33
+ "crossOrigin",
34
+ "defaultMuted",
35
+ "defaultPlaybackRate",
36
+ "disablePictureInPicture",
37
+ "disableRemotePlayback",
38
+ "height",
39
+ "loop",
40
+ "muted",
41
+ "playbackRate",
42
+ "playsInline",
43
+ "poster",
44
+ "preload",
45
+ "preservesPitch",
46
+ "volume",
47
+ "width"
48
+ ];
49
+ function isProtocolMessage(data) {
50
+ return typeof data === "object" && data !== null && data["__htmlVideoElementWorkerPolyfill"] === 1;
51
+ }
52
+ const COMMON_MIME_TYPES = [
53
+ "video/mp4",
54
+ "video/webm",
55
+ "video/ogg",
56
+ "video/quicktime",
57
+ "video/x-matroska",
58
+ "application/vnd.apple.mpegurl",
59
+ "video/mp4; codecs=\"avc1.42E01E\"",
60
+ "video/mp4; codecs=\"avc1.4D401E\"",
61
+ "video/mp4; codecs=\"avc1.64001E\"",
62
+ "video/mp4; codecs=\"hvc1.1.6.L93.B0\"",
63
+ "video/mp4; codecs=\"av01.0.05M.08\"",
64
+ "video/mp4; codecs=\"vp09.00.10.08\"",
65
+ "video/webm; codecs=\"vp8\"",
66
+ "video/webm; codecs=\"vp9\"",
67
+ "video/webm; codecs=\"av01.0.05M.08\"",
68
+ "video/ogg; codecs=\"theora\"",
69
+ "audio/mpeg",
70
+ "audio/mp4",
71
+ "audio/ogg",
72
+ "audio/webm",
73
+ "audio/wav",
74
+ "audio/flac"
75
+ ];
76
+ //#endregion
77
+ export { isProtocolMessage as a, MIRRORED_PROPERTIES as i, COMMON_MIME_TYPES as n, MEDIA_EVENTS as r, CHANNEL as t };
78
+
79
+ //# sourceMappingURL=protocol-Be-N8xdd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol-Be-N8xdd.js","names":[],"sources":["../src/shared/protocol.ts"],"sourcesContent":["export const CHANNEL = \"__htmlVideoElementWorkerPolyfill\" as const;\n\nexport const MEDIA_EVENTS: readonly string[] = [\n \"abort\",\n \"canplay\",\n \"canplaythrough\",\n \"durationchange\",\n \"emptied\",\n \"encrypted\",\n \"ended\",\n \"error\",\n \"loadeddata\",\n \"loadedmetadata\",\n \"loadstart\",\n \"pause\",\n \"play\",\n \"playing\",\n \"progress\",\n \"ratechange\",\n \"resize\",\n \"seeked\",\n \"seeking\",\n \"stalled\",\n \"suspend\",\n \"timeupdate\",\n \"volumechange\",\n \"waiting\",\n \"waitingforkey\",\n];\n\nexport const MIRRORED_PROPERTIES: readonly string[] = [\n \"autoplay\",\n \"controls\",\n \"crossOrigin\",\n \"defaultMuted\",\n \"defaultPlaybackRate\",\n \"disablePictureInPicture\",\n \"disableRemotePlayback\",\n \"height\",\n \"loop\",\n \"muted\",\n \"playbackRate\",\n \"playsInline\",\n \"poster\",\n \"preload\",\n \"preservesPitch\",\n \"volume\",\n \"width\",\n];\n\nexport type Ranges = Array<[start: number, end: number]>;\n\nexport interface SerializedMediaError {\n code: number;\n message: string;\n}\n\nexport interface SerializedPlaybackQuality {\n creationTime: number;\n droppedVideoFrames: number;\n totalVideoFrames: number;\n}\n\nexport interface MediaState {\n currentSrc: string;\n currentTime: number;\n duration: number;\n ended: boolean;\n error: SerializedMediaError | null;\n muted: boolean;\n networkState: number;\n paused: boolean;\n playbackRate: number;\n readyState: number;\n seeking: boolean;\n videoHeight: number;\n videoWidth: number;\n volume: number;\n buffered: Ranges;\n played: Ranges;\n seekable: Ranges;\n quality: SerializedPlaybackQuality | null;\n}\n\nexport interface FrameMetadata {\n presentationTime: number;\n expectedDisplayTime: number;\n width: number;\n height: number;\n mediaTime: number;\n presentedFrames: number;\n processingDuration?: number;\n captureTime?: number;\n receiveTime?: number;\n rtpTimestamp?: number;\n}\n\nexport interface SerializedError {\n name: string;\n message: string;\n}\n\nexport type ClientMessage =\n | { [CHANNEL]: 1; kind: \"create\"; id: number; seq: number; props: Record<string, unknown> }\n | { [CHANNEL]: 1; kind: \"set\"; id: number; seq: number; prop: string; value: unknown }\n | {\n [CHANNEL]: 1;\n kind: \"call\";\n id: number;\n seq: number;\n method: \"play\" | \"pause\" | \"load\" | \"fastSeek\" | \"removeAttribute\";\n args: unknown[];\n callId?: number;\n }\n | { [CHANNEL]: 1; kind: \"dispose\"; id: number; seq: number }\n | { [CHANNEL]: 1; kind: \"canPlayType\"; type: string; callId: number }\n | { [CHANNEL]: 1; kind: \"frameAck\"; id: number; seq: number }\n | { [CHANNEL]: 1; kind: \"hello\" };\n\nexport type HostMessage =\n | {\n [CHANNEL]: 1;\n kind: \"event\";\n id: number;\n ack: number;\n type: string;\n state: MediaState;\n frame?: VideoFrame;\n metadata?: FrameMetadata;\n }\n | {\n [CHANNEL]: 1;\n kind: \"frame\";\n id: number;\n ack: number;\n state: MediaState;\n frame: VideoFrame;\n metadata: FrameMetadata;\n }\n | { [CHANNEL]: 1; kind: \"state\"; id: number; ack: number; state: MediaState }\n | { [CHANNEL]: 1; kind: \"result\"; callId: number; value?: unknown; error?: SerializedError }\n | {\n [CHANNEL]: 1;\n kind: \"welcome\";\n timeOrigin: number;\n canPlayType: Record<string, CanPlayTypeResult>;\n };\n\nexport type CanPlayTypeResult = \"\" | \"maybe\" | \"probably\";\n\nexport interface MessageEndpoint {\n postMessage(message: unknown, transfer: Transferable[]): void;\n addEventListener(type: \"message\", listener: (event: MessageEvent) => void): void;\n removeEventListener(type: \"message\", listener: (event: MessageEvent) => void): void;\n start?: () => void;\n}\n\nexport function isProtocolMessage(data: unknown): boolean {\n return typeof data === \"object\" && data !== null && (data as Record<string, unknown>)[CHANNEL] === 1;\n}\n\nexport const COMMON_MIME_TYPES: readonly string[] = [\n \"video/mp4\",\n \"video/webm\",\n \"video/ogg\",\n \"video/quicktime\",\n \"video/x-matroska\",\n \"application/vnd.apple.mpegurl\",\n 'video/mp4; codecs=\"avc1.42E01E\"',\n 'video/mp4; codecs=\"avc1.4D401E\"',\n 'video/mp4; codecs=\"avc1.64001E\"',\n 'video/mp4; codecs=\"hvc1.1.6.L93.B0\"',\n 'video/mp4; codecs=\"av01.0.05M.08\"',\n 'video/mp4; codecs=\"vp09.00.10.08\"',\n 'video/webm; codecs=\"vp8\"',\n 'video/webm; codecs=\"vp9\"',\n 'video/webm; codecs=\"av01.0.05M.08\"',\n 'video/ogg; codecs=\"theora\"',\n \"audio/mpeg\",\n \"audio/mp4\",\n \"audio/ogg\",\n \"audio/webm\",\n \"audio/wav\",\n \"audio/flac\",\n];\n"],"mappings":";AAAA,MAAa,UAAU;AAEvB,MAAa,eAAkC;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,sBAAyC;CACpD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AA6GA,SAAgB,kBAAkB,MAAwB;CACxD,OAAO,OAAO,SAAS,YAAY,SAAS,QAAS,KAAA,wCAA8C;AACrG;AAEA,MAAa,oBAAuC;CAClD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -0,0 +1,4 @@
1
+ //#region src/polyfills/webgl.d.ts
2
+ export declare function polyfillWebglAPI(): void;
3
+ //#endregion
4
+ //# sourceMappingURL=webgl.d.ts.map
package/dist/webgl.js ADDED
@@ -0,0 +1,18 @@
1
+ import { r as assertWorker } from "./environment-De2r8LaA.js";
2
+ import { a as patchMethod, o as unwrapArgs } from "./frame-source-BG--PzqD.js";
3
+ //#region src/polyfills/webgl.ts
4
+ const UPLOAD_METHODS = [
5
+ "texImage2D",
6
+ "texSubImage2D",
7
+ "texImage3D",
8
+ "texSubImage3D"
9
+ ];
10
+ function polyfillWebglAPI() {
11
+ assertWorker("polyfillWebglAPI()");
12
+ const scope = globalThis;
13
+ for (const ctor of [scope.WebGLRenderingContext, scope.WebGL2RenderingContext]) for (const method of UPLOAD_METHODS) patchMethod(ctor?.prototype, method, unwrapArgs);
14
+ }
15
+ //#endregion
16
+ export { polyfillWebglAPI };
17
+
18
+ //# sourceMappingURL=webgl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl.js","names":[],"sources":["../src/polyfills/webgl.ts"],"sourcesContent":["import { assertWorker } from \"../shared/environment.ts\";\nimport { patchMethod, unwrapArgs } from \"../shared/frame-source.ts\";\n\nconst UPLOAD_METHODS = [\"texImage2D\", \"texSubImage2D\", \"texImage3D\", \"texSubImage3D\"] as const;\n\nexport function polyfillWebglAPI(): void {\n assertWorker(\"polyfillWebglAPI()\");\n const scope = globalThis as {\n WebGLRenderingContext?: { prototype: object };\n WebGL2RenderingContext?: { prototype: object };\n };\n for (const ctor of [scope.WebGLRenderingContext, scope.WebGL2RenderingContext]) {\n for (const method of UPLOAD_METHODS) patchMethod(ctor?.prototype, method, unwrapArgs);\n }\n}\n"],"mappings":";;;AAGA,MAAM,iBAAiB;CAAC;CAAc;CAAiB;CAAc;AAAe;AAEpF,SAAgB,mBAAyB;CACvC,aAAa,oBAAoB;CACjC,MAAM,QAAQ;CAId,KAAK,MAAM,QAAQ,CAAC,MAAM,uBAAuB,MAAM,sBAAsB,GAC3E,KAAK,MAAM,UAAU,gBAAgB,YAAY,MAAM,WAAW,QAAQ,UAAU;AAExF"}
@@ -0,0 +1,4 @@
1
+ //#region src/polyfills/webgpu.d.ts
2
+ export declare function polyfillWebgpu(): void;
3
+ //#endregion
4
+ //# sourceMappingURL=webgpu.d.ts.map
package/dist/webgpu.js ADDED
@@ -0,0 +1,24 @@
1
+ import { r as assertWorker } from "./environment-De2r8LaA.js";
2
+ import { a as patchMethod, i as noFrameError, n as frameOf } from "./frame-source-BG--PzqD.js";
3
+ //#region src/polyfills/webgpu.ts
4
+ function polyfillWebgpu() {
5
+ assertWorker("polyfillWebgpu()");
6
+ const scope = globalThis;
7
+ patchMethod(scope.GPUQueue?.prototype, "copyExternalImageToTexture", unwrapSourceDescriptor);
8
+ patchMethod(scope.GPUDevice?.prototype, "importExternalTexture", unwrapSourceDescriptor);
9
+ }
10
+ function unwrapSourceDescriptor(args) {
11
+ const descriptor = args[0];
12
+ const frame = frameOf(descriptor?.source);
13
+ if (frame === void 0) return true;
14
+ if (frame === null) throw noFrameError();
15
+ args[0] = {
16
+ ...descriptor,
17
+ source: frame
18
+ };
19
+ return true;
20
+ }
21
+ //#endregion
22
+ export { polyfillWebgpu };
23
+
24
+ //# sourceMappingURL=webgpu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgpu.js","names":[],"sources":["../src/polyfills/webgpu.ts"],"sourcesContent":["import { assertWorker } from \"../shared/environment.ts\";\nimport { frameOf, noFrameError, patchMethod } from \"../shared/frame-source.ts\";\n\nexport function polyfillWebgpu(): void {\n assertWorker(\"polyfillWebgpu()\");\n const scope = globalThis as { GPUQueue?: { prototype: object }; GPUDevice?: { prototype: object } };\n patchMethod(scope.GPUQueue?.prototype, \"copyExternalImageToTexture\", unwrapSourceDescriptor);\n patchMethod(scope.GPUDevice?.prototype, \"importExternalTexture\", unwrapSourceDescriptor);\n}\n\nfunction unwrapSourceDescriptor(args: unknown[]): boolean {\n const descriptor = args[0] as { source?: unknown } | undefined;\n const frame = frameOf(descriptor?.source);\n if (frame === undefined) return true;\n if (frame === null) throw noFrameError();\n args[0] = { ...descriptor, source: frame };\n return true;\n}\n"],"mappings":";;;AAGA,SAAgB,iBAAuB;CACrC,aAAa,kBAAkB;CAC/B,MAAM,QAAQ;CACd,YAAY,MAAM,UAAU,WAAW,8BAA8B,sBAAsB;CAC3F,YAAY,MAAM,WAAW,WAAW,yBAAyB,sBAAsB;AACzF;AAEA,SAAS,uBAAuB,MAA0B;CACxD,MAAM,aAAa,KAAK;CACxB,MAAM,QAAQ,QAAQ,YAAY,MAAM;CACxC,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,IAAI,UAAU,MAAM,MAAM,aAAa;CACvC,KAAK,KAAK;EAAE,GAAG;EAAY,QAAQ;CAAM;CACzC,OAAO;AACT"}
@@ -0,0 +1,3 @@
1
+ import { a as FrameMetadata, n as isMainThread, o as MessageEndpoint, r as isWorker, t as InvalidEnvironmentError } from "./environment-W_2WcDor.js";
2
+ import { a as VideoFrameRequestCallback, f as configureVideoTransport, i as CreateVideoElementOptions, n as WorkerTimeRanges, o as WorkerVideoElement, r as polyfillDocument, s as createVideoElement, t as WorkerMediaError } from "./index-B9gWpxKE.js";
3
+ export { type CreateVideoElementOptions, type FrameMetadata, InvalidEnvironmentError, type MessageEndpoint, type VideoFrameRequestCallback, WorkerMediaError, WorkerTimeRanges, WorkerVideoElement, configureVideoTransport, createVideoElement, isMainThread, isWorker, polyfillDocument };
package/dist/worker.js ADDED
@@ -0,0 +1,3 @@
1
+ import { i as isMainThread, o as isWorker, t as InvalidEnvironmentError } from "./environment-De2r8LaA.js";
2
+ import { a as WorkerTimeRanges, i as WorkerMediaError, n as WorkerVideoElement, o as configureVideoTransport, r as createVideoElement, t as polyfillDocument } from "./document-GIe-DKmi.js";
3
+ export { InvalidEnvironmentError, WorkerMediaError, WorkerTimeRanges, WorkerVideoElement, configureVideoTransport, createVideoElement, isMainThread, isWorker, polyfillDocument };