@vonage/ml-transformers 3.1.1 → 3.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.
@@ -1,8 +1,8 @@
1
- import { EventDataMap, MediaProcessorConnectorInterface } from '@vonage/media-processor';
2
- import { BlurRadius, BackgroundBlurConfig, VirtualBackgroundConfig, AssetBackgroundConfig, VideoBackgroundConfig, MediaProcessorBaseConfig, SilueteBlurConfig, MediapipeConfig, MediaPipeResults, MediaPipeResultsListener, MediaPipeModelType, FaceDetectionResults, FaceDetectionOptions, FaceMeshResults, FaceMeshOptions, HandsResults, HandsOptions, HolisticResults, HolisticOptions, ObjectronResults, ObjectronOptions, PoseResults, PoseOptions, SelfieSegmentationResults, SelfieSegmentationOptions, MediaPipeModelConfig } from './src/types';
3
- import { isSupported } from './src/utils/utils';
4
- import Emittery from 'emittery';
5
- import MediapipeHelper from './src/transformers/MediapipeHelper';
1
+ import { EventDataMap, MediaProcessorConnectorInterface } from "@vonage/media-processor";
2
+ import { BlurRadius, BackgroundBlurConfig, VirtualBackgroundConfig, AssetBackgroundConfig, VideoBackgroundConfig, MediaProcessorBaseConfig, SilueteBlurConfig, MediapipeConfig, MediaPipeResults, MediaPipeResultsListener, MediaPipeModelType, FaceDetectionResults, FaceDetectionOptions, FaceMeshResults, FaceMeshOptions, HandsResults, HandsOptions, HolisticResults, HolisticOptions, ObjectronResults, ObjectronOptions, PoseResults, PoseOptions, SelfieSegmentationResults, SelfieSegmentationOptions, MediaPipeModelConfig } from "./src/types";
3
+ import { isSupported } from "./src/utils/utils";
4
+ import Emittery from "emittery";
5
+ import MediapipeHelper from "./src/transformers/MediapipeHelper";
6
6
  /**
7
7
  * Vonage Mediapipe objects info (it will be used by the @mediapipe/drawing_utils package which is not included by this library).
8
8
  * @param VonageSelfiesegmentation:
@@ -64,13 +64,14 @@ import MediapipeHelper from './src/transformers/MediapipeHelper';
64
64
  * - POSE_LANDMARKS_RIGHT
65
65
  * - POSE_LANDMARKS_NEUTRAL
66
66
  */
67
- import VonageSelfiesegmentation from './src/transformers/SelfieSegmentationHelper';
68
- import VonageHands from './src/transformers/HandsHelper';
69
- import VonageHolistic from './src/transformers/HolisticHelper';
70
- import VonageFacedetection from './src/transformers/FaceDetectionHelper';
71
- import VonageFacemash from './src/transformers/FaceMashHelper';
72
- import VonageObjectron from './src/transformers/ObjectronHelper';
73
- import VonagePose from './src/transformers/PoseHelper';
67
+ import VonageSelfiesegmentation from "./src/transformers/SelfieSegmentationHelper";
68
+ import VonageHands from "./src/transformers/HandsHelper";
69
+ import VonageHolistic from "./src/transformers/HolisticHelper";
70
+ import VonageFacedetection from "./src/transformers/FaceDetectionHelper";
71
+ import VonageFacemash from "./src/transformers/FaceMashHelper";
72
+ import VonageObjectron from "./src/transformers/ObjectronHelper";
73
+ import VonagePose from "./src/transformers/PoseHelper";
74
+ import { VonageMediaProcessor } from "./src/vonage/VonageMediaProcessor";
74
75
  /**
75
76
  * BackgroundOptions background options
76
77
  */
@@ -110,37 +111,42 @@ declare type BackgroundOptions = BackgroundBlurConfig | ((VirtualBackgroundConfi
110
111
  * ```
111
112
  */
112
113
  declare type MediaProcessorConfig = MediaProcessorBaseConfig & BackgroundOptions;
114
+ export declare function createVonageMediaProcessor(config: MediaProcessorConfig): Promise<VonageMediaProcessor>;
113
115
  /**
114
116
  * Registers for error and warn events that come from the library on run time.
115
117
  * see @EventDataMap for more info.
118
+ * @deprecated Use the function {@link createMediaProcessor} to instantiate a processor directly.
116
119
  */
117
120
  declare function getVonageEventEmitter(): Emittery<EventDataMap>;
118
121
  /**
119
- * Sets the expected rate of the track per second.
120
- * The media processor will use this number for calculating drops in the rate.
121
- * This could happen when the transformation will take more time than expected.
122
- * This will not cause an error, just warning to the client.
123
- * Mostly:
124
- * Video: 30 frames per second
125
- * Audio: 50 audio data per second for OPUS
126
- * @param trackExpectedRate - number holds the predicted track rate. -1 for disable this monitor.
127
- */
122
+ * Sets the expected rate of the track per second.
123
+ * The media processor will use this number for calculating drops in the rate.
124
+ * This could happen when the transformation will take more time than expected.
125
+ * This will not cause an error, just warning to the client.
126
+ * Mostly:
127
+ * Video: 30 frames per second
128
+ * Audio: 50 audio data per second for OPUS
129
+ * @deprecated Use the function {@link createMediaProcessor} to instantiate a processor directly.
130
+ * @param trackExpectedRate - number holds the predicted track rate. -1 for disable this monitor.
131
+ */
128
132
  declare function setTrackExpectedRate(trackExpectedRate: number): void;
129
133
  /**
130
- * builder function to create MediaProcessorConnectorInterface
131
- * This function hides all the functionality of the @vonage/media-processor library.
132
- * using this create function promises the user the best performance of background operations.
133
- * @param config - see `MediaProcessorConfig` definition
134
- * @returns - `MediaProcessorConnectorInterface` feed this return value to any vonage SDK that supports this API
135
- */
134
+ * builder function to create MediaProcessorConnectorInterface
135
+ * This function hides all the functionality of the @vonage/media-processor library.
136
+ * using this create function promises the user the best performance of background operations.
137
+ * @deprecated Use the function {@link createMediaProcessor} to instantiate a processor directly.
138
+ * @param config - see `MediaProcessorConfig` definition
139
+ * @returns - `MediaProcessorConnectorInterface` feed this return value to any vonage SDK that supports this API
140
+ */
136
141
  declare function createVonageMediaProcessorConnector(config: MediaProcessorConfig): Promise<MediaProcessorConnectorInterface>;
137
142
  /**
138
- * change the background option during run time using this function.
139
- * while using this function the media-processor will not be destroyed.
140
- * while using this function the library promise a full resource cleanup.
141
- * @param backgroundOptions - see `BackgroundOptions` definition
142
- * @returns - Promise<void>
143
- */
143
+ * change the background option during run time using this function.
144
+ * while using this function the media-processor will not be destroyed.
145
+ * while using this function the library promise a full resource cleanup.
146
+ * @deprecated Use the function {@link createMediaProcessor} to instantiate a processor directly.
147
+ * @param backgroundOptions - see `BackgroundOptions` definition
148
+ * @returns - Promise<void>
149
+ */
144
150
  declare function setBackgroundOptions(backgroundOptions: BackgroundOptions): Promise<void>;
145
- export type { MediaProcessorBaseConfig, BackgroundBlurConfig, VirtualBackgroundConfig, VideoBackgroundConfig, AssetBackgroundConfig, SilueteBlurConfig, MediaProcessorConfig, BackgroundOptions, MediapipeConfig, MediaPipeResults, MediaPipeModelType, MediaPipeResultsListener, FaceDetectionResults, FaceDetectionOptions, FaceMeshResults, FaceMeshOptions, HandsResults, HandsOptions, HolisticResults, HolisticOptions, ObjectronResults, ObjectronOptions, SelfieSegmentationOptions, SelfieSegmentationResults, PoseResults, PoseOptions, MediaPipeModelConfig };
146
- export { BlurRadius, createVonageMediaProcessorConnector, getVonageEventEmitter, setTrackExpectedRate, isSupported, MediapipeHelper, setBackgroundOptions, VonageSelfiesegmentation, VonageFacedetection, VonageFacemash, VonageHands, VonageHolistic, VonageObjectron, VonagePose };
151
+ export type { MediaProcessorBaseConfig, BackgroundBlurConfig, VirtualBackgroundConfig, VideoBackgroundConfig, AssetBackgroundConfig, SilueteBlurConfig, MediaProcessorConfig, BackgroundOptions, MediapipeConfig, MediaPipeResults, MediaPipeModelType, MediaPipeResultsListener, FaceDetectionResults, FaceDetectionOptions, FaceMeshResults, FaceMeshOptions, HandsResults, HandsOptions, HolisticResults, HolisticOptions, ObjectronResults, ObjectronOptions, SelfieSegmentationOptions, SelfieSegmentationResults, PoseResults, PoseOptions, MediaPipeModelConfig, };
152
+ export { VonageMediaProcessor, BlurRadius, createVonageMediaProcessorConnector, getVonageEventEmitter, setTrackExpectedRate, isSupported, MediapipeHelper, setBackgroundOptions, VonageSelfiesegmentation, VonageFacedetection, VonageFacemash, VonageHands, VonageHolistic, VonageObjectron, VonagePose, };
@@ -0,0 +1,59 @@
1
+ import { EventDataMap, MediaProcessorConnector } from "@vonage/media-processor";
2
+ import Emittery from "emittery";
3
+ import { BackgroundOptions, MediaProcessorConfig } from "../../main";
4
+ /**
5
+ * Class wrapping features provided by ml-transformers.
6
+ */
7
+ export declare class VonageMediaProcessor extends Emittery<EventDataMap> {
8
+ /**
9
+ * Web worker wrapper used to run the transformers
10
+ * @internal
11
+ */
12
+ private worker;
13
+ /**
14
+ * Usable connector for media-processor lib
15
+ * @internal
16
+ */
17
+ private connector;
18
+ /**
19
+ * Private constructor
20
+ * Use {@link create} to instantiate the class
21
+ * @internal
22
+ */
23
+ private constructor();
24
+ /**
25
+ * Initialize the processor worker an events
26
+ * @param config Configuration to initialize with
27
+ * @internal
28
+ */
29
+ private init;
30
+ /**
31
+ * change the background option during run time using this function.
32
+ * while using this function the media-processor will not be destroyed.
33
+ * while using this function the library promise a full resource cleanup.
34
+ * @param backgroundOptions - see `BackgroundOptions` definition
35
+ */
36
+ setBackgroundOptions(options: BackgroundOptions): Promise<void>;
37
+ /**
38
+ * Sets the expected rate of the track per second.
39
+ * The media processor will use this number for calculating drops in the rate.
40
+ * This could happen when the transformation will take more time than expected.
41
+ * This will not cause an error, just warning to the client.
42
+ * Mostly:
43
+ * Video: 30 frames per second
44
+ * Audio: 50 audio data per second for OPUS
45
+ * @param rate - number holds the predicted track rate. -1 for disable this monitor.
46
+ */
47
+ setTrackExpectedRate(rate: number): void;
48
+ /**
49
+ * Getter for MediaProcessorConnectorInterface connector attribute.
50
+ * @returns - `MediaProcessorConnectorInterface` feed this return value to any vonage SDK that supports this API
51
+ */
52
+ getConnector(): MediaProcessorConnector;
53
+ /**
54
+ * Asynchronous constructor of VonageMediaProcessor
55
+ * @param config Initial MediaProcessorConfig to use
56
+ * @returns Promise resolved with an initialized MediaProcessorConfig
57
+ */
58
+ static create(config: MediaProcessorConfig): Promise<VonageMediaProcessor>;
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vonage/ml-transformers",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "author": "Guy Mininberg <guy.mininberg@vonage.com>",
5
5
  "contributors": [
6
6
  "Guy Mininberg <guy.mininberg@vonage.com>",