@napi-rs/webcodecs 1.1.0 → 1.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.
Files changed (4) hide show
  1. package/README.md +156 -9
  2. package/index.d.ts +20 -272
  3. package/index.js +52 -52
  4. package/package.json +11 -11
package/README.md CHANGED
@@ -9,7 +9,8 @@ WebCodecs API implementation for Node.js using FFmpeg, built with [NAPI-RS](http
9
9
  - **W3C WebCodecs API compliant** - Full implementation of the WebCodecs specification with native `DOMException` errors
10
10
  - **Video encoding/decoding** - H.264, H.265, VP8, VP9, AV1
11
11
  - **Audio encoding/decoding** - AAC, Opus, MP3, FLAC, Vorbis, PCM variants
12
- - **Image decoding** - JPEG, PNG, WebP, GIF, BMP, AVIF
12
+ - **Container muxing/demuxing** - MP4, WebM, MKV containers with seeking support
13
+ - **Image decoding** - JPEG, PNG, WebP, GIF, BMP, AVIF, JPEG XL
13
14
  - **Canvas integration** - Create VideoFrames from `@napi-rs/canvas` for graphics and text rendering
14
15
  - **Hardware acceleration** - Zero-copy GPU encoding with VideoToolbox (macOS), NVENC (NVIDIA), VAAPI (Linux), QSV (Intel)
15
16
  - **Cross-platform** - macOS, Windows, Linux (glibc/musl, x64/arm64/armv7)
@@ -166,6 +167,141 @@ result.image.close()
166
167
  decoder.close()
167
168
  ```
168
169
 
170
+ ### Container Demuxing
171
+
172
+ Read encoded video/audio from MP4, WebM, or MKV containers:
173
+
174
+ ```typescript
175
+ import { Mp4Demuxer, VideoDecoder, AudioDecoder } from '@napi-rs/webcodecs'
176
+
177
+ // Create decoder instances
178
+ const videoDecoder = new VideoDecoder({
179
+ output: (frame) => {
180
+ console.log(`Decoded frame: ${frame.timestamp}`)
181
+ frame.close()
182
+ },
183
+ error: (e) => console.error(e),
184
+ })
185
+
186
+ const audioDecoder = new AudioDecoder({
187
+ output: (data) => {
188
+ console.log(`Decoded audio: ${data.timestamp}`)
189
+ data.close()
190
+ },
191
+ error: (e) => console.error(e),
192
+ })
193
+
194
+ // Create demuxer with callbacks
195
+ const demuxer = new Mp4Demuxer({
196
+ videoOutput: (chunk) => videoDecoder.decode(chunk),
197
+ audioOutput: (chunk) => audioDecoder.decode(chunk),
198
+ error: (e) => console.error(e),
199
+ })
200
+
201
+ // Load from file or buffer
202
+ await demuxer.load('./video.mp4')
203
+ // or: await demuxer.loadBuffer(uint8Array)
204
+
205
+ // Configure decoders with extracted configs
206
+ videoDecoder.configure(demuxer.videoDecoderConfig)
207
+ audioDecoder.configure(demuxer.audioDecoderConfig)
208
+
209
+ // Get track info
210
+ console.log(demuxer.tracks) // Array of track info
211
+ console.log(demuxer.duration) // Duration in microseconds
212
+
213
+ // Demux all packets (calls callbacks)
214
+ demuxer.demux()
215
+
216
+ // Or demux in batches
217
+ demuxer.demux(100) // Demux up to 100 packets
218
+
219
+ // Seek to timestamp (microseconds)
220
+ demuxer.seek(5_000_000) // Seek to 5 seconds
221
+
222
+ demuxer.close()
223
+ ```
224
+
225
+ ### Container Muxing
226
+
227
+ Write encoded video/audio to MP4, WebM, or MKV containers:
228
+
229
+ ```typescript
230
+ import { Mp4Muxer, VideoEncoder, AudioEncoder } from '@napi-rs/webcodecs'
231
+ import { writeFileSync } from 'fs'
232
+
233
+ // Create muxer
234
+ const muxer = new Mp4Muxer({ fastStart: true })
235
+
236
+ // Track description will be set from encoder metadata
237
+ let videoDescription: Uint8Array | undefined
238
+
239
+ // Create encoder that feeds into muxer
240
+ const videoEncoder = new VideoEncoder({
241
+ output: (chunk, metadata) => {
242
+ // Capture codec description from first keyframe
243
+ if (metadata?.decoderConfig?.description) {
244
+ videoDescription = metadata.decoderConfig.description
245
+ }
246
+ muxer.addVideoChunk(chunk, metadata)
247
+ },
248
+ error: (e) => console.error(e),
249
+ })
250
+
251
+ videoEncoder.configure({
252
+ codec: 'avc1.42001E',
253
+ width: 1920,
254
+ height: 1080,
255
+ bitrate: 5_000_000,
256
+ })
257
+
258
+ // Add tracks before adding chunks
259
+ muxer.addVideoTrack({
260
+ codec: 'avc1.42001E',
261
+ width: 1920,
262
+ height: 1080,
263
+ })
264
+
265
+ // Encode frames...
266
+ // videoEncoder.encode(frame)
267
+
268
+ await videoEncoder.flush()
269
+
270
+ // Finalize and write output
271
+ const mp4Data = muxer.finalize()
272
+ writeFileSync('output.mp4', mp4Data)
273
+ muxer.close()
274
+ ```
275
+
276
+ #### Streaming Muxer Mode
277
+
278
+ For live streaming or large files, use streaming mode:
279
+
280
+ ```typescript
281
+ import { Mp4Muxer } from '@napi-rs/webcodecs'
282
+
283
+ const muxer = new Mp4Muxer({
284
+ fragmented: true, // Required for MP4 streaming
285
+ streaming: { bufferCapacity: 256 * 1024 },
286
+ })
287
+
288
+ muxer.addVideoTrack({ codec: 'avc1.42001E', width: 1920, height: 1080 })
289
+
290
+ // Add chunks as they arrive
291
+ muxer.addVideoChunk(chunk, metadata)
292
+
293
+ // Read available data incrementally
294
+ const data = muxer.read()
295
+ if (data) {
296
+ stream.write(data)
297
+ }
298
+
299
+ // Check when finished
300
+ if (muxer.isFinished) {
301
+ stream.end()
302
+ }
303
+ ```
304
+
169
305
  ### VideoFrame from Canvas
170
306
 
171
307
  Create VideoFrames from `@napi-rs/canvas` for graphics, text rendering, or image compositing:
@@ -226,14 +362,23 @@ frame.close()
226
362
 
227
363
  ### Image
228
364
 
229
- | Format | MIME Type | Decoding |
230
- | ------ | ------------ | -------- |
231
- | JPEG | `image/jpeg` | ✅ |
232
- | PNG | `image/png` | ✅ |
233
- | WebP | `image/webp` | ✅ |
234
- | GIF | `image/gif` | ✅ |
235
- | BMP | `image/bmp` | ✅ |
236
- | AVIF | `image/avif` | ✅ |
365
+ | Format | MIME Type | Decoding | Notes |
366
+ | ------- | ------------ | -------- | ------------------------------ |
367
+ | JPEG | `image/jpeg` | ✅ | |
368
+ | PNG | `image/png` | ✅ | |
369
+ | WebP | `image/webp` | ✅ | |
370
+ | GIF | `image/gif` | ✅ | |
371
+ | BMP | `image/bmp` | ✅ | |
372
+ | AVIF | `image/avif` | ✅ | |
373
+ | JPEG XL | `image/jxl` | ✅ | Not available on Windows arm64 |
374
+
375
+ ### Containers
376
+
377
+ | Container | Video Codecs | Audio Codecs | Demuxer | Muxer |
378
+ | --------- | --------------------------- | ---------------------------- | ------------- | ----------- |
379
+ | MP4 | H.264, H.265, AV1 | AAC, Opus, MP3, FLAC | `Mp4Demuxer` | `Mp4Muxer` |
380
+ | WebM | VP8, VP9, AV1 | Opus, Vorbis | `WebMDemuxer` | `WebMMuxer` |
381
+ | MKV | H.264, H.265, VP8, VP9, AV1 | AAC, Opus, Vorbis, FLAC, MP3 | `MkvDemuxer` | `MkvMuxer` |
237
382
 
238
383
  ## Platform Support
239
384
 
@@ -436,6 +581,8 @@ This package implements the [W3C WebCodecs API](https://w3c.github.io/webcodecs/
436
581
  - `EncodedVideoChunk` / `EncodedAudioChunk` - Encoded media data
437
582
  - `ImageDecoder` - Static image decoding
438
583
  - `VideoColorSpace` - Color space information
584
+ - `Mp4Demuxer` / `WebMDemuxer` / `MkvDemuxer` - Container demuxing with seeking
585
+ - `Mp4Muxer` / `WebMMuxer` / `MkvMuxer` - Container muxing with streaming support
439
586
 
440
587
  All encoders and decoders implement the `EventTarget` interface with `addEventListener()`, `removeEventListener()`, and `dispatchEvent()`.
441
588
 
package/index.d.ts CHANGED
@@ -33,19 +33,6 @@ export {
33
33
  AllowSharedBufferSource,
34
34
  } from './standard'
35
35
 
36
- export type TypedArray =
37
- | Int8Array
38
- | Uint8Array
39
- | Uint8ClampedArray
40
- | Int16Array
41
- | Uint16Array
42
- | Int32Array
43
- | Uint32Array
44
- | Float32Array
45
- | Float64Array
46
- | BigInt64Array
47
- | BigUint64Array
48
-
49
36
  /**
50
37
  * Interface for Canvas-like objects compatible with VideoFrame constructor.
51
38
  * Compatible with @napi-rs/canvas Canvas class.
@@ -70,53 +57,6 @@ export type DemuxerState = 'unloaded' | 'ready' | 'demuxing' | 'ended' | 'closed
70
57
  /** Muxer state */
71
58
  export type MuxerState = 'configuring' | 'muxing' | 'finalized' | 'closed'
72
59
 
73
- /** Track type for demuxer */
74
- export type DemuxerTrackType = 'video' | 'audio' | 'subtitle' | 'data'
75
-
76
- /** Track info from demuxer */
77
- export interface DemuxerTrackInfo {
78
- /** Track index */
79
- index: number
80
- /** Track type */
81
- trackType: DemuxerTrackType
82
- /** Codec string */
83
- codec?: string
84
- /** Coded width (video only) */
85
- codedWidth?: number
86
- /** Coded height (video only) */
87
- codedHeight?: number
88
- /** Sample rate (audio only) */
89
- sampleRate?: number
90
- /** Number of channels (audio only) */
91
- numberOfChannels?: number
92
- /** Duration in microseconds */
93
- duration?: number
94
- }
95
-
96
- /** Video decoder config from demuxer */
97
- export interface DemuxerVideoDecoderConfig {
98
- /** Codec string */
99
- codec: string
100
- /** Coded width */
101
- codedWidth: number
102
- /** Coded height */
103
- codedHeight: number
104
- /** Codec description (e.g., avcC for H.264) */
105
- description?: Uint8Array
106
- }
107
-
108
- /** Audio decoder config from demuxer */
109
- export interface DemuxerAudioDecoderConfig {
110
- /** Codec string */
111
- codec: string
112
- /** Sample rate */
113
- sampleRate: number
114
- /** Number of channels */
115
- numberOfChannels: number
116
- /** Codec description */
117
- description?: Uint8Array
118
- }
119
-
120
60
  /** Init options for Mp4Demuxer */
121
61
  export interface Mp4DemuxerInit {
122
62
  /** Callback for video chunks */
@@ -197,180 +137,6 @@ export interface MkvMuxerInit {
197
137
  streaming?: { bufferCapacity?: number }
198
138
  }
199
139
 
200
- /**
201
- * MP4 Demuxer - reads encoded video/audio from MP4 containers
202
- */
203
- export declare class Mp4Demuxer {
204
- constructor(init: Mp4DemuxerInit)
205
- /** Load from file path */
206
- load(path: string): Promise<void>
207
- /** Load from buffer */
208
- loadBuffer(data: Uint8Array): Promise<void>
209
- /** Get all tracks */
210
- get tracks(): DemuxerTrackInfo[]
211
- /** Get container duration in microseconds */
212
- get duration(): number | null
213
- /** Get video decoder configuration */
214
- get videoDecoderConfig(): DemuxerVideoDecoderConfig | null
215
- /** Get audio decoder configuration */
216
- get audioDecoderConfig(): DemuxerAudioDecoderConfig | null
217
- /** Select video track by index */
218
- selectVideoTrack(trackIndex: number): void
219
- /** Select audio track by index */
220
- selectAudioTrack(trackIndex: number): void
221
- /** Start demuxing (optional packet count limit) */
222
- demux(count?: number): void
223
- /** Seek to timestamp in microseconds */
224
- seek(timestampUs: number): void
225
- /** Close and release resources */
226
- close(): void
227
- /** Get current state */
228
- get state(): DemuxerState
229
- }
230
-
231
- /**
232
- * WebM Demuxer - reads encoded video/audio from WebM containers
233
- */
234
- export declare class WebMDemuxer {
235
- constructor(init: WebMDemuxerInit)
236
- /** Load from file path */
237
- load(path: string): Promise<void>
238
- /** Load from buffer */
239
- loadBuffer(data: Uint8Array): Promise<void>
240
- /** Get all tracks */
241
- get tracks(): DemuxerTrackInfo[]
242
- /** Get container duration in microseconds */
243
- get duration(): number | null
244
- /** Get video decoder configuration */
245
- get videoDecoderConfig(): DemuxerVideoDecoderConfig | null
246
- /** Get audio decoder configuration */
247
- get audioDecoderConfig(): DemuxerAudioDecoderConfig | null
248
- /** Select video track by index */
249
- selectVideoTrack(trackIndex: number): void
250
- /** Select audio track by index */
251
- selectAudioTrack(trackIndex: number): void
252
- /** Start demuxing (optional packet count limit) */
253
- demux(count?: number): void
254
- /** Seek to timestamp in microseconds */
255
- seek(timestampUs: number): void
256
- /** Close and release resources */
257
- close(): void
258
- /** Get current state */
259
- get state(): DemuxerState
260
- }
261
-
262
- /**
263
- * MKV Demuxer - reads encoded video/audio from MKV containers
264
- */
265
- export declare class MkvDemuxer {
266
- constructor(init: MkvDemuxerInit)
267
- /** Load from file path */
268
- load(path: string): Promise<void>
269
- /** Load from buffer */
270
- loadBuffer(data: Uint8Array): Promise<void>
271
- /** Get all tracks */
272
- get tracks(): DemuxerTrackInfo[]
273
- /** Get container duration in microseconds */
274
- get duration(): number | null
275
- /** Get video decoder configuration */
276
- get videoDecoderConfig(): DemuxerVideoDecoderConfig | null
277
- /** Get audio decoder configuration */
278
- get audioDecoderConfig(): DemuxerAudioDecoderConfig | null
279
- /** Select video track by index */
280
- selectVideoTrack(trackIndex: number): void
281
- /** Select audio track by index */
282
- selectAudioTrack(trackIndex: number): void
283
- /** Start demuxing (optional packet count limit) */
284
- demux(count?: number): void
285
- /** Seek to timestamp in microseconds */
286
- seek(timestampUs: number): void
287
- /** Close and release resources */
288
- close(): void
289
- /** Get current state */
290
- get state(): DemuxerState
291
- }
292
-
293
- /**
294
- * MP4 Muxer - writes encoded video/audio to MP4 containers
295
- */
296
- export declare class Mp4Muxer {
297
- constructor(init?: Mp4MuxerInit)
298
- /** Add video track */
299
- addVideoTrack(config: MuxerVideoTrackConfig): void
300
- /** Add audio track */
301
- addAudioTrack(config: MuxerAudioTrackConfig): void
302
- /** Add encoded video chunk */
303
- addVideoChunk(chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadata): void
304
- /** Add encoded audio chunk */
305
- addAudioChunk(chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadata): void
306
- /** Flush pending data */
307
- flush(): Promise<void>
308
- /** Finalize and get output data */
309
- finalize(): Uint8Array
310
- /** Read available data (streaming mode) */
311
- read(): Uint8Array | null
312
- /** Check if finished (streaming mode) */
313
- get isFinished(): boolean
314
- /** Close and release resources */
315
- close(): void
316
- /** Get current state */
317
- get state(): MuxerState
318
- }
319
-
320
- /**
321
- * WebM Muxer - writes encoded video/audio to WebM containers
322
- */
323
- export declare class WebMMuxer {
324
- constructor(init?: WebMMuxerInit)
325
- /** Add video track */
326
- addVideoTrack(config: MuxerVideoTrackConfig): void
327
- /** Add audio track */
328
- addAudioTrack(config: MuxerAudioTrackConfig): void
329
- /** Add encoded video chunk */
330
- addVideoChunk(chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadata): void
331
- /** Add encoded audio chunk */
332
- addAudioChunk(chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadata): void
333
- /** Flush pending data */
334
- flush(): Promise<void>
335
- /** Finalize and get output data */
336
- finalize(): Uint8Array
337
- /** Read available data (streaming mode) */
338
- read(): Uint8Array | null
339
- /** Check if finished (streaming mode) */
340
- get isFinished(): boolean
341
- /** Close and release resources */
342
- close(): void
343
- /** Get current state */
344
- get state(): MuxerState
345
- }
346
-
347
- /**
348
- * MKV Muxer - writes encoded video/audio to MKV containers
349
- */
350
- export declare class MkvMuxer {
351
- constructor(init?: MkvMuxerInit)
352
- /** Add video track */
353
- addVideoTrack(config: MuxerVideoTrackConfig): void
354
- /** Add audio track */
355
- addAudioTrack(config: MuxerAudioTrackConfig): void
356
- /** Add encoded video chunk */
357
- addVideoChunk(chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadata): void
358
- /** Add encoded audio chunk */
359
- addAudioChunk(chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadata): void
360
- /** Flush pending data */
361
- flush(): Promise<void>
362
- /** Finalize and get output data */
363
- finalize(): Uint8Array
364
- /** Read available data (streaming mode) */
365
- read(): Uint8Array | null
366
- /** Check if finished (streaming mode) */
367
- get isFinished(): boolean
368
- /** Close and release resources */
369
- close(): void
370
- /** Get current state */
371
- get state(): MuxerState
372
- }
373
-
374
140
  export type TypedArray =
375
141
  | Int8Array
376
142
  | Uint8Array
@@ -393,7 +159,7 @@ export declare class AudioData {
393
159
  * Create a new AudioData (W3C WebCodecs spec)
394
160
  * Per spec, the constructor takes a single init object containing all parameters including data
395
161
  */
396
- constructor(init: import('./standard').AudioDataInit)
162
+ constructor(init: AudioDataInit)
397
163
  /** Get sample format */
398
164
  get format(): AudioSampleFormat | null
399
165
  /**
@@ -439,7 +205,7 @@ export declare class AudioData {
439
205
  * Note: Per spec, this is SYNCHRONOUS and returns undefined
440
206
  * Accepts AllowSharedBufferSource (any TypedArray, DataView, or ArrayBuffer)
441
207
  */
442
- copyTo(destination: import('./standard').AllowSharedBufferSource, options: AudioDataCopyToOptions): void
208
+ copyTo(destination: AllowSharedBufferSource, options: AudioDataCopyToOptions): void
443
209
  /** Create a copy of this AudioData */
444
210
  clone(): AudioData
445
211
  /** Close and release resources */
@@ -487,7 +253,7 @@ export declare class AudioDecoder {
487
253
  * The dequeue event fires when decodeQueueSize decreases,
488
254
  * allowing backpressure management.
489
255
  */
490
- set ondequeue(callback?: (() => unknown) | undefined | null)
256
+ set ondequeue(callback: (() => unknown) | undefined | null)
491
257
  /** Get the dequeue event handler (per WebCodecs spec) */
492
258
  get ondequeue(): (() => unknown) | null
493
259
  /** Configure the decoder */
@@ -575,7 +341,7 @@ export declare class AudioEncoder {
575
341
  * The dequeue event fires when encodeQueueSize decreases,
576
342
  * allowing backpressure management.
577
343
  */
578
- set ondequeue(callback?: (() => unknown) | undefined | null)
344
+ set ondequeue(callback: (() => unknown) | undefined | null)
579
345
  /** Get the dequeue event handler (per WebCodecs spec) */
580
346
  get ondequeue(): (() => unknown) | null
581
347
  /** Configure the encoder */
@@ -661,7 +427,7 @@ export declare class DOMRectReadOnly {
661
427
  */
662
428
  export declare class EncodedAudioChunk {
663
429
  /** Create a new EncodedAudioChunk */
664
- constructor(init: import('./standard').EncodedAudioChunkInit)
430
+ constructor(init: EncodedAudioChunkInit)
665
431
  /** Get the chunk type */
666
432
  get type(): EncodedAudioChunkType
667
433
  /** Get the timestamp in microseconds */
@@ -674,7 +440,7 @@ export declare class EncodedAudioChunk {
674
440
  * Copy the encoded data to a BufferSource
675
441
  * W3C spec: throws TypeError if destination is too small
676
442
  */
677
- copyTo(destination: import('./standard').BufferSource): void
443
+ copyTo(destination: BufferSource): void
678
444
  }
679
445
 
680
446
  /**
@@ -684,7 +450,7 @@ export declare class EncodedAudioChunk {
684
450
  */
685
451
  export declare class EncodedVideoChunk {
686
452
  /** Create a new EncodedVideoChunk */
687
- constructor(init: import('./standard').EncodedVideoChunkInit)
453
+ constructor(init: EncodedVideoChunkInit)
688
454
  /** Get the chunk type */
689
455
  get type(): EncodedVideoChunkType
690
456
  /** Get the timestamp in microseconds */
@@ -697,7 +463,7 @@ export declare class EncodedVideoChunk {
697
463
  * Copy the encoded data to a BufferSource
698
464
  * W3C spec: throws TypeError if destination is too small
699
465
  */
700
- copyTo(destination: import('./standard').BufferSource): void
466
+ copyTo(destination: BufferSource): void
701
467
  }
702
468
 
703
469
  /**
@@ -854,15 +620,9 @@ export declare class MkvMuxer {
854
620
  */
855
621
  addAudioTrack(config: MkvAudioTrackConfig): void
856
622
  /** Add an encoded video chunk to the muxer */
857
- addVideoChunk(
858
- chunk: import('./standard').EncodedVideoChunk,
859
- metadata?: import('./standard').EncodedVideoChunkMetadata,
860
- ): void
623
+ addVideoChunk(chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadataJs | undefined | null): void
861
624
  /** Add an encoded audio chunk to the muxer */
862
- addAudioChunk(
863
- chunk: import('./standard').EncodedAudioChunk,
864
- metadata?: import('./standard').EncodedAudioChunkMetadata,
865
- ): void
625
+ addAudioChunk(chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadataJs | undefined | null): void
866
626
  /** Flush any buffered data */
867
627
  flush(): void
868
628
  /** Finalize the muxer and return the MKV data */
@@ -993,19 +753,13 @@ export declare class Mp4Muxer {
993
753
  * If metadata contains decoderConfig.description, it will be used to update
994
754
  * the codec extradata (useful for extracting avcC/hvcC from the encoder).
995
755
  */
996
- addVideoChunk(
997
- chunk: import('./standard').EncodedVideoChunk,
998
- metadata?: import('./standard').EncodedVideoChunkMetadata,
999
- ): void
756
+ addVideoChunk(chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadataJs | undefined | null): void
1000
757
  /**
1001
758
  * Add an encoded audio chunk to the muxer
1002
759
  *
1003
760
  * The chunk should come from an AudioEncoder's output callback.
1004
761
  */
1005
- addAudioChunk(
1006
- chunk: import('./standard').EncodedAudioChunk,
1007
- metadata?: import('./standard').EncodedAudioChunkMetadata,
1008
- ): void
762
+ addAudioChunk(chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadataJs | undefined | null): void
1009
763
  /** Flush any buffered data */
1010
764
  flush(): void
1011
765
  /**
@@ -1040,7 +794,7 @@ export declare class Mp4Muxer {
1040
794
  /** Video color space parameters (WebCodecs spec) - as a class per spec */
1041
795
  export declare class VideoColorSpace {
1042
796
  /** Create a new VideoColorSpace */
1043
- constructor(init?: import('./standard').VideoColorSpaceInit)
797
+ constructor(init?: VideoColorSpaceInit | undefined | null)
1044
798
  /** Get color primaries */
1045
799
  get primaries(): VideoColorPrimaries | null
1046
800
  /** Get transfer characteristics */
@@ -1096,7 +850,7 @@ export declare class VideoDecoder {
1096
850
  * The dequeue event fires when decodeQueueSize decreases,
1097
851
  * allowing backpressure management.
1098
852
  */
1099
- set ondequeue(callback?: (() => unknown) | undefined | null)
853
+ set ondequeue(callback: (() => unknown) | undefined | null)
1100
854
  /** Get the dequeue event handler (per WebCodecs spec) */
1101
855
  get ondequeue(): (() => unknown) | null
1102
856
  /**
@@ -1195,7 +949,7 @@ export declare class VideoEncoder {
1195
949
  * The dequeue event fires when encodeQueueSize decreases,
1196
950
  * allowing backpressure management.
1197
951
  */
1198
- set ondequeue(callback?: (() => unknown) | undefined | null)
952
+ set ondequeue(callback: (() => unknown) | undefined | null)
1199
953
  /** Get the dequeue event handler (per WebCodecs spec) */
1200
954
  get ondequeue(): (() => unknown) | null
1201
955
  /** Configure the encoder */
@@ -1400,15 +1154,9 @@ export declare class WebMMuxer {
1400
1154
  */
1401
1155
  addAudioTrack(config: WebMAudioTrackConfig): void
1402
1156
  /** Add an encoded video chunk to the muxer */
1403
- addVideoChunk(
1404
- chunk: import('./standard').EncodedVideoChunk,
1405
- metadata?: import('./standard').EncodedVideoChunkMetadata,
1406
- ): void
1157
+ addVideoChunk(chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadataJs | undefined | null): void
1407
1158
  /** Add an encoded audio chunk to the muxer */
1408
- addAudioChunk(
1409
- chunk: import('./standard').EncodedAudioChunk,
1410
- metadata?: import('./standard').EncodedAudioChunkMetadata,
1411
- ): void
1159
+ addAudioChunk(chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadataJs | undefined | null): void
1412
1160
  /** Flush any buffered data */
1413
1161
  flush(): void
1414
1162
  /** Finalize the muxer and return the WebM data */
@@ -1648,7 +1396,7 @@ export interface EncodedAudioChunkMetadata {
1648
1396
  /** JavaScript-facing metadata type for audio chunks */
1649
1397
  export interface EncodedAudioChunkMetadataJs {
1650
1398
  /** Decoder configuration from encoder */
1651
- decoderConfig?: AudioDecoderConfigJS
1399
+ decoderConfig?: AudioDecoderConfigJs
1652
1400
  }
1653
1401
 
1654
1402
  /** Type of encoded audio chunk */
@@ -1670,9 +1418,9 @@ export interface EncodedVideoChunkMetadata {
1670
1418
  /** JavaScript-facing metadata type for video chunks */
1671
1419
  export interface EncodedVideoChunkMetadataJs {
1672
1420
  /** Decoder configuration from encoder */
1673
- decoderConfig?: VideoDecoderConfigJS
1421
+ decoderConfig?: VideoDecoderConfigJs
1674
1422
  /** SVC output metadata */
1675
- svc?: SvcOutputMetadataJS
1423
+ svc?: SvcOutputMetadataJs
1676
1424
  }
1677
1425
 
1678
1426
  /** Type of encoded video chunk */
package/index.js CHANGED
@@ -78,12 +78,12 @@ function requireNative() {
78
78
  const binding = require('@napi-rs/webcodecs-android-arm64')
79
79
  const bindingPackageVersion = require('@napi-rs/webcodecs-android-arm64/package.json').version
80
80
  if (
81
- bindingPackageVersion !== '1.1.0' &&
81
+ bindingPackageVersion !== '1.2.0' &&
82
82
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
83
83
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
84
84
  ) {
85
85
  throw new Error(
86
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
86
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
87
87
  )
88
88
  }
89
89
  return binding
@@ -100,12 +100,12 @@ function requireNative() {
100
100
  const binding = require('@napi-rs/webcodecs-android-arm-eabi')
101
101
  const bindingPackageVersion = require('@napi-rs/webcodecs-android-arm-eabi/package.json').version
102
102
  if (
103
- bindingPackageVersion !== '1.1.0' &&
103
+ bindingPackageVersion !== '1.2.0' &&
104
104
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
105
105
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
106
106
  ) {
107
107
  throw new Error(
108
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
108
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
109
109
  )
110
110
  }
111
111
  return binding
@@ -130,12 +130,12 @@ function requireNative() {
130
130
  const binding = require('@napi-rs/webcodecs-win32-x64-gnu')
131
131
  const bindingPackageVersion = require('@napi-rs/webcodecs-win32-x64-gnu/package.json').version
132
132
  if (
133
- bindingPackageVersion !== '1.1.0' &&
133
+ bindingPackageVersion !== '1.2.0' &&
134
134
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
135
135
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
136
136
  ) {
137
137
  throw new Error(
138
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
138
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
139
139
  )
140
140
  }
141
141
  return binding
@@ -152,12 +152,12 @@ function requireNative() {
152
152
  const binding = require('@napi-rs/webcodecs-win32-x64-msvc')
153
153
  const bindingPackageVersion = require('@napi-rs/webcodecs-win32-x64-msvc/package.json').version
154
154
  if (
155
- bindingPackageVersion !== '1.1.0' &&
155
+ bindingPackageVersion !== '1.2.0' &&
156
156
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
157
157
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
158
158
  ) {
159
159
  throw new Error(
160
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
160
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
161
161
  )
162
162
  }
163
163
  return binding
@@ -175,12 +175,12 @@ function requireNative() {
175
175
  const binding = require('@napi-rs/webcodecs-win32-ia32-msvc')
176
176
  const bindingPackageVersion = require('@napi-rs/webcodecs-win32-ia32-msvc/package.json').version
177
177
  if (
178
- bindingPackageVersion !== '1.1.0' &&
178
+ bindingPackageVersion !== '1.2.0' &&
179
179
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
180
180
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
181
181
  ) {
182
182
  throw new Error(
183
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
183
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
184
184
  )
185
185
  }
186
186
  return binding
@@ -197,12 +197,12 @@ function requireNative() {
197
197
  const binding = require('@napi-rs/webcodecs-win32-arm64-msvc')
198
198
  const bindingPackageVersion = require('@napi-rs/webcodecs-win32-arm64-msvc/package.json').version
199
199
  if (
200
- bindingPackageVersion !== '1.1.0' &&
200
+ bindingPackageVersion !== '1.2.0' &&
201
201
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
202
202
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
203
203
  ) {
204
204
  throw new Error(
205
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
205
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
206
206
  )
207
207
  }
208
208
  return binding
@@ -222,12 +222,12 @@ function requireNative() {
222
222
  const binding = require('@napi-rs/webcodecs-darwin-universal')
223
223
  const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-universal/package.json').version
224
224
  if (
225
- bindingPackageVersion !== '1.1.0' &&
225
+ bindingPackageVersion !== '1.2.0' &&
226
226
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
227
227
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
228
228
  ) {
229
229
  throw new Error(
230
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
230
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
231
231
  )
232
232
  }
233
233
  return binding
@@ -244,12 +244,12 @@ function requireNative() {
244
244
  const binding = require('@napi-rs/webcodecs-darwin-x64')
245
245
  const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-x64/package.json').version
246
246
  if (
247
- bindingPackageVersion !== '1.1.0' &&
247
+ bindingPackageVersion !== '1.2.0' &&
248
248
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
249
249
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
250
250
  ) {
251
251
  throw new Error(
252
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
252
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
253
253
  )
254
254
  }
255
255
  return binding
@@ -266,12 +266,12 @@ function requireNative() {
266
266
  const binding = require('@napi-rs/webcodecs-darwin-arm64')
267
267
  const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-arm64/package.json').version
268
268
  if (
269
- bindingPackageVersion !== '1.1.0' &&
269
+ bindingPackageVersion !== '1.2.0' &&
270
270
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
271
271
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
272
272
  ) {
273
273
  throw new Error(
274
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
274
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
275
275
  )
276
276
  }
277
277
  return binding
@@ -292,12 +292,12 @@ function requireNative() {
292
292
  const binding = require('@napi-rs/webcodecs-freebsd-x64')
293
293
  const bindingPackageVersion = require('@napi-rs/webcodecs-freebsd-x64/package.json').version
294
294
  if (
295
- bindingPackageVersion !== '1.1.0' &&
295
+ bindingPackageVersion !== '1.2.0' &&
296
296
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
297
297
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
298
298
  ) {
299
299
  throw new Error(
300
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
300
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
301
301
  )
302
302
  }
303
303
  return binding
@@ -314,12 +314,12 @@ function requireNative() {
314
314
  const binding = require('@napi-rs/webcodecs-freebsd-arm64')
315
315
  const bindingPackageVersion = require('@napi-rs/webcodecs-freebsd-arm64/package.json').version
316
316
  if (
317
- bindingPackageVersion !== '1.1.0' &&
317
+ bindingPackageVersion !== '1.2.0' &&
318
318
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
319
319
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
320
320
  ) {
321
321
  throw new Error(
322
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
322
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
323
323
  )
324
324
  }
325
325
  return binding
@@ -341,12 +341,12 @@ function requireNative() {
341
341
  const binding = require('@napi-rs/webcodecs-linux-x64-musl')
342
342
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-x64-musl/package.json').version
343
343
  if (
344
- bindingPackageVersion !== '1.1.0' &&
344
+ bindingPackageVersion !== '1.2.0' &&
345
345
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
346
346
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
347
347
  ) {
348
348
  throw new Error(
349
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
349
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
350
350
  )
351
351
  }
352
352
  return binding
@@ -363,12 +363,12 @@ function requireNative() {
363
363
  const binding = require('@napi-rs/webcodecs-linux-x64-gnu')
364
364
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-x64-gnu/package.json').version
365
365
  if (
366
- bindingPackageVersion !== '1.1.0' &&
366
+ bindingPackageVersion !== '1.2.0' &&
367
367
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
368
368
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
369
369
  ) {
370
370
  throw new Error(
371
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
371
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
372
372
  )
373
373
  }
374
374
  return binding
@@ -387,12 +387,12 @@ function requireNative() {
387
387
  const binding = require('@napi-rs/webcodecs-linux-arm64-musl')
388
388
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm64-musl/package.json').version
389
389
  if (
390
- bindingPackageVersion !== '1.1.0' &&
390
+ bindingPackageVersion !== '1.2.0' &&
391
391
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
392
392
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
393
393
  ) {
394
394
  throw new Error(
395
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
395
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
396
396
  )
397
397
  }
398
398
  return binding
@@ -409,12 +409,12 @@ function requireNative() {
409
409
  const binding = require('@napi-rs/webcodecs-linux-arm64-gnu')
410
410
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm64-gnu/package.json').version
411
411
  if (
412
- bindingPackageVersion !== '1.1.0' &&
412
+ bindingPackageVersion !== '1.2.0' &&
413
413
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
414
414
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
415
415
  ) {
416
416
  throw new Error(
417
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
417
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
418
418
  )
419
419
  }
420
420
  return binding
@@ -433,12 +433,12 @@ function requireNative() {
433
433
  const binding = require('@napi-rs/webcodecs-linux-arm-musleabihf')
434
434
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm-musleabihf/package.json').version
435
435
  if (
436
- bindingPackageVersion !== '1.1.0' &&
436
+ bindingPackageVersion !== '1.2.0' &&
437
437
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
438
438
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
439
439
  ) {
440
440
  throw new Error(
441
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
441
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
442
442
  )
443
443
  }
444
444
  return binding
@@ -455,12 +455,12 @@ function requireNative() {
455
455
  const binding = require('@napi-rs/webcodecs-linux-arm-gnueabihf')
456
456
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm-gnueabihf/package.json').version
457
457
  if (
458
- bindingPackageVersion !== '1.1.0' &&
458
+ bindingPackageVersion !== '1.2.0' &&
459
459
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
460
460
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
461
461
  ) {
462
462
  throw new Error(
463
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
463
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
464
464
  )
465
465
  }
466
466
  return binding
@@ -479,12 +479,12 @@ function requireNative() {
479
479
  const binding = require('@napi-rs/webcodecs-linux-loong64-musl')
480
480
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-loong64-musl/package.json').version
481
481
  if (
482
- bindingPackageVersion !== '1.1.0' &&
482
+ bindingPackageVersion !== '1.2.0' &&
483
483
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
484
484
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
485
485
  ) {
486
486
  throw new Error(
487
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
487
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
488
488
  )
489
489
  }
490
490
  return binding
@@ -501,12 +501,12 @@ function requireNative() {
501
501
  const binding = require('@napi-rs/webcodecs-linux-loong64-gnu')
502
502
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-loong64-gnu/package.json').version
503
503
  if (
504
- bindingPackageVersion !== '1.1.0' &&
504
+ bindingPackageVersion !== '1.2.0' &&
505
505
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
506
506
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
507
507
  ) {
508
508
  throw new Error(
509
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
509
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
510
510
  )
511
511
  }
512
512
  return binding
@@ -525,12 +525,12 @@ function requireNative() {
525
525
  const binding = require('@napi-rs/webcodecs-linux-riscv64-musl')
526
526
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-riscv64-musl/package.json').version
527
527
  if (
528
- bindingPackageVersion !== '1.1.0' &&
528
+ bindingPackageVersion !== '1.2.0' &&
529
529
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
530
530
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
531
531
  ) {
532
532
  throw new Error(
533
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
533
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
534
534
  )
535
535
  }
536
536
  return binding
@@ -547,12 +547,12 @@ function requireNative() {
547
547
  const binding = require('@napi-rs/webcodecs-linux-riscv64-gnu')
548
548
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-riscv64-gnu/package.json').version
549
549
  if (
550
- bindingPackageVersion !== '1.1.0' &&
550
+ bindingPackageVersion !== '1.2.0' &&
551
551
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
552
552
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
553
553
  ) {
554
554
  throw new Error(
555
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
555
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
556
556
  )
557
557
  }
558
558
  return binding
@@ -570,12 +570,12 @@ function requireNative() {
570
570
  const binding = require('@napi-rs/webcodecs-linux-ppc64-gnu')
571
571
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-ppc64-gnu/package.json').version
572
572
  if (
573
- bindingPackageVersion !== '1.1.0' &&
573
+ bindingPackageVersion !== '1.2.0' &&
574
574
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
575
575
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
576
576
  ) {
577
577
  throw new Error(
578
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
578
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
579
579
  )
580
580
  }
581
581
  return binding
@@ -592,12 +592,12 @@ function requireNative() {
592
592
  const binding = require('@napi-rs/webcodecs-linux-s390x-gnu')
593
593
  const bindingPackageVersion = require('@napi-rs/webcodecs-linux-s390x-gnu/package.json').version
594
594
  if (
595
- bindingPackageVersion !== '1.1.0' &&
595
+ bindingPackageVersion !== '1.2.0' &&
596
596
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
597
597
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
598
598
  ) {
599
599
  throw new Error(
600
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
600
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
601
601
  )
602
602
  }
603
603
  return binding
@@ -618,12 +618,12 @@ function requireNative() {
618
618
  const binding = require('@napi-rs/webcodecs-openharmony-arm64')
619
619
  const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-arm64/package.json').version
620
620
  if (
621
- bindingPackageVersion !== '1.1.0' &&
621
+ bindingPackageVersion !== '1.2.0' &&
622
622
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
623
623
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
624
624
  ) {
625
625
  throw new Error(
626
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
626
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
627
627
  )
628
628
  }
629
629
  return binding
@@ -640,12 +640,12 @@ function requireNative() {
640
640
  const binding = require('@napi-rs/webcodecs-openharmony-x64')
641
641
  const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-x64/package.json').version
642
642
  if (
643
- bindingPackageVersion !== '1.1.0' &&
643
+ bindingPackageVersion !== '1.2.0' &&
644
644
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
645
645
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
646
646
  ) {
647
647
  throw new Error(
648
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
648
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
649
649
  )
650
650
  }
651
651
  return binding
@@ -662,12 +662,12 @@ function requireNative() {
662
662
  const binding = require('@napi-rs/webcodecs-openharmony-arm')
663
663
  const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-arm/package.json').version
664
664
  if (
665
- bindingPackageVersion !== '1.1.0' &&
665
+ bindingPackageVersion !== '1.2.0' &&
666
666
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
667
667
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
668
668
  ) {
669
669
  throw new Error(
670
- `Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
670
+ `Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
671
671
  )
672
672
  }
673
673
  return binding
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napi-rs/webcodecs",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "WebCodecs API implementation for Node.js using FFmpeg",
5
5
  "keywords": [
6
6
  "N-API",
@@ -54,7 +54,7 @@
54
54
  "lint": "oxlint --type-aware",
55
55
  "prepublishOnly": "napi prepublish -t npm",
56
56
  "test": "ava",
57
- "typecheck": "tsc -b tsconfig.json",
57
+ "typecheck": "tsc -b tsconfig.json && tsc ./index.d.ts",
58
58
  "preversion": "napi build --platform && git add .",
59
59
  "version": "napi version"
60
60
  },
@@ -151,14 +151,14 @@
151
151
  "registry": "https://registry.npmjs.org/"
152
152
  },
153
153
  "optionalDependencies": {
154
- "@napi-rs/webcodecs-darwin-x64": "1.1.0",
155
- "@napi-rs/webcodecs-darwin-arm64": "1.1.0",
156
- "@napi-rs/webcodecs-linux-x64-gnu": "1.1.0",
157
- "@napi-rs/webcodecs-linux-x64-musl": "1.1.0",
158
- "@napi-rs/webcodecs-win32-x64-msvc": "1.1.0",
159
- "@napi-rs/webcodecs-linux-arm64-gnu": "1.1.0",
160
- "@napi-rs/webcodecs-linux-arm64-musl": "1.1.0",
161
- "@napi-rs/webcodecs-win32-arm64-msvc": "1.1.0",
162
- "@napi-rs/webcodecs-linux-arm-gnueabihf": "1.1.0"
154
+ "@napi-rs/webcodecs-darwin-x64": "1.2.0",
155
+ "@napi-rs/webcodecs-darwin-arm64": "1.2.0",
156
+ "@napi-rs/webcodecs-linux-x64-gnu": "1.2.0",
157
+ "@napi-rs/webcodecs-linux-x64-musl": "1.2.0",
158
+ "@napi-rs/webcodecs-win32-x64-msvc": "1.2.0",
159
+ "@napi-rs/webcodecs-linux-arm64-gnu": "1.2.0",
160
+ "@napi-rs/webcodecs-linux-arm64-musl": "1.2.0",
161
+ "@napi-rs/webcodecs-win32-arm64-msvc": "1.2.0",
162
+ "@napi-rs/webcodecs-linux-arm-gnueabihf": "1.2.0"
163
163
  }
164
164
  }