html-video-element-webworker-polyfill 0.1.0 → 0.1.2
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/README.md +65 -206
- package/package.json +13 -6
package/README.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
[](https://github.com/stepancar/html-video-element-webworker-polyfill/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/html-video-element-webworker-polyfill)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Create and control an [`HTMLVideoElement`][HTMLVideoElement] from a [Web Worker][Web Workers] and read its decoded
|
|
7
|
+
frames there.
|
|
7
8
|
|
|
8
9
|
```ts
|
|
9
10
|
const video = document.createElement("video");
|
|
@@ -14,25 +15,14 @@ video.addEventListener("seeked", () => {
|
|
|
14
15
|
video.currentTime = 12.5;
|
|
15
16
|
```
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Workers have no DOM, so this package keeps a real `<video>` on the main thread and mirrors it into the worker:
|
|
20
|
-
properties and method calls go to the main thread, state and events come back, and every decoded frame is
|
|
21
|
-
transferred to the worker as a `VideoFrame`. The worker keeps the current frame, so it can be read **synchronously**
|
|
22
|
-
— in a `seeked` handler, a `requestVideoFrameCallback` callback, or anywhere else.
|
|
23
|
-
|
|
24
|
-
**[Live demo →](https://stepancar.github.io/html-video-element-webworker-polyfill/)** — a small video editor whose
|
|
25
|
-
playback, WebGL effects, picture-in-picture and timeline thumbnails are all rendered in a worker.
|
|
26
|
-
|
|
27
|
-
**[Open the minimal example in StackBlitz →](https://stackblitz.com/github/stepancar/html-video-element-webworker-polyfill/tree/main/examples/stackblitz?file=worker.js&initialPath=/index.html&startScript=start)**
|
|
18
|
+
**[Live demo](https://stepancar.github.io/html-video-element-webworker-polyfill/)** ·
|
|
19
|
+
**[Open in StackBlitz](https://stackblitz.com/github/stepancar/html-video-element-webworker-polyfill/tree/main/examples/stackblitz?file=worker.js&initialPath=/index.html&startScript=start)**
|
|
28
20
|
|
|
29
21
|
## Why not WebCodecs?
|
|
30
22
|
|
|
31
|
-
WebCodecs gives you a decoder, not a player
|
|
32
|
-
|
|
33
|
-
`
|
|
34
|
-
where supported — and gives you frame-accurate seeking with `currentTime` and `seeked`. For frame processing it is
|
|
35
|
-
usually exactly the right tool; it just does not exist in workers. This package makes it available there.
|
|
23
|
+
[WebCodecs][WebCodecs] gives you a decoder, not a player: you demux containers yourself, configure codecs, feed chunks
|
|
24
|
+
and find keyframes to seek. [`HTMLVideoElement`][HTMLVideoElement] already handles every format the browser can play
|
|
25
|
+
and gives frame-accurate seeking with [`currentTime`][currentTime] and [`seeked`][seeked] out of the box. It just does not exist in workers. This package makes it available there.
|
|
36
26
|
|
|
37
27
|
## Install
|
|
38
28
|
|
|
@@ -40,20 +30,18 @@ usually exactly the right tool; it just does not exist in workers. This package
|
|
|
40
30
|
npm install html-video-element-webworker-polyfill
|
|
41
31
|
```
|
|
42
32
|
|
|
43
|
-
##
|
|
33
|
+
## Usage
|
|
44
34
|
|
|
45
|
-
|
|
46
|
-
creating the worker:
|
|
35
|
+
Main thread:
|
|
47
36
|
|
|
48
37
|
```ts
|
|
49
38
|
import { createVideoHost } from "html-video-element-webworker-polyfill/host";
|
|
50
39
|
|
|
51
40
|
const worker = new Worker(new URL("./worker.ts", import.meta.url), { type: "module" });
|
|
52
|
-
|
|
41
|
+
createVideoHost(worker);
|
|
53
42
|
```
|
|
54
43
|
|
|
55
|
-
|
|
56
|
-
`polyfill2dCanvasApi()` enables `ctx.drawImage(video, ...)`:
|
|
44
|
+
Worker:
|
|
57
45
|
|
|
58
46
|
```ts
|
|
59
47
|
import { polyfillDocument } from "html-video-element-webworker-polyfill/worker";
|
|
@@ -62,13 +50,9 @@ import { polyfill2dCanvasApi } from "html-video-element-webworker-polyfill/canva
|
|
|
62
50
|
polyfillDocument();
|
|
63
51
|
polyfill2dCanvasApi();
|
|
64
52
|
|
|
65
|
-
const
|
|
66
|
-
const ctx = canvas.getContext("2d")!;
|
|
67
|
-
|
|
53
|
+
const ctx = new OffscreenCanvas(640, 360).getContext("2d")!;
|
|
68
54
|
const video = document.createElement("video");
|
|
69
|
-
video.muted = true;
|
|
70
55
|
video.src = "/movie.webm";
|
|
71
|
-
|
|
72
56
|
video.addEventListener("loadedmetadata", () => {
|
|
73
57
|
video.currentTime = 10;
|
|
74
58
|
});
|
|
@@ -77,7 +61,7 @@ video.addEventListener("seeked", () => {
|
|
|
77
61
|
});
|
|
78
62
|
```
|
|
79
63
|
|
|
80
|
-
|
|
64
|
+
Or without global patches:
|
|
81
65
|
|
|
82
66
|
```ts
|
|
83
67
|
import { createVideoElement } from "html-video-element-webworker-polyfill/worker";
|
|
@@ -86,198 +70,73 @@ const video = createVideoElement();
|
|
|
86
70
|
video.src = "/movie.webm";
|
|
87
71
|
await video.play();
|
|
88
72
|
|
|
89
|
-
video.requestVideoFrameCallback(function onFrame(
|
|
90
|
-
|
|
91
|
-
render(frame);
|
|
73
|
+
video.requestVideoFrameCallback(function onFrame() {
|
|
74
|
+
render(video.currentFrame);
|
|
92
75
|
video.requestVideoFrameCallback(onFrame);
|
|
93
76
|
});
|
|
94
77
|
|
|
95
78
|
video.dispose();
|
|
96
79
|
```
|
|
97
80
|
|
|
98
|
-
`currentFrame` is a `VideoFrame` (or `null`) and is always the frame on screen. `dispose()` releases the element
|
|
99
|
-
when you are done.
|
|
100
|
-
|
|
101
|
-
Prefer a single import? `import "html-video-element-webworker-polyfill/auto"` inside the worker installs every
|
|
102
|
-
polyfill.
|
|
103
|
-
|
|
104
|
-
## Entry points
|
|
105
|
-
|
|
106
|
-
Every feature is a separate subpath with no side effects (except `auto`), so bundles only contain what you import.
|
|
107
|
-
Importing from the package root tree-shakes just as well.
|
|
108
|
-
|
|
109
|
-
| Import | Where | Exports | Size (min, approx.) |
|
|
110
|
-
| ---------------------------------------------------- | ----------- | ----------------------------------------------------------------------------------------- | ------------------- |
|
|
111
|
-
| `html-video-element-webworker-polyfill/host` | main thread | `createVideoHost` | 10 kB |
|
|
112
|
-
| `html-video-element-webworker-polyfill/worker` | worker | `createVideoElement`, `WorkerVideoElement`, `polyfillDocument`, `configureVideoTransport` | 22 kB |
|
|
113
|
-
| `html-video-element-webworker-polyfill/canvas2d` | worker | `polyfill2dCanvasApi` | 2.6 kB |
|
|
114
|
-
| `html-video-element-webworker-polyfill/webgl` | worker | `polyfillWebglAPI` | 2.6 kB |
|
|
115
|
-
| `html-video-element-webworker-polyfill/webgpu` | worker | `polyfillWebgpu` | 2.7 kB |
|
|
116
|
-
| `html-video-element-webworker-polyfill/image-bitmap` | worker | `polyfillCreateImageBitmap`, `polyfillVideoFrame` | 2.6 kB |
|
|
117
|
-
| `html-video-element-webworker-polyfill/auto` | worker | side effect: installs everything above | 29 kB |
|
|
118
|
-
| `html-video-element-webworker-polyfill` | both | all of the above + `installWorkerPolyfills`, `frameOf` | — |
|
|
119
|
-
|
|
120
|
-
`npm run check:treeshake` bundles each import with Rolldown and asserts that e.g. `polyfillWebglAPI` pulls in neither the
|
|
121
|
-
element nor the host.
|
|
122
|
-
|
|
123
81
|
## API
|
|
124
82
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
`
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
onVideoDisposed?(video: HTMLVideoElement, id: number): void;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
interface VideoHost {
|
|
138
|
-
readonly videos: ReadonlyMap<number, HTMLVideoElement>;
|
|
139
|
-
dispose(): void;
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
`container` mounts the real `<video>` elements into the DOM (by default they stay detached). `videos` lists the live
|
|
144
|
-
real elements. `dispose()` releases everything, e.g. before `worker.terminate()`.
|
|
145
|
-
|
|
146
|
-
### `WorkerVideoElement` — worker
|
|
147
|
-
|
|
148
|
-
An `EventTarget` implementing the `HTMLVideoElement`/`HTMLMediaElement` API:
|
|
149
|
-
|
|
150
|
-
- **State**: `currentTime` (get/set), `duration`, `paused`, `ended`, `seeking`, `readyState`, `networkState`,
|
|
151
|
-
`videoWidth`, `videoHeight`, `currentSrc`, `error` (`MediaError`), `buffered`/`played`/`seekable` (`TimeRanges`).
|
|
152
|
-
- **Settings**: `src`, `srcObject` (a `MediaSourceHandle` from a worker-side `MediaSource`), `muted`, `volume`,
|
|
153
|
-
`playbackRate`, `defaultPlaybackRate`, `defaultMuted`, `loop`, `autoplay`, `preload`, `crossOrigin`, `poster`,
|
|
154
|
-
`playsInline`, `preservesPitch`, `width`, `height`, `controls`, `disablePictureInPicture`, `disableRemotePlayback`.
|
|
155
|
-
- **Methods**: `play()` (promise), `pause()`, `load()`, `fastSeek()`, `canPlayType()`, `getVideoPlaybackQuality()`,
|
|
156
|
-
`requestVideoFrameCallback()`, `cancelVideoFrameCallback()`, `getAttribute`/`setAttribute`/`hasAttribute`/
|
|
157
|
-
`removeAttribute` (for reflected attributes such as `src`, `loop`, `muted`, `crossorigin`).
|
|
158
|
-
- **Events**: every media event (`loadstart`, `loadedmetadata`, `loadeddata`, `canplay`, `play`, `playing`, `pause`,
|
|
159
|
-
`seeking`, `seeked`, `timeupdate`, `ended`, `error`, `emptied`, `resize`, `volumechange`, `ratechange`, …) via
|
|
160
|
-
`addEventListener` or `on<event>` properties.
|
|
161
|
-
- **Non-standard**:
|
|
162
|
-
- `currentFrame: VideoFrame | null` — the frame currently presented. It is owned by the element and closed when the
|
|
163
|
-
next frame arrives; `clone()` it to keep it longer.
|
|
164
|
-
- `dispose()` / `[Symbol.dispose]()` (works with `using`) and `disposed`.
|
|
165
|
-
|
|
166
|
-
`createVideoElement({ transport? })` creates one. `transport` overrides the endpoint (default: the worker global
|
|
167
|
-
scope, or what you passed to `configureVideoTransport`).
|
|
168
|
-
|
|
169
|
-
### Rendering polyfills — worker
|
|
83
|
+
| Import | Exports |
|
|
84
|
+
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
85
|
+
| `html-video-element-webworker-polyfill/host` | `createVideoHost(worker, { container? })` — main thread |
|
|
86
|
+
| `html-video-element-webworker-polyfill/worker` | `createVideoElement()`, `WorkerVideoElement`, `polyfillDocument()` — [`document.createElement`][createElement] |
|
|
87
|
+
| `html-video-element-webworker-polyfill/canvas2d` | `polyfill2dCanvasApi()` — [`drawImage`][drawImage], [`createPattern`][createPattern] |
|
|
88
|
+
| `html-video-element-webworker-polyfill/webgl` | `polyfillWebglAPI()` — [`texImage2D`][texImage2D] and friends, [WebGL][WebGL] 1 and 2 |
|
|
89
|
+
| `html-video-element-webworker-polyfill/webgpu` | `polyfillWebgpu()` — [`copyExternalImageToTexture`][copyExternalImageToTexture], [`importExternalTexture`][importExternalTexture] |
|
|
90
|
+
| `html-video-element-webworker-polyfill/image-bitmap` | `polyfillCreateImageBitmap()` — [`createImageBitmap`][createImageBitmap], `polyfillVideoFrame()` — [`new VideoFrame`][VideoFrame constructor] |
|
|
91
|
+
| `html-video-element-webworker-polyfill/auto` | installs every worker polyfill |
|
|
170
92
|
|
|
171
|
-
Each
|
|
93
|
+
Each entry point is tree-shakeable, so you only ship what you import.
|
|
172
94
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
| `polyfillWebglAPI()` | WebGL 1 & 2 `texImage2D`, `texSubImage2D`, `texImage3D`, `texSubImage3D` (all overloads) |
|
|
177
|
-
| `polyfillWebgpu()` | `GPUQueue.copyExternalImageToTexture({ source })`, `GPUDevice.importExternalTexture({ source })` |
|
|
178
|
-
| `polyfillCreateImageBitmap()` | `createImageBitmap(video, ...)` |
|
|
179
|
-
| `polyfillVideoFrame()` | `new VideoFrame(video, init)` (a `Proxy`, so `instanceof VideoFrame` is unaffected) |
|
|
180
|
-
| `polyfillDocument()` | `document.createElement("video")`, plus `HTMLVideoElement`/`HTMLMediaElement`/`MediaError`/`TimeRanges` globals |
|
|
95
|
+
The worker element implements the [`HTMLVideoElement`][HTMLVideoElement] API: properties, [`play()`][play],
|
|
96
|
+
[`pause()`][pause], [`load()`][load], seeking, [media events][media events] and
|
|
97
|
+
[`requestVideoFrameCallback`][requestVideoFrameCallback]. It adds two non-standard members:
|
|
181
98
|
|
|
182
|
-
|
|
183
|
-
|
|
99
|
+
- `currentFrame` — the [`VideoFrame`][VideoFrame] currently on screen, or `null`. It is closed when the next frame
|
|
100
|
+
arrives; [`clone()`][clone] it to keep it.
|
|
101
|
+
- `dispose()` — releases the element. Unreferenced elements are also released automatically on garbage collection
|
|
102
|
+
via [`FinalizationRegistry`][FinalizationRegistry].
|
|
184
103
|
|
|
185
|
-
|
|
104
|
+
Calling a main-thread function in a worker, or a worker function on the main thread, throws an
|
|
105
|
+
`InvalidEnvironmentError`.
|
|
186
106
|
|
|
187
|
-
|
|
107
|
+
## Notes
|
|
188
108
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
So a worker-side polyfill can never patch `document.createElement` or canvas prototypes of the page by mistake.
|
|
196
|
-
`isMainThread()` and `isWorker()` are exported for your own checks.
|
|
197
|
-
|
|
198
|
-
Common mistakes are reported too:
|
|
199
|
-
|
|
200
|
-
- `createVideoHost()` throws a `TypeError` unless it gets a `Worker` or `MessagePort`, and an `InvalidStateError` when
|
|
201
|
-
the same endpoint is attached twice (call `dispose()` on the previous host first).
|
|
202
|
-
- `createVideoElement({ transport })` and `configureVideoTransport()` throw a `TypeError` for anything that is not a
|
|
203
|
-
message endpoint.
|
|
204
|
-
- A worker that creates video elements without a host on the main thread logs a warning after 3 seconds, since its
|
|
205
|
-
videos would never load.
|
|
206
|
-
|
|
207
|
-
## How it works
|
|
208
|
-
|
|
209
|
-
```
|
|
210
|
-
worker main thread
|
|
211
|
-
────── ───────────
|
|
212
|
-
video.currentTime = 5 ── set(seq=7) ─────────▶ realVideo.currentTime = 5
|
|
213
|
-
(reads 5 immediately) ◀── state(ack=7) ─────── snapshot
|
|
214
|
-
"seeked" listeners run ◀── event + VideoFrame ── "seeked" fires, new VideoFrame(realVideo)
|
|
215
|
-
video.currentFrame ◀── frame + metadata ─── requestVideoFrameCallback on realVideo
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
- **Optimistic writes.** Setters update the worker-side state immediately, as browsers do (`currentTime` returns the new
|
|
219
|
-
value, `paused` flips on `play()`). Each command carries a sequence number; state snapshots from the main thread are
|
|
220
|
-
only applied to a property once they acknowledge its latest local write, so stale updates never overwrite it.
|
|
221
|
-
- **Events carry state.** Every forwarded event includes a full state snapshot, applied before your listeners run.
|
|
222
|
-
`seeked` and `loadeddata` also carry the new frame, so `currentFrame` is already correct inside the handler.
|
|
223
|
-
- **Frames.** The host captures a `VideoFrame` for every presented frame (`requestVideoFrameCallback`) and transfers it
|
|
224
|
-
(zero-copy). The worker closes the previous frame. `requestVideoFrameCallback` metadata is converted to the worker's
|
|
225
|
-
time origin.
|
|
226
|
-
- **Backpressure.** Only one frame is in flight at a time. When the worker is busy, the host keeps just the newest
|
|
227
|
-
frame and sends it once the worker is ready, so a slow consumer always sees fresh frames instead of a backlog.
|
|
228
|
-
- **Cleanup.** `dispose()` releases the main-thread element and the current frame. Elements that become unreachable are
|
|
229
|
-
released automatically through `FinalizationRegistry`; like real media elements, an element is kept alive while it
|
|
230
|
-
is playing.
|
|
231
|
-
|
|
232
|
-
## Caveats
|
|
233
|
-
|
|
234
|
-
- The main thread must be alive: frames are produced there. A long main-thread task delays frames to the worker.
|
|
235
|
-
- Cross-origin media needs CORS (`video.crossOrigin = "anonymous"` and an `Access-Control-Allow-Origin` header), or no
|
|
236
|
-
frames can be captured — the same rule as for drawing a video on a canvas.
|
|
237
|
-
- Browsers pause video-only media in background tabs to save power; the polyfilled element behaves the same way.
|
|
238
|
-
- `canPlayType()` is synchronous. Common types are answered from a table sent by the host; others are guessed with
|
|
239
|
-
`MediaSource.isTypeSupported` and refined once the host has answered.
|
|
240
|
-
- `polyfillDocument()` defines `document` in the worker, which may make some libraries think they are on the main
|
|
241
|
-
thread. Use `createVideoElement()` when that matters.
|
|
242
|
-
- Requires `VideoFrame` (WebCodecs) and `requestVideoFrameCallback` on the main thread: Chrome/Edge 94+, Firefox 132+,
|
|
243
|
-
Safari 17+ (the test suite runs in Chromium).
|
|
244
|
-
|
|
245
|
-
## Development
|
|
246
|
-
|
|
247
|
-
```sh
|
|
248
|
-
npm install
|
|
249
|
-
npx playwright install chromium
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
| Command | Purpose |
|
|
253
|
-
| --------------------------- | ------------------------------------------------------------------- |
|
|
254
|
-
| `npm test` | browser tests (Vitest browser mode + Playwright) |
|
|
255
|
-
| `npm run test:update` | update screenshot references for your platform |
|
|
256
|
-
| `npm run test:update-linux` | update Linux references in the Playwright Docker image (used by CI) |
|
|
257
|
-
| `npm run lint` | oxlint |
|
|
258
|
-
| `npm run format` | oxfmt |
|
|
259
|
-
| `npm run typecheck` | tsc |
|
|
260
|
-
| `npm run build` | tsdown → `dist/` |
|
|
261
|
-
| `npm run check:treeshake` | verify each entry point stays small |
|
|
262
|
-
| `npm run demo:dev` | demo on http://localhost:5173 |
|
|
263
|
-
|
|
264
|
-
The tests run in real Chromium. They cover the whole round trip — loading, seeking with synchronous frame access,
|
|
265
|
-
playback, events, properties, many elements, `dispose()`, garbage collection, Media Source Extensions — and every
|
|
266
|
-
rendering polyfill, with pixel assertions and screenshot comparisons (`test/__screenshots__`).
|
|
267
|
-
|
|
268
|
-
### Releasing
|
|
269
|
-
|
|
270
|
-
Releases are published from GitHub Actions with npm trusted publishing (OIDC): no npm token is stored anywhere, and
|
|
271
|
-
every version gets a provenance attestation.
|
|
272
|
-
|
|
273
|
-
1. Bump `version` in `package.json` and push to `main`.
|
|
274
|
-
2. Publish a GitHub release tagged `v<version>`. The `Release` workflow tests, builds and runs `npm publish`.
|
|
275
|
-
|
|
276
|
-
One-time setup on npmjs.com: package settings → Trusted Publisher → GitHub Actions, with repository
|
|
277
|
-
`stepancar/html-video-element-webworker-polyfill` and workflow `release.yml`.
|
|
278
|
-
|
|
279
|
-
The demo is deployed to GitHub Pages on every push to `main`.
|
|
109
|
+
- Cross-origin media needs [CORS][CORS] ([`crossOrigin`][crossOrigin] `= "anonymous"`), as with drawing a video on a
|
|
110
|
+
canvas.
|
|
111
|
+
- Frames are decoded on the main thread, so it must not be blocked for long.
|
|
112
|
+
- Requires [`VideoFrame`][VideoFrame] and [`requestVideoFrameCallback`][requestVideoFrameCallback]: Chrome/Edge 94+,
|
|
113
|
+
Firefox 132+, Safari 17+.
|
|
280
114
|
|
|
281
115
|
## License
|
|
282
116
|
|
|
283
117
|
Apache-2.0
|
|
118
|
+
|
|
119
|
+
[HTMLVideoElement]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement
|
|
120
|
+
[Web Workers]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API
|
|
121
|
+
[WebCodecs]: https://developer.mozilla.org/en-US/docs/Web/API/WebCodecs_API
|
|
122
|
+
[currentTime]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/currentTime
|
|
123
|
+
[seeked]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seeked_event
|
|
124
|
+
[play]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play
|
|
125
|
+
[pause]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/pause
|
|
126
|
+
[load]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/load
|
|
127
|
+
[media events]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#events
|
|
128
|
+
[requestVideoFrameCallback]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement/requestVideoFrameCallback
|
|
129
|
+
[createElement]: https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
|
|
130
|
+
[drawImage]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage
|
|
131
|
+
[createPattern]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createPattern
|
|
132
|
+
[texImage2D]: https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D
|
|
133
|
+
[WebGL]: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API
|
|
134
|
+
[copyExternalImageToTexture]: https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/copyExternalImageToTexture
|
|
135
|
+
[importExternalTexture]: https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/importExternalTexture
|
|
136
|
+
[createImageBitmap]: https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap
|
|
137
|
+
[VideoFrame]: https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame
|
|
138
|
+
[VideoFrame constructor]: https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/VideoFrame
|
|
139
|
+
[clone]: https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/clone
|
|
140
|
+
[FinalizationRegistry]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
|
|
141
|
+
[CORS]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS
|
|
142
|
+
[crossOrigin]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/crossOrigin
|
package/package.json
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-video-element-webworker-polyfill",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "HTMLVideoElement inside Web Workers: a main-thread <video> mirrored into the worker with synchronous state, events and VideoFrames, plus Canvas 2D / WebGL / WebGPU polyfills.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"htmlvideoelement",
|
|
7
|
-
"offscreencanvas",
|
|
8
|
-
"polyfill",
|
|
9
6
|
"video",
|
|
7
|
+
"html5-video",
|
|
8
|
+
"htmlvideoelement",
|
|
9
|
+
"video-processing",
|
|
10
|
+
"frame-extraction",
|
|
10
11
|
"videoframe",
|
|
11
12
|
"webcodecs",
|
|
13
|
+
"worker",
|
|
14
|
+
"web-worker",
|
|
15
|
+
"webworker",
|
|
16
|
+
"multithreading",
|
|
17
|
+
"off-main-thread",
|
|
18
|
+
"canvas",
|
|
19
|
+
"offscreencanvas",
|
|
12
20
|
"webgl",
|
|
13
21
|
"webgpu",
|
|
14
|
-
"
|
|
15
|
-
"worker"
|
|
22
|
+
"polyfill"
|
|
16
23
|
],
|
|
17
24
|
"homepage": "https://stepancar.github.io/html-video-element-webworker-polyfill/",
|
|
18
25
|
"bugs": {
|