@pexip/media-processor 21.0.0 → 22.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.
Files changed (170) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +17 -10
  3. package/api-docs/README.mdx +40 -19
  4. package/api-docs/functions/assertMediaStreamVideoTrack.mdx +13 -0
  5. package/api-docs/functions/avg.mdx +1 -1
  6. package/api-docs/functions/createAnalyzerGraphNode.mdx +3 -1
  7. package/api-docs/functions/createAnalyzerSubscribableGraphNode.mdx +3 -1
  8. package/api-docs/functions/createAsyncCallbackLoop.mdx +6 -6
  9. package/api-docs/functions/createAudioDestinationGraphNode.mdx +1 -1
  10. package/api-docs/functions/createAudioSignalDetector.mdx +4 -4
  11. package/api-docs/functions/createAudioStats.mdx +1 -1
  12. package/api-docs/functions/createChannelMergerGraphNode.mdx +1 -1
  13. package/api-docs/functions/createChannelSplitterGraphNode.mdx +1 -1
  14. package/api-docs/functions/createDelayGraphNode.mdx +1 -1
  15. package/api-docs/functions/createDenoiseWorkletGraphNode.mdx +2 -2
  16. package/api-docs/functions/createFrameCallbackRequest.mdx +10 -4
  17. package/api-docs/functions/createGainGraphNode.mdx +3 -1
  18. package/api-docs/functions/createMediaElementSourceGraphNode.mdx +1 -1
  19. package/api-docs/functions/createMediaStreamTrackInputProcessAdaptor.mdx +10 -0
  20. package/api-docs/functions/createReadWritableStreamFallbackInputProcessAdaptor.mdx +17 -0
  21. package/api-docs/functions/createReadWritableStreamInputProcessAdaptor.mdx +10 -0
  22. package/api-docs/functions/createSegmenter.mdx +1 -1
  23. package/api-docs/functions/createStreamDestinationGraphNode.mdx +1 -1
  24. package/api-docs/functions/createStreamSourceGraphNode.mdx +1 -1
  25. package/api-docs/functions/createVADetector.mdx +3 -3
  26. package/api-docs/functions/createVideoProcessor.mdx +3 -3
  27. package/api-docs/functions/createVoiceDetectorFromProbability.mdx +1 -1
  28. package/api-docs/functions/createVoiceDetectorFromTimeData.mdx +3 -1
  29. package/api-docs/functions/createWindowedStats.mdx +2 -2
  30. package/api-docs/functions/getBezierCurveControlPoints.mdx +3 -1
  31. package/api-docs/functions/getDefaultInputProcessAdaptor.mdx +17 -0
  32. package/api-docs/functions/isMediaStreamVideoTrack.mdx +13 -0
  33. package/api-docs/functions/labelComponents.mdx +3 -1
  34. package/api-docs/functions/loadScript.mdx +1 -1
  35. package/api-docs/functions/loadWasms.mdx +1 -1
  36. package/api-docs/functions/nearestPowerOfTwo.mdx +1 -1
  37. package/api-docs/functions/playVideo.mdx +7 -5
  38. package/api-docs/functions/processAverageVolume.mdx +1 -1
  39. package/api-docs/functions/rms.mdx +1 -1
  40. package/api-docs/functions/subscribeWorkletNode.mdx +1 -1
  41. package/api-docs/functions/sum.mdx +1 -1
  42. package/api-docs/interfaces/Analyzer.mdx +4 -0
  43. package/api-docs/interfaces/AnalyzerSubscribableOptions.mdx +5 -3
  44. package/api-docs/interfaces/AudioGraph.mdx +2 -2
  45. package/api-docs/interfaces/AudioNodeInit.mdx +10 -6
  46. package/api-docs/interfaces/AudioNodeProps.mdx +3 -3
  47. package/api-docs/interfaces/Benchmark.mdx +17 -3
  48. package/api-docs/interfaces/Clock.mdx +1 -1
  49. package/api-docs/interfaces/Denoise.mdx +2 -2
  50. package/api-docs/interfaces/FrameTransformStats.mdx +9 -0
  51. package/api-docs/interfaces/Gain.mdx +4 -0
  52. package/api-docs/interfaces/ImageSegmenterOptions.mdx +0 -2
  53. package/api-docs/interfaces/InputProcessAdaptor.mdx +32 -0
  54. package/api-docs/interfaces/MPMask.mdx +1 -1
  55. package/api-docs/interfaces/Process.mdx +12 -7
  56. package/api-docs/interfaces/ProcessEventMute.mdx +6 -0
  57. package/api-docs/interfaces/ProcessWorkerDebugMessage.mdx +1 -1
  58. package/api-docs/interfaces/ProcessWorkerEventClosed.mdx +5 -0
  59. package/api-docs/interfaces/ProcessWorkerEventOpened.mdx +7 -0
  60. package/api-docs/interfaces/ProcessWorkerEventStats.mdx +6 -0
  61. package/api-docs/interfaces/ProcessWorkerEventUpdated.mdx +7 -0
  62. package/api-docs/interfaces/ProcessorEvent.mdx +3 -2
  63. package/api-docs/interfaces/ProcessorOptions.mdx +0 -1
  64. package/api-docs/interfaces/ProcessorProcessOptions.mdx +3 -1
  65. package/api-docs/interfaces/ProcessorUpdateOptions.mdx +17 -0
  66. package/api-docs/interfaces/ReadWritableStream.mdx +12 -0
  67. package/api-docs/interfaces/RenderEventHandlers.mdx +3 -3
  68. package/api-docs/interfaces/Renderer.mdx +5 -3
  69. package/api-docs/interfaces/RendererOptions.mdx +5 -9
  70. package/api-docs/interfaces/Runner.mdx +3 -3
  71. package/api-docs/interfaces/Segmentation.mdx +1 -1
  72. package/api-docs/interfaces/Segmenter.mdx +115 -16
  73. package/api-docs/interfaces/SegmenterOptions.mdx +0 -1
  74. package/api-docs/interfaces/VideoFrameLike.mdx +1 -1
  75. package/api-docs/interfaces/VideoProcessor.mdx +52 -8
  76. package/api-docs/interfaces/WorkletMessagePortOptions.mdx +2 -2
  77. package/api-docs/type-aliases/AsyncCallback.mdx +1 -1
  78. package/api-docs/type-aliases/Callback.mdx +2 -2
  79. package/api-docs/type-aliases/ExtractMessageEventType.mdx +1 -1
  80. package/api-docs/type-aliases/IncludeMessageEventDataType.mdx +1 -1
  81. package/api-docs/type-aliases/Logger.mdx +12 -0
  82. package/api-docs/type-aliases/OptionalKeys.mdx +1 -1
  83. package/api-docs/type-aliases/ProcessEvents.mdx +1 -0
  84. package/api-docs/type-aliases/ProcessInputType.mdx +3 -1
  85. package/api-docs/type-aliases/ProcessWorkerEvents.mdx +7 -4
  86. package/api-docs/type-aliases/ProcessorWorkerEvents.mdx +1 -1
  87. package/api-docs/type-aliases/RunnerCreator.mdx +3 -3
  88. package/api-docs/type-aliases/Struct.mdx +9 -0
  89. package/api-docs/type-aliases/TupleOf.mdx +1 -1
  90. package/api-docs/variables/FRAME_RATE.mdx +1 -1
  91. package/api-docs/variables/ImageFetchError.mdx +3 -0
  92. package/api-docs/variables/MediaStreamTrackTransferable.mdx +5 -0
  93. package/api-docs/variables/RENDERER_OPTIONS_STRUCT.mdx +3 -0
  94. package/api-docs/variables/cloneImageRecord.mdx +21 -0
  95. package/api-docs/variables/compareImageRecords.mdx +18 -0
  96. package/api-docs/variables/createLazyProps.mdx +1 -1
  97. package/api-docs/variables/createObjectUpdater.mdx +2 -2
  98. package/api-docs/variables/createRemoteImageBitmap.mdx +5 -5
  99. package/api-docs/variables/handleWebGLContextLoss.mdx +1 -1
  100. package/api-docs/variables/isRenderOptionsKey.mdx +13 -0
  101. package/api-docs/variables/isValidGpuAPI.mdx +13 -0
  102. package/api-docs/variables/urls.mdx +2 -2
  103. package/dist/common/backends/webgl/renderer.js +2 -12
  104. package/dist/common/backends/webgl/texture.d.ts +1 -2
  105. package/dist/common/backends/webgl/texture.js +2 -2
  106. package/dist/common/backends/webgl/webglUtils.js +8 -4
  107. package/dist/common/backends/webgpu/renderer.js +2 -12
  108. package/dist/common/backends/webgpu/tentBlur.js +1 -1
  109. package/dist/common/backends/webgpu/texture.d.ts +1 -2
  110. package/dist/common/backends/webgpu/texture.js +6 -2
  111. package/dist/common/constants.d.ts +3 -0
  112. package/dist/common/constants.js +4 -0
  113. package/dist/common/index.d.ts +1 -0
  114. package/dist/common/index.js +1 -0
  115. package/dist/common/tsconfig.tsbuildinfo +1 -1
  116. package/dist/common/typeGuards.d.ts +2 -0
  117. package/dist/common/typeGuards.js +7 -0
  118. package/dist/common/types/media.d.ts +5 -1
  119. package/dist/common/types/messageEvents.d.ts +34 -4
  120. package/dist/common/types/processor.d.ts +7 -4
  121. package/dist/common/types/render.d.ts +5 -2
  122. package/dist/common/types/render.js +23 -1
  123. package/dist/common/types/segmentation.d.ts +0 -12
  124. package/dist/common/utils.d.ts +13 -2
  125. package/dist/common/utils.js +54 -10
  126. package/dist/main/audio.js +3 -3
  127. package/dist/main/benchUtils.d.ts +2 -2
  128. package/dist/main/benchUtils.js +4 -4
  129. package/dist/main/index.d.ts +1 -1
  130. package/dist/main/index.js +1 -1
  131. package/dist/main/tsconfig.tsbuildinfo +1 -1
  132. package/dist/main/types.d.ts +0 -6
  133. package/dist/main/utils.d.ts +4 -0
  134. package/dist/main/utils.js +31 -0
  135. package/dist/main/video/constants.d.ts +1 -4
  136. package/dist/main/video/constants.js +1 -5
  137. package/dist/main/video/index.d.ts +2 -3
  138. package/dist/main/video/index.js +2 -3
  139. package/dist/main/video/inputProcessAdaptor.d.ts +30 -0
  140. package/dist/main/video/inputProcessAdaptor.js +198 -0
  141. package/dist/main/video/segmenter.d.ts +42 -0
  142. package/dist/main/video/{segmenters/mediapipe.js → segmenter.js} +130 -75
  143. package/dist/main/video/typeGuards.d.ts +2 -0
  144. package/dist/main/video/typeGuards.js +8 -1
  145. package/dist/main/video/types.d.ts +37 -17
  146. package/dist/main/video/utils.d.ts +5 -4
  147. package/dist/main/video/utils.js +49 -44
  148. package/dist/main/video/video.d.ts +30 -8
  149. package/dist/main/video/video.js +338 -32
  150. package/dist/workers/mediaWorker.js +24 -24
  151. package/dist/workers/tsconfig.tsbuildinfo +1 -1
  152. package/dist/worklets/tsconfig.tsbuildinfo +1 -1
  153. package/package.json +8 -8
  154. package/api-docs/functions/createCanvasTransform.mdx +0 -14
  155. package/api-docs/functions/createVideoTrackProcessor.mdx +0 -9
  156. package/api-docs/functions/createVideoTrackProcessorWithFallback.mdx +0 -15
  157. package/api-docs/interfaces/Detector.mdx +0 -81
  158. package/api-docs/interfaces/SegmentationParams.mdx +0 -35
  159. package/api-docs/interfaces/Transform.mdx +0 -62
  160. package/api-docs/type-aliases/ProcessVideoTrack.mdx +0 -15
  161. package/api-docs/type-aliases/SegmentationTransform.mdx +0 -3
  162. package/dist/main/transformer.d.ts +0 -1
  163. package/dist/main/transformer.js +0 -4
  164. package/dist/main/video/canvasTransform.d.ts +0 -17
  165. package/dist/main/video/canvasTransform.js +0 -341
  166. package/dist/main/video/segmenters/mediapipe.d.ts +0 -22
  167. package/dist/main/video/transformer.d.ts +0 -9
  168. package/dist/main/video/transformer.js +0 -68
  169. package/dist/main/video/videoStreamTrackProcessor.d.ts +0 -20
  170. package/dist/main/video/videoStreamTrackProcessor.js +0 -86
@@ -12,7 +12,9 @@ A function to check provided time series data is considered as voice activity
12
12
 
13
13
  ## Returns
14
14
 
15
- [`IsVoice`](../type-aliases/IsVoice.mdx)\<`number`[]\>
15
+ ```ts
16
+ IsVoice<number[]>
17
+ ```
16
18
 
17
19
  ## See
18
20
 
@@ -14,10 +14,10 @@ function createWindowedStats(windowSize): object;
14
14
 
15
15
  | Name | Type |
16
16
  | ------ | ------ |
17
- | `add()` | (`value`) => `void` |
17
+ | `add()` | `(value) => void` |
18
18
  | `get mean` | `number` |
19
19
  | `get variance` | `number` |
20
20
  | `get stddev` | `number` |
21
21
  | `get stdError` | `number` |
22
22
  | `get count` | `number` |
23
- | `clear()` | () => `void` |
23
+ | `clear()` | `() => void` |
@@ -18,7 +18,9 @@ Spline Interpolation for Bezier Curve
18
18
 
19
19
  ## Returns
20
20
 
21
- \[[`Point`](../interfaces/Point.mdx), [`Point`](../interfaces/Point.mdx)\]
21
+ ```ts
22
+ [Point, Point]
23
+ ```
22
24
 
23
25
  ## Remarks
24
26
 
@@ -0,0 +1,17 @@
1
+ ```ts
2
+ function getDefaultInputProcessAdaptor(tryNativeAPI, targetFrameRate): InputProcessAdaptor;
3
+ ```
4
+
5
+ Get the supported InputProcessAdaptor based on feature detection
6
+ and preference provided
7
+
8
+ ## Parameters
9
+
10
+ | Parameter | Type | Default value | Description |
11
+ | ------ | ------ | ------ | ------ |
12
+ | `tryNativeAPI` | `boolean` | `true` | Whether or not to try to use the Native MediaStreamTrackProcessor APIs |
13
+ | `targetFrameRate` | `number` | `FRAME_RATE` | The target frame rate to use when fallback implementation of video frame extraction rate |
14
+
15
+ ## Returns
16
+
17
+ [`InputProcessAdaptor`](../interfaces/InputProcessAdaptor.mdx)
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ function isMediaStreamVideoTrack(t): t is MediaStreamVideoTrack;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `t` | `MediaStreamTrack` |
10
+
11
+ ## Returns
12
+
13
+ `t is MediaStreamVideoTrack`
@@ -17,4 +17,6 @@ height): Map<number, Stats>;
17
17
 
18
18
  ## Returns
19
19
 
20
- `Map`\<`number`, [`Stats`](../interfaces/Stats.mdx)\>
20
+ ```ts
21
+ Map<number, Stats>
22
+ ```
@@ -11,4 +11,4 @@ function loadScript(path, id): Promise<void>;
11
11
 
12
12
  ## Returns
13
13
 
14
- `Promise`\<`void`\>
14
+ `Promise<void>`
@@ -10,4 +10,4 @@ function loadWasms(paths): Promise<void>;
10
10
 
11
11
  ## Returns
12
12
 
13
- `Promise`\<`void`\>
13
+ `Promise<void>`
@@ -6,7 +6,7 @@ function nearestPowerOfTwo(
6
6
  ```
7
7
 
8
8
  Coerce any positive number to the nearest power of two within [minPow, maxPow]
9
- Example: nearestPowerOfTwo(13) => 16; nearestPowerOfTwo(3.2) => 4
9
+ Example: nearestPowerOfTwo(13) =\> 16; nearestPowerOfTwo(3.2) =\> 4
10
10
 
11
11
  ## Parameters
12
12
 
@@ -1,5 +1,5 @@
1
1
  ```ts
2
- function playVideo(video, __namedParameters): Promise<void>;
2
+ function playVideo(video, __namedParameters): Promise<[void, void]> | undefined;
3
3
  ```
4
4
 
5
5
  ## Parameters
@@ -7,10 +7,12 @@ function playVideo(video, __namedParameters): Promise<void>;
7
7
  | Parameter | Type |
8
8
  | ------ | ------ |
9
9
  | `video` | `HTMLVideoElement` |
10
- | `__namedParameters` | \{ `setTimeout?`: (`handler`, `timeout?`, ...`arguments`) => `number` & (`handler`, `timeout?`, ...`arguments`) => `number`; `clearTimeout?`: (`id`) => `void` & (`id`) => `void`; \} |
11
- | `__namedParameters.setTimeout?` | (`handler`, `timeout?`, ...`arguments`) => `number` & (`handler`, `timeout?`, ...`arguments`) => `number` |
12
- | `__namedParameters.clearTimeout?` | (`id`) => `void` & (`id`) => `void` |
10
+ | `__namedParameters` | `{ setTimeout?: (handler, timeout?, ...arguments) => number & (handler, timeout?, ...arguments) => number; clearTimeout?: (id) => void & (id) => void; }` |
11
+ | `__namedParameters.setTimeout?` | `(handler, timeout?, ...arguments) => number & (handler, timeout?, ...arguments) => number` |
12
+ | `__namedParameters.clearTimeout?` | `(id) => void & (id) => void` |
13
13
 
14
14
  ## Returns
15
15
 
16
- `Promise`\<`void`\>
16
+ ```ts
17
+ Promise<[void, void]> | undefined
18
+ ```
@@ -8,7 +8,7 @@ function processAverageVolume(data): number;
8
8
 
9
9
  | Parameter | Type |
10
10
  | ------ | ------ |
11
- | `data` | `number`[] |
11
+ | `data` | `number[]` |
12
12
 
13
13
  ## Returns
14
14
 
@@ -8,7 +8,7 @@ Calculate the Root Mean Square from provided numbers
8
8
 
9
9
  | Parameter | Type | Description |
10
10
  | ------ | ------ | ------ |
11
- | `nums` | `number`[] | An array of numbers |
11
+ | `nums` | `number[]` | An array of numbers |
12
12
 
13
13
  ## Returns
14
14
 
@@ -15,7 +15,7 @@ Subscribe MessagePort message from an AudioWorkletNode
15
15
  | Parameter | Type | Description |
16
16
  | ------ | ------ | ------ |
17
17
  | `workletNode` | `AudioWorkletNode` | the node to subscribe |
18
- | `options` | `Partial`\<[`WorkletMessagePortOptions`](../interfaces/WorkletMessagePortOptions.mdx)\<`T`\>\> | can pass a message handler here to handle the message |
18
+ | `options` | `Partial`\<[`WorkletMessagePortOptions<T>`](../interfaces/WorkletMessagePortOptions.mdx)\> | can pass a message handler here to handle the message |
19
19
 
20
20
  ## Returns
21
21
 
@@ -8,7 +8,7 @@ Sum an array of numbers
8
8
 
9
9
  | Parameter | Type | Description |
10
10
  | ------ | ------ | ------ |
11
- | `nums` | `number`[] | An array of numbers |
11
+ | `nums` | `number[]` | An array of numbers |
12
12
 
13
13
  ## Returns
14
14
 
@@ -163,6 +163,8 @@ connect(
163
163
  input?): AudioNode;
164
164
  ```
165
165
 
166
+ The **`connect()`** method of the AudioNode interface lets you connect one of the node's outputs to a target, which may be either another AudioNode (thereby directing the sound data to the specified node) or an AudioParam, so that the node's output data is automatically used to change the value of that parameter over time.
167
+
166
168
  [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/connect)
167
169
 
168
170
  ##### Parameters
@@ -216,6 +218,8 @@ BaseAudioNode.connect
216
218
  disconnect(): void;
217
219
  ```
218
220
 
221
+ The **`disconnect()`** method of the AudioNode interface lets you disconnect one or more nodes from the node on which the method is called.
222
+
219
223
  [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/disconnect)
220
224
 
221
225
  ##### Returns
@@ -1,11 +1,13 @@
1
1
  ## Extends
2
2
 
3
- - [`SubscribableOptions`](SubscribableOptions.mdx).[`WorkletMessagePortOptions`](WorkletMessagePortOptions.mdx)\<[`Analyzer`](Analyzer.mdx)\>
3
+ ```ts
4
+ - SubscribableOptions.WorkletMessagePortOptions<Analyzer>
5
+ ```
4
6
 
5
7
  ## Properties
6
8
 
7
9
  | Property | Type | Inherited from |
8
10
  | ------ | ------ | ------ |
9
11
  | <a id="updatefrequency"></a> `updateFrequency?` | `number` | [`SubscribableOptions`](SubscribableOptions.mdx).[`updateFrequency`](SubscribableOptions.mdx#updatefrequency) |
10
- | <a id="messagehandler"></a> `messageHandler` | (`message`) => `void` | [`WorkletMessagePortOptions`](WorkletMessagePortOptions.mdx).[`messageHandler`](WorkletMessagePortOptions.mdx#messagehandler) |
11
- | <a id="errorhandler"></a> `errorHandler?` | (`event`) => `void` | [`WorkletMessagePortOptions`](WorkletMessagePortOptions.mdx).[`errorHandler`](WorkletMessagePortOptions.mdx#errorhandler) |
12
+ | <a id="messagehandler"></a> `messageHandler` | `(message) => void` | [`WorkletMessagePortOptions`](WorkletMessagePortOptions.mdx).[`messageHandler`](WorkletMessagePortOptions.mdx#messagehandler) |
13
+ | <a id="errorhandler"></a> `errorHandler?` | `(event) => void` | [`WorkletMessagePortOptions`](WorkletMessagePortOptions.mdx).[`errorHandler`](WorkletMessagePortOptions.mdx#errorhandler) |
@@ -59,7 +59,7 @@ addWorklet(moduleURL, options?): Promise<void>;
59
59
 
60
60
  #### Returns
61
61
 
62
- `Promise`\<`void`\>
62
+ `Promise<void>`
63
63
 
64
64
  ***
65
65
 
@@ -89,4 +89,4 @@ release(): Promise<void>;
89
89
 
90
90
  #### Returns
91
91
 
92
- `Promise`\<`void`\>
92
+ `Promise<void>`
@@ -1,12 +1,14 @@
1
1
  ## Extends
2
2
 
3
- - `Readonly`\<[`AudioNodeProps`](AudioNodeProps.mdx)\<`T`, `R`\>\>
3
+ ```ts
4
+ - Readonly<AudioNodeProps<T, R>>
5
+ ```
4
6
 
5
7
  ## Type Parameters
6
8
 
7
9
  | Type Parameter | Default type |
8
10
  | ------ | ------ |
9
- | `T` *extends* `AudioNode` | `AudioNode` |
11
+ | `T extends AudioNode` | `AudioNode` |
10
12
  | `R` *extends* [`BaseAudioNode`](../type-aliases/BaseAudioNode.mdx) | [`BaseAudioNode`](../type-aliases/BaseAudioNode.mdx) |
11
13
 
12
14
  ## Properties
@@ -14,10 +16,10 @@
14
16
  | Property | Modifier | Type | Inherited from |
15
17
  | ------ | ------ | ------ | ------ |
16
18
  | <a id="name"></a> `name` | `readonly` | `string` | `Readonly.name` |
17
- | <a id="node"></a> `node` | `readonly` | `R` \| `undefined` | `Readonly.node` |
18
- | <a id="audionode"></a> `audioNode` | `readonly` | `T` \| `undefined` | `Readonly.audioNode` |
19
+ | <a id="node"></a> `node` | `readonly` | `R \| undefined` | `Readonly.node` |
20
+ | <a id="audionode"></a> `audioNode` | `readonly` | `T \| undefined` | `Readonly.audioNode` |
19
21
  | <a id="outputs"></a> `outputs` | `readonly` | `WeakSet`\< \| `AudioNodeInit`\<`AudioNode`, [`BaseAudioNode`](../type-aliases/BaseAudioNode.mdx)\> \| `AudioParam`\> | `Readonly.outputs` |
20
- | <a id="tojson"></a> `toJSON?` | `public` | () => `unknown` | - |
22
+ | <a id="tojson"></a> `toJSON?` | `public` | `() => unknown` | - |
21
23
 
22
24
  ## Methods
23
25
 
@@ -41,7 +43,9 @@ Should ONLY be CALLED inside an AudioGraph
41
43
 
42
44
  #### Returns
43
45
 
44
- \[`T`, `R`\]
46
+ ```ts
47
+ [T, R]
48
+ ```
45
49
 
46
50
  ***
47
51
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  | Type Parameter |
4
4
  | ------ |
5
- | `T` *extends* `AudioNode` |
5
+ | `T extends AudioNode` |
6
6
  | `R` *extends* [`BaseAudioNode`](../type-aliases/BaseAudioNode.mdx) |
7
7
 
8
8
  ## Properties
@@ -10,6 +10,6 @@
10
10
  | Property | Type |
11
11
  | ------ | ------ |
12
12
  | <a id="name"></a> `name` | `string` |
13
- | <a id="node"></a> `node` | `R` \| `undefined` |
14
- | <a id="audionode"></a> `audioNode` | `T` \| `undefined` |
13
+ | <a id="node"></a> `node` | `R \| undefined` |
14
+ | <a id="audionode"></a> `audioNode` | `T \| undefined` |
15
15
  | <a id="outputs"></a> `outputs` | `WeakSet`\< \| [`AudioNodeInit`](AudioNodeInit.mdx)\<`AudioNode`, [`BaseAudioNode`](../type-aliases/BaseAudioNode.mdx)\> \| `AudioParam`\> |
@@ -3,9 +3,15 @@
3
3
  ### begin()
4
4
 
5
5
  ```ts
6
- begin(): void;
6
+ begin(timestamp?): void;
7
7
  ```
8
8
 
9
+ #### Parameters
10
+
11
+ | Parameter | Type |
12
+ | ------ | ------ |
13
+ | `timestamp?` | `number` |
14
+
9
15
  #### Returns
10
16
 
11
17
  `void`
@@ -15,9 +21,15 @@ begin(): void;
15
21
  ### end()
16
22
 
17
23
  ```ts
18
- end(): void;
24
+ end(timestamp?): void;
19
25
  ```
20
26
 
27
+ #### Parameters
28
+
29
+ | Parameter | Type |
30
+ | ------ | ------ |
31
+ | `timestamp?` | `number` |
32
+
21
33
  #### Returns
22
34
 
23
35
  `void`
@@ -44,4 +56,6 @@ calculateFps(): [number, number];
44
56
 
45
57
  #### Returns
46
58
 
47
- \[`number`, `number`\]
59
+ ```ts
60
+ [number, number]
61
+ ```
@@ -8,4 +8,4 @@ Performance['now']
8
8
 
9
9
  | Property | Type |
10
10
  | ------ | ------ |
11
- | <a id="now"></a> `now` | () => `number` |
11
+ | <a id="now"></a> `now` | `() => number` |
@@ -42,8 +42,8 @@ pipe(inputs, outputs): void;
42
42
 
43
43
  | Parameter | Type |
44
44
  | ------ | ------ |
45
- | `inputs` | `Float32Array`\<`ArrayBufferLike`\>[][] |
46
- | `outputs` | `Float32Array`\<`ArrayBufferLike`\>[][] |
45
+ | `inputs` | `Float32Array<ArrayBufferLike>[]`[] |
46
+ | `outputs` | `Float32Array<ArrayBufferLike>[]`[] |
47
47
 
48
48
  #### Returns
49
49
 
@@ -0,0 +1,9 @@
1
+ Frame transform statistic, i.e. the timing data for processing each frame
2
+
3
+ ## Properties
4
+
5
+ | Property | Type | Description |
6
+ | ------ | ------ | ------ |
7
+ | <a id="start"></a> `start` | `number` | Start time of the transform |
8
+ | <a id="end"></a> `end` | `number` | End time of the transform |
9
+ | <a id="segmentation"></a> `segmentation?` | `number` | Segmentation inference end time |
@@ -22,6 +22,8 @@ connect(
22
22
  input?): AudioNode;
23
23
  ```
24
24
 
25
+ The **`connect()`** method of the AudioNode interface lets you connect one of the node's outputs to a target, which may be either another AudioNode (thereby directing the sound data to the specified node) or an AudioParam, so that the node's output data is automatically used to change the value of that parameter over time.
26
+
25
27
  [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/connect)
26
28
 
27
29
  ##### Parameters
@@ -75,6 +77,8 @@ BaseAudioNode.connect
75
77
  disconnect(): void;
76
78
  ```
77
79
 
80
+ The **`disconnect()`** method of the AudioNode interface lets you disconnect one or more nodes from the node on which the method is called.
81
+
78
82
  [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/disconnect)
79
83
 
80
84
  ##### Returns
@@ -2,7 +2,5 @@
2
2
 
3
3
  | Property | Type | Description |
4
4
  | ------ | ------ | ------ |
5
- | <a id="canvas"></a> `canvas?` | `OffscreenCanvas` | The canvas element to bind textures to. This has to be set for GPU processing. The task will initialize a WebGL or WebGPU context and throw an error if this fails (e.g. if you have already initialized a different type of context). |
6
- | <a id="segmentercanvas"></a> `segmenterCanvas?` | `OffscreenCanvas` | The Google TaskVision segmentation model only works with WebGl so we need a separate canvas for this. |
7
5
  | <a id="modelasset"></a> `modelAsset?` | [`SegmentationModelAsset`](SegmentationModelAsset.mdx) | - |
8
6
  | <a id="delegate"></a> `delegate?` | [`Delegate`](../type-aliases/Delegate.mdx) | Overrides the default backend to use for the provided model. |
@@ -0,0 +1,32 @@
1
+ ## Properties
2
+
3
+ | Property | Type | Description |
4
+ | ------ | ------ | ------ |
5
+ | <a id="outputtrack"></a> `outputTrack?` | `MediaStreamTrack` | The generated track from the `adapt` function, and only available after calling the `adapt` method otherwise `undefined` |
6
+
7
+ ## Methods
8
+
9
+ ### adapt()
10
+
11
+ ```ts
12
+ adapt(track):
13
+ | MediaStreamTrack
14
+ | ReadWritableStream<VideoFrame>;
15
+ ```
16
+
17
+ Adapt the provided input track based on browser capabilities.
18
+
19
+ #### Parameters
20
+
21
+ | Parameter | Type |
22
+ | ------ | ------ |
23
+ | `track` | `MediaStreamTrack` |
24
+
25
+ #### Returns
26
+
27
+ ```ts
28
+ | MediaStreamTrack
29
+ ```
30
+ ```ts
31
+ | ReadWritableStream<VideoFrame>
32
+ ```
@@ -4,7 +4,7 @@ Wrapper for a mask produced by a Segmentation Task.
4
4
 
5
5
  | Property | Modifier | Type | Description |
6
6
  | ------ | ------ | ------ | ------ |
7
- | <a id="canvas"></a> `canvas` | `readonly` | `OffscreenCanvas` \| `undefined` | Returns the canvas element that the mask is bound to. |
7
+ | <a id="canvas"></a> `canvas` | `readonly` | `OffscreenCanvas \| undefined` | Returns the canvas element that the mask is bound to. |
8
8
  | <a id="width"></a> `width` | `readonly` | `number` | Returns the width of the mask. |
9
9
  | <a id="height"></a> `height` | `readonly` | `number` | Returns the height of the mask. |
10
10
 
@@ -1,37 +1,42 @@
1
1
  ## Extended by
2
2
 
3
3
  - [`Segmenter`](Segmenter.mdx)
4
- - [`Detector`](Detector.mdx)
4
+
5
+ ## Type Parameters
6
+
7
+ | Type Parameter |
8
+ | ------ |
9
+ | `T` |
5
10
 
6
11
  ## Properties
7
12
 
8
13
  | Property | Type |
9
14
  | ------ | ------ |
10
- | <a id="status"></a> `status` | \| `"closed"` \| `"closing"` \| `"Error"` \| `"destroyed"` \| `"destroying"` \| `"idle"` \| `"new"` \| `"opened"` \| `"opening"` \| `"processing"` \| `"updated"` \| `"updating"` |
15
+ | <a id="status"></a> `status` | `\| "closed" \| "closing" \| "Error" \| "destroyed" \| "destroying" \| "idle" \| "new" \| "opened" \| "opening" \| "processing" \| "updated" \| "updating"` |
11
16
 
12
17
  ## Methods
13
18
 
14
19
  ### open()
15
20
 
16
21
  ```ts
17
- open(): Promise<void>;
22
+ open(): Promise<T>;
18
23
  ```
19
24
 
20
25
  #### Returns
21
26
 
22
- `Promise`\<`void`\>
27
+ `Promise<T>`
23
28
 
24
29
  ***
25
30
 
26
31
  ### close()
27
32
 
28
33
  ```ts
29
- close(): void;
34
+ close(): Promise<void>;
30
35
  ```
31
36
 
32
37
  #### Returns
33
38
 
34
- `void`
39
+ `Promise<void>`
35
40
 
36
41
  ***
37
42
 
@@ -43,4 +48,4 @@ destroy(): Promise<void>;
43
48
 
44
49
  #### Returns
45
50
 
46
- `Promise`\<`void`\>
51
+ `Promise<void>`
@@ -0,0 +1,6 @@
1
+ ## Properties
2
+
3
+ | Property | Type |
4
+ | ------ | ------ |
5
+ | <a id="type"></a> `type` | `"mute"` |
6
+ | <a id="data"></a> `data` | `boolean` |
@@ -2,5 +2,5 @@
2
2
 
3
3
  | Property | Type |
4
4
  | ------ | ------ |
5
- | <a id="context"></a> `context?` | `Record`\<`string`, `unknown`\> |
5
+ | <a id="context"></a> `context?` | `Record<string, unknown>` |
6
6
  | <a id="message"></a> `message` | `string` |
@@ -0,0 +1,5 @@
1
+ ## Properties
2
+
3
+ | Property | Type |
4
+ | ------ | ------ |
5
+ | <a id="type"></a> `type` | `"closed"` |
@@ -1,5 +1,12 @@
1
+ ## Type Parameters
2
+
3
+ | Type Parameter |
4
+ | ------ |
5
+ | `T` |
6
+
1
7
  ## Properties
2
8
 
3
9
  | Property | Type |
4
10
  | ------ | ------ |
5
11
  | <a id="type"></a> `type` | `"opened"` |
12
+ | <a id="data"></a> `data` | `T` |
@@ -0,0 +1,6 @@
1
+ ## Properties
2
+
3
+ | Property | Type |
4
+ | ------ | ------ |
5
+ | <a id="type"></a> `type` | `"stats"` |
6
+ | <a id="data"></a> `data` | [`FrameTransformStats`](FrameTransformStats.mdx)[] |
@@ -1,5 +1,12 @@
1
+ ## Type Parameters
2
+
3
+ | Type Parameter |
4
+ | ------ |
5
+ | `T` |
6
+
1
7
  ## Properties
2
8
 
3
9
  | Property | Type |
4
10
  | ------ | ------ |
5
11
  | <a id="type"></a> `type` | `"updated"` |
12
+ | <a id="data"></a> `data` | `T` |
@@ -2,6 +2,7 @@
2
2
 
3
3
  | Property | Type |
4
4
  | ------ | ------ |
5
- | <a id="type"></a> `type` | \| `"Error"` \| `"ContextCreationError"` \| `"ContextLost"` \| `"ContextRestored"` \| `"ProcessorRestarted"` \| `"SamplingError"` |
5
+ | <a id="type"></a> `type` | `\| "Error" \| "ContextCreationError" \| "ContextLost" \| "ContextRestored" \| "ProcessorRestarted" \| "SamplingError"` |
6
+ | <a id="error"></a> `error?` | `Error` |
6
7
  | <a id="message"></a> `message?` | `string` |
7
- | <a id="frame"></a> `frame?` | [`VideoFrameLike`](VideoFrameLike.mdx) |
8
+ | <a id="track"></a> `track?` | `MediaStreamTrack` |
@@ -10,7 +10,6 @@
10
10
  | <a id="backgroundimage"></a> `backgroundImage?` | [`ImageRecord`](ImageRecord.mdx) | - |
11
11
  | <a id="restart"></a> `restart?` | `boolean` | - |
12
12
  | <a id="basepath"></a> `basePath?` | `string` | [`SegmenterOptions`](SegmenterOptions.mdx).[`basePath`](SegmenterOptions.mdx#basepath) |
13
- | <a id="output"></a> `output?` | `OffscreenCanvas` \| `null` | [`SegmenterOptions`](SegmenterOptions.mdx).[`output`](SegmenterOptions.mdx#output) |
14
13
  | <a id="processingwidth"></a> `processingWidth?` | `number` | [`SegmenterOptions`](SegmenterOptions.mdx).[`processingWidth`](SegmenterOptions.mdx#processingwidth) |
15
14
  | <a id="processingheight"></a> `processingHeight?` | `number` | [`SegmenterOptions`](SegmenterOptions.mdx).[`processingHeight`](SegmenterOptions.mdx#processingheight) |
16
15
  | <a id="imagesegmenteroptions"></a> `imageSegmenterOptions?` | [`ImageSegmenterOptions`](ImageSegmenterOptions.mdx) | [`SegmenterOptions`](SegmenterOptions.mdx).[`imageSegmenterOptions`](SegmenterOptions.mdx#imagesegmenteroptions) |
@@ -2,5 +2,7 @@
2
2
 
3
3
  | Property | Type |
4
4
  | ------ | ------ |
5
- | <a id="videoframe"></a> `videoFrame` | [`VideoFrameLike`](VideoFrameLike.mdx) |
5
+ | <a id="track"></a> `track?` | `MediaStreamTrack` |
6
+ | <a id="readable"></a> `readable?` | `ReadableStream<VideoFrame>` |
7
+ | <a id="writable"></a> `writable?` | `WritableStream<VideoFrame>` |
6
8
  | <a id="renderoptions"></a> `renderOptions?` | [`RendererOptions`](RendererOptions.mdx) |
@@ -0,0 +1,17 @@
1
+ ## Extends
2
+
3
+ ```ts
4
+ - Omit<ProcessorOptions, "renderOptions">
5
+ ```
6
+
7
+ ## Properties
8
+
9
+ | Property | Type | Inherited from |
10
+ | ------ | ------ | ------ |
11
+ | <a id="backgroundimage"></a> `backgroundImage?` | [`ImageRecord`](ImageRecord.mdx) | [`ProcessorOptions`](ProcessorOptions.mdx).[`backgroundImage`](ProcessorOptions.mdx#backgroundimage) |
12
+ | <a id="restart"></a> `restart?` | `boolean` | [`ProcessorOptions`](ProcessorOptions.mdx).[`restart`](ProcessorOptions.mdx#restart) |
13
+ | <a id="basepath"></a> `basePath?` | `string` | [`SegmenterOptions`](SegmenterOptions.mdx).[`basePath`](SegmenterOptions.mdx#basepath) |
14
+ | <a id="processingwidth"></a> `processingWidth?` | `number` | [`SegmenterOptions`](SegmenterOptions.mdx).[`processingWidth`](SegmenterOptions.mdx#processingwidth) |
15
+ | <a id="processingheight"></a> `processingHeight?` | `number` | [`SegmenterOptions`](SegmenterOptions.mdx).[`processingHeight`](SegmenterOptions.mdx#processingheight) |
16
+ | <a id="imagesegmenteroptions"></a> `imageSegmenterOptions?` | [`ImageSegmenterOptions`](ImageSegmenterOptions.mdx) | [`SegmenterOptions`](SegmenterOptions.mdx).[`imageSegmenterOptions`](SegmenterOptions.mdx#imagesegmenteroptions) |
17
+ | <a id="renderoptions"></a> `renderOptions?` | `Partial`\<[`RendererOptions`](RendererOptions.mdx)\> | - |
@@ -0,0 +1,12 @@
1
+ ## Type Parameters
2
+
3
+ | Type Parameter |
4
+ | ------ |
5
+ | `T` |
6
+
7
+ ## Properties
8
+
9
+ | Property | Type |
10
+ | ------ | ------ |
11
+ | <a id="readable"></a> `readable` | `ReadableStream<T>` |
12
+ | <a id="writable"></a> `writable` | `WritableStream<T>` |
@@ -2,6 +2,6 @@
2
2
 
3
3
  | Property | Type |
4
4
  | ------ | ------ |
5
- | <a id="contextlost"></a> `contextLost` | (`message`) => `void` |
6
- | <a id="contextrestored"></a> `contextRestored` | (`message`) => `void` |
7
- | <a id="contextcreationerror"></a> `contextCreationError` | (`message`) => `void` |
5
+ | <a id="contextlost"></a> `contextLost` | `(message) => void` |
6
+ | <a id="contextrestored"></a> `contextRestored` | `(message) => void` |
7
+ | <a id="contextcreationerror"></a> `contextCreationError` | `(message) => void` |
@@ -14,7 +14,9 @@ init(options?): void | Promise<void>;
14
14
 
15
15
  #### Returns
16
16
 
17
- `void` \| `Promise`\<`void`\>
17
+ ```ts
18
+ void | Promise<void>
19
+ ```
18
20
 
19
21
  ***
20
22
 
@@ -31,8 +33,8 @@ render(
31
33
 
32
34
  | Parameter | Type |
33
35
  | ------ | ------ |
34
- | `mask` | `ImageBitmap` |
35
- | `frame` | [`VideoFrameLike`](VideoFrameLike.mdx) |
36
+ | `mask` | `OffscreenCanvas` |
37
+ | `frame` | `VideoFrame` |
36
38
  | `options` | `Options` |
37
39
 
38
40
  #### Returns