@pexip/media-processor 16.7.0 → 17.0.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 (69) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +1 -7
  3. package/dist/main/audio.d.ts +123 -0
  4. package/dist/main/audio.js +653 -0
  5. package/dist/main/benchUtils.d.ts +12 -0
  6. package/dist/main/benchUtils.js +34 -0
  7. package/dist/main/generator.d.ts +4 -0
  8. package/dist/main/generator.js +4 -0
  9. package/dist/main/index.d.ts +17 -0
  10. package/dist/main/index.js +17 -0
  11. package/dist/main/math.d.ts +41 -0
  12. package/dist/main/math.js +57 -0
  13. package/dist/main/path.d.ts +102 -0
  14. package/dist/main/path.js +103 -0
  15. package/dist/main/process.d.ts +239 -0
  16. package/dist/main/process.js +364 -0
  17. package/dist/main/processor.d.ts +5 -0
  18. package/dist/main/processor.js +4 -0
  19. package/dist/main/transformer.d.ts +1 -0
  20. package/dist/main/transformer.js +4 -0
  21. package/dist/main/tsconfig.tsbuildinfo +1 -0
  22. package/dist/main/typeGuards.d.ts +5 -0
  23. package/dist/main/typeGuards.js +24 -0
  24. package/dist/main/types.d.ts +342 -0
  25. package/dist/main/types.js +1 -0
  26. package/dist/main/utils.d.ts +173 -0
  27. package/dist/main/utils.js +364 -0
  28. package/dist/main/video/canvasRenderUtils.d.ts +22 -0
  29. package/dist/main/video/canvasRenderUtils.js +198 -0
  30. package/dist/main/video/canvasTransform.d.ts +8 -0
  31. package/dist/main/video/canvasTransform.js +173 -0
  32. package/dist/main/video/constants.d.ts +10 -0
  33. package/dist/main/video/constants.js +12 -0
  34. package/dist/main/video/index.d.ts +9 -0
  35. package/dist/main/video/index.js +9 -0
  36. package/dist/main/video/load.d.ts +17 -0
  37. package/dist/main/video/load.js +47 -0
  38. package/dist/main/video/segmenters/index.d.ts +1 -0
  39. package/dist/main/video/segmenters/index.js +1 -0
  40. package/dist/main/video/segmenters/mediapipe.d.ts +13 -0
  41. package/dist/main/video/segmenters/mediapipe.js +85 -0
  42. package/dist/main/video/transformer.d.ts +10 -0
  43. package/dist/main/video/transformer.js +56 -0
  44. package/dist/main/video/typeGuards.d.ts +2 -0
  45. package/dist/main/video/typeGuards.js +13 -0
  46. package/dist/main/video/types.d.ts +98 -0
  47. package/dist/main/video/types.js +20 -0
  48. package/dist/main/video/utils.d.ts +102 -0
  49. package/dist/main/video/utils.js +476 -0
  50. package/dist/main/video/video.d.ts +19 -0
  51. package/dist/main/video/video.js +48 -0
  52. package/dist/main/video/videoStreamTrackProcessor.d.ts +14 -0
  53. package/dist/main/video/videoStreamTrackProcessor.js +82 -0
  54. package/dist/main/visual.d.ts +80 -0
  55. package/dist/main/visual.js +135 -0
  56. package/dist/main/workletNodes.d.ts +2 -0
  57. package/dist/main/workletNodes.js +3 -0
  58. package/dist/workers/index.d.ts +0 -0
  59. package/dist/workers/index.js +1 -0
  60. package/dist/workers/tsconfig.tsbuildinfo +1 -0
  61. package/dist/worklets/denoise.worklet.d.ts +1 -0
  62. package/dist/worklets/denoise.worklet.js +1 -2
  63. package/dist/worklets/tsconfig.tsbuildinfo +1 -0
  64. package/dist/worklets/types.d.ts +52 -0
  65. package/dist/worklets/types.js +0 -0
  66. package/package.json +11 -9
  67. package/dist/index.d.ts +0 -1129
  68. package/dist/index.mjs +0 -2441
  69. package/dist/worklets/denoise.worklet.js.map +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 17.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 1f5d1df: Restructure to allow targeting to differernt environments
8
+
9
+ ### Minor Changes
10
+
11
+ - af71598: Avoid using desynconized 2D cavas because MS Edge 113 on Windows
12
+ produces green screen
13
+ - 32c24c8d06: Remove bg-blur dependency
14
+
15
+ ### Patch Changes
16
+
17
+ - @pexip/utils@16.6.0
18
+
19
+ ## 16.7.1
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [94b7f753]
24
+ - @pexip/utils@16.6.0
25
+
3
26
  ## 16.7.0
4
27
 
5
28
  ### Minor Changes
package/README.md CHANGED
@@ -105,19 +105,13 @@ await audioGraph.release();
105
105
  ### Use background blur
106
106
 
107
107
  ```typescript
108
- import {urls} from '@pexip/bg-blur';
109
-
110
108
  const PROCESSING_WIDTH = 768;
111
109
  const PROCESSING_HEIGHT = 432;
112
110
 
113
111
  const stream = await navigator.mediaDevices.getUserMedia({video: true});
114
112
 
115
- // Create symbolic link to link bg-blur/selfie_segmentation to a public folder
116
113
  // Thus we can create a URL object to get the link to be used for the `gluePath`
117
- const selfieJs = new URL(
118
- `./selfie_segmentation/selfie_segmentation.js`,
119
- document.baseURI,
120
- );
114
+ const selfieJs = new URL('@mediapipe/selfie_segmentation', import.meta);
121
115
  const segmenter = createMediapipeSegmenter('selfie_segmentation', {
122
116
  modelType: selfieModel,
123
117
  processingWidth: PROCESSING_WIDTH,
@@ -0,0 +1,123 @@
1
+ import type { Analyzer, AnalyzerSubscribableOptions, AudioGraph, AudioGraphOptions, AudioNodeInit, AudioNodeInitConnections, Gain, Unsubscribe, WorkletMessagePortOptions } from './types';
2
+ /**
3
+ * A function to create `AudioContext` using constructor or factory function
4
+ * depends on the browser supports
5
+ *
6
+ * @param options - @see {@link AudioContextOptions}
7
+ *
8
+ * @internal
9
+ */
10
+ export declare const createAudioContext: (options?: AudioContextOptions) => AudioContext;
11
+ /**
12
+ * Resume the stream whenever interrupted
13
+ *
14
+ * @param audioContext - AudioContext
15
+ *
16
+ * @alpha
17
+ */
18
+ export declare function resumeAudioOnInterruption(audioContext: AudioContext): () => void;
19
+ /**
20
+ * Resume the AudioContext whenever the source track is unmuted
21
+ *
22
+ * @param audioContext - The `AudioContext` to resume
23
+ *
24
+ * @alpha
25
+ */
26
+ export declare const resumeAudioOnUnmute: (context: AudioContext) => (track: MediaStreamTrack) => Unsubscribe;
27
+ /**
28
+ * Subscribe MessagePort message from an AudioWorkletNode
29
+ *
30
+ * @param workletNode - the node to subscribe
31
+ * @param options - can pass a message handler here to handle the message
32
+ */
33
+ export declare const subscribeWorkletNode: <T>(workletNode: AudioWorkletNode, { messageHandler, errorHandler }?: Partial<WorkletMessagePortOptions<T>>) => () => void;
34
+ /**
35
+ * Subscribe to a timeout loop to get the data from Analyzer
36
+ *
37
+ * @param analyzer - the analyzer to subscribe
38
+ * @param options - message handler, etc.
39
+ */
40
+ export declare const subscribeTimeoutAnalyzerNode: (analyzer: Analyzer, { messageHandler, updateFrequency }: AnalyzerSubscribableOptions) => () => void;
41
+ /**
42
+ * Create a MediaStreamAudioSourceNodeInit
43
+ *
44
+ * @param mediaStream - Source MediaStream
45
+ * @param shouldResetEnabled - Whether or not to enable the cloned track
46
+ */
47
+ export declare const createStreamSourceGraphNode: (mediaStream: MediaStream, shouldResetEnabled?: boolean) => AudioNodeInit<MediaStreamAudioSourceNode, MediaStreamAudioSourceNode>;
48
+ /**
49
+ * Create a MediaStreamAudioSourceNodeInit
50
+ *
51
+ * @param mediaStream - Source MediaStream
52
+ */
53
+ export declare const createMediaElementSourceGraphNode: (mediaElement: HTMLMediaElement) => AudioNodeInit<MediaElementAudioSourceNode, MediaElementAudioSourceNode>;
54
+ /**
55
+ * Create an analyzer node with push-based subscription
56
+ */
57
+ export declare const createAnalyzerSubscribableGraphNode: ({ messageHandler, updateFrequency, ...analyserOptions }: AnalyzerSubscribableOptions & AnalyserOptions) => AudioNodeInit<AnalyserNode, Analyzer>;
58
+ /**
59
+ * Create a noise suppression node
60
+ *
61
+ * @param data - WebAssembly source
62
+ */
63
+ export declare const createDenoiseWorkletGraphNode: (data: BufferSource, messageHandler?: ((vads: number[]) => void) | undefined) => AudioNodeInit<AudioWorkletNode, AudioWorkletNode>;
64
+ /**
65
+ * Create a GainNodeInit
66
+ *
67
+ * @param mute - initial mute state
68
+ */
69
+ export declare const createGainGraphNode: (mute: boolean) => AudioNodeInit<GainNode, Gain>;
70
+ /**
71
+ * Create an AnalyzerNodeInit
72
+ *
73
+ * @param options - @see {@link AnalyserOptions}
74
+ */
75
+ export declare const createAnalyzerGraphNode: (options?: AnalyserOptions) => AudioNodeInit<AnalyserNode, Analyzer>;
76
+ /**
77
+ * Create a MediaStreamAudioDestinationNodeInit
78
+ */
79
+ export declare const createStreamDestinationGraphNode: (options?: AudioNodeOptions) => AudioNodeInit<MediaStreamAudioDestinationNode, MediaStreamAudioDestinationNode>;
80
+ /**
81
+ * Create an `AudioDestinationNode`
82
+ */
83
+ export declare const createAudioDestinationGraphNode: () => AudioNodeInit<AudioDestinationNode, AudioDestinationNode>;
84
+ /**
85
+ * Create a `DelayNode`
86
+ *
87
+ * @param options - @see DelayOptions
88
+ */
89
+ export declare const createDelayGraphNode: (options?: DelayOptions) => AudioNodeInit<DelayNode, DelayNode>;
90
+ /**
91
+ * Create a ChannelSplitterNode
92
+ *
93
+ * @param options - @see ChannelSplitterOptions
94
+ */
95
+ export declare const createChannelSplitterGraphNode: (options?: ChannelSplitterOptions) => AudioNodeInit<ChannelSplitterNode, ChannelSplitterNode>;
96
+ /**
97
+ * Create a ChannelMergerNode
98
+ *
99
+ * @param options - @see ChannelMergerOptions
100
+ */
101
+ export declare const createChannelMergerGraphNode: (options?: ChannelMergerOptions) => AudioNodeInit<ChannelMergerNode, ChannelMergerNode>;
102
+ /**
103
+ * Accepts AudioNodeInitConnections to build the audio graph within a signal audio context
104
+ *
105
+ * @param initialConnections - A list of AudioNodeInit to build the graph in a linear fashion
106
+ * @param options - @see {@link AudioGraphOptions}
107
+ *
108
+ * @example
109
+ *
110
+ * ```typescript
111
+ * const source = createStreamSourceGraphNode(stream);
112
+ * const analyzer = createAnalyzerGraphNode({fftSize});
113
+ * const audioGraph = createAudioGraph([[source, analyzer]]);
114
+ * ```
115
+ */
116
+ export declare const createAudioGraph: (initialConnections: AudioNodeInitConnections, options?: AudioGraphOptions) => AudioGraph;
117
+ type AudioGraphProxyHandler = (target: AudioGraph, args: Parameters<AudioGraph['connect']>) => void;
118
+ interface AudioGraphProxyHandlers {
119
+ connect?: AudioGraphProxyHandler;
120
+ disconnect?: AudioGraphProxyHandler;
121
+ }
122
+ export declare const createAudioGraphProxy: (audioGraph: AudioGraph, handlers: AudioGraphProxyHandlers) => AudioGraph;
123
+ export {};