deepar 5.4.0-canvasInDiv-alpha-13 → 5.4.0-chromeExtension
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -57
- package/VERSION.txt +1 -1
- package/effects/background_blur.deepar +0 -0
- package/js/deepar.esm.js +2 -1
- package/js/deepar.esm.js.LICENSE.txt +6 -0
- package/js/deepar.js +2 -1
- package/js/deepar.js.LICENSE.txt +6 -0
- package/js/dynamicModules/mediaPipe.esm.js +1 -0
- package/js/dynamicModules/xzimg.esm.js +2 -0
- package/js/dynamicModules/xzimg.esm.js.LICENSE.txt +219 -0
- package/js/types/DeepAR.d.ts +60 -27
- package/js/types/callbacks.d.ts +1 -0
- package/js/types/canvasHelper.d.ts +2 -2
- package/js/types/canvasTouchHelper.d.ts +13 -0
- package/js/types/initParams.d.ts +64 -12
- package/js/types/mediaRecorderVideoRecording.d.ts +10 -0
- package/js/types/version.d.ts +1 -1
- package/js/types/webCodecsVideoRecording.d.ts +11 -0
- package/lib/LICENSE +1 -0
- package/lib/README.md +326 -0
- package/lib/VERSION.txt +1 -0
- package/lib/effects/background_blur.deepar +0 -0
- package/lib/effects/background_replacement.deepar +0 -0
- package/lib/js/deepar.esm.js +2 -0
- package/lib/js/deepar.esm.js.LICENSE.txt +6 -0
- package/lib/js/deepar.js +2 -0
- package/lib/js/deepar.js.LICENSE.txt +6 -0
- package/lib/js/dynamicModules/mediaPipe.esm.js +1 -0
- package/lib/js/dynamicModules/xzimg.esm.js +2 -0
- package/lib/js/dynamicModules/xzimg.esm.js.LICENSE.txt +219 -0
- package/lib/js/types/DeepAR.d.ts +387 -0
- package/lib/js/types/callbacks.d.ts +64 -0
- package/lib/js/types/canvasHelper.d.ts +18 -0
- package/lib/js/types/canvasTouchHelper.d.ts +13 -0
- package/lib/js/types/errors.d.ts +6 -0
- package/lib/js/types/faceData.d.ts +33 -0
- package/lib/js/types/footData.d.ts +9 -0
- package/lib/js/types/index.d.ts +10 -0
- package/lib/js/types/initParams.d.ts +244 -0
- package/lib/js/types/logType.d.ts +18 -0
- package/lib/js/types/mediaRecorderVideoRecording.d.ts +10 -0
- package/lib/js/types/scriptingApi.d.ts +107 -0
- package/lib/js/types/touchType.d.ts +34 -0
- package/lib/js/types/version.d.ts +5 -0
- package/lib/js/types/webCodecsVideoRecording.d.ts +11 -0
- package/lib/js/types/wristData.d.ts +13 -0
- package/lib/mediaPipe/segmentation/models/selfie_segmenter.tflite +0 -0
- package/lib/mediaPipe/segmentation/models/selfie_segmenter_landscape.tflite +0 -0
- package/lib/mediaPipe/segmentation/wasm/vision_wasm_internal.js +22 -0
- package/lib/mediaPipe/segmentation/wasm/vision_wasm_internal.wasm +0 -0
- package/lib/mediaPipe/segmentation/wasm/vision_wasm_nosimd_internal.js +22 -0
- package/lib/mediaPipe/segmentation/wasm/vision_wasm_nosimd_internal.wasm +0 -0
- package/lib/models/face/models-68-extreme.bin +0 -0
- package/lib/models/face-cnn/face-det.bin +0 -0
- package/lib/models/face-cnn/face-track-19.bin +0 -0
- package/lib/models/foot/foot-detection-96x96x6.bin +0 -0
- package/lib/models/foot/foot-model.obj +3965 -0
- package/lib/models/foot/foot-tracker-96x96x13-test.bin +0 -0
- package/lib/models/foot/foot-tracker-96x96x18-test.bin +0 -0
- package/lib/models/segmentation/segmentation-160x160-opt.bin +0 -0
- package/lib/models/wrist/wrist-base-2.obj +3815 -0
- package/lib/models/wrist/wrist-det-9.bin +0 -0
- package/lib/models/wrist/wrist-track.bin +0 -0
- package/lib/wasm/deepar.wasm +0 -0
- package/lib/wasm/libxzimgPoseEstimation.wasm +0 -0
- package/lib/wasm/tfjs-backend-wasm-simd.wasm +0 -0
- package/lib/wasm/tfjs-backend-wasm-threaded-simd.wasm +0 -0
- package/lib/wasm/tfjs-backend-wasm.wasm +0 -0
- package/mediaPipe/segmentation/models/selfie_segmenter.tflite +0 -0
- package/mediaPipe/segmentation/models/selfie_segmenter_landscape.tflite +0 -0
- package/mediaPipe/segmentation/wasm/vision_wasm_internal.js +22 -0
- package/mediaPipe/segmentation/wasm/vision_wasm_internal.wasm +0 -0
- package/mediaPipe/segmentation/wasm/vision_wasm_nosimd_internal.js +22 -0
- package/mediaPipe/segmentation/wasm/vision_wasm_nosimd_internal.wasm +0 -0
- package/models/face-cnn/face-det.bin +0 -0
- package/models/face-cnn/face-track-19.bin +0 -0
- package/package.json +1 -1
- package/wasm/deepar.wasm +0 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @license
|
|
18
|
+
* Copyright 2017 Google LLC. All Rights Reserved.
|
|
19
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License.
|
|
21
|
+
* You may obtain a copy of the License at
|
|
22
|
+
*
|
|
23
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
+
*
|
|
25
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
+
* See the License for the specific language governing permissions and
|
|
29
|
+
* limitations under the License.
|
|
30
|
+
* =============================================================================
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @license
|
|
35
|
+
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
36
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
37
|
+
* you may not use this file except in compliance with the License.
|
|
38
|
+
* You may obtain a copy of the License at
|
|
39
|
+
*
|
|
40
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
41
|
+
*
|
|
42
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
43
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
44
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
45
|
+
* See the License for the specific language governing permissions and
|
|
46
|
+
* limitations under the License.
|
|
47
|
+
* =============================================================================
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @license
|
|
52
|
+
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
53
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
54
|
+
* you may not use this file except in compliance with the License.
|
|
55
|
+
* You may obtain a copy of the License at
|
|
56
|
+
*
|
|
57
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
58
|
+
*
|
|
59
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
60
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
61
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
62
|
+
* See the License for the specific language governing permissions and
|
|
63
|
+
* limitations under the License.
|
|
64
|
+
*
|
|
65
|
+
* =============================================================================
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @license
|
|
70
|
+
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
71
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
72
|
+
* you may not use this file except in compliance with the License.
|
|
73
|
+
* You may obtain a copy of the License at
|
|
74
|
+
*
|
|
75
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
76
|
+
*
|
|
77
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
78
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
79
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
80
|
+
* See the License for the specific language governing permissions and
|
|
81
|
+
* limitations under the License.
|
|
82
|
+
* =============================================================================
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @license
|
|
87
|
+
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
88
|
+
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
89
|
+
* you may not use this file except in compliance with the License.
|
|
90
|
+
* You may obtain a copy of the License at
|
|
91
|
+
*
|
|
92
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
93
|
+
*
|
|
94
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
95
|
+
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
96
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
97
|
+
* See the License for the specific language governing permissions and
|
|
98
|
+
* limitations under the License.
|
|
99
|
+
* =============================================================================
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @license
|
|
104
|
+
* Copyright 2020 Google Inc. All Rights Reserved.
|
|
105
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
|
+
* you may not use this file except in compliance with the License.
|
|
107
|
+
* You may obtain a copy of the License at
|
|
108
|
+
*
|
|
109
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
110
|
+
*
|
|
111
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
112
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
113
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
114
|
+
* See the License for the specific language governing permissions and
|
|
115
|
+
* limitations under the License.
|
|
116
|
+
* =============================================================================
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @license
|
|
121
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
122
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
123
|
+
* you may not use this file except in compliance with the License.
|
|
124
|
+
* You may obtain a copy of the License at
|
|
125
|
+
*
|
|
126
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
127
|
+
*
|
|
128
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
129
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
130
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
131
|
+
* See the License for the specific language governing permissions and
|
|
132
|
+
* limitations under the License.
|
|
133
|
+
* =============================================================================
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @license
|
|
138
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
139
|
+
* Licensed under the Apache License, Version 2.0 (the License);
|
|
140
|
+
* you may not use this file except in compliance with the License.
|
|
141
|
+
* You may obtain a copy of the License at
|
|
142
|
+
*
|
|
143
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
144
|
+
*
|
|
145
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
146
|
+
* distributed under the License is distributed on an AS IS BASIS,
|
|
147
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
148
|
+
* See the License for the specific language governing permissions and
|
|
149
|
+
* limitations under the License.
|
|
150
|
+
* =============================================================================
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @license
|
|
155
|
+
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
156
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
157
|
+
* you may not use this file except in compliance with the License.
|
|
158
|
+
* You may obtain a copy of the License at
|
|
159
|
+
*
|
|
160
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
161
|
+
*
|
|
162
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
163
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
164
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
165
|
+
* See the License for the specific language governing permissions and
|
|
166
|
+
* limitations under the License.
|
|
167
|
+
* =============================================================================
|
|
168
|
+
*/
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @license
|
|
172
|
+
* Copyright 2022 Google LLC.
|
|
173
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
174
|
+
* you may not use this file except in compliance with the License.
|
|
175
|
+
* You may obtain a copy of the License at
|
|
176
|
+
*
|
|
177
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
178
|
+
*
|
|
179
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
180
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
181
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
182
|
+
* See the License for the specific language governing permissions and
|
|
183
|
+
* limitations under the License.
|
|
184
|
+
* =============================================================================
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @license
|
|
189
|
+
* Copyright 2022 Google LLC. All Rights Reserved.
|
|
190
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
191
|
+
* you may not use this file except in compliance with the License.
|
|
192
|
+
* You may obtain a copy of the License at
|
|
193
|
+
*
|
|
194
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
195
|
+
*
|
|
196
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
197
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
198
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
|
+
* See the License for the specific language governing permissions and
|
|
200
|
+
* limitations under the License.
|
|
201
|
+
* =============================================================================
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @license
|
|
206
|
+
* Copyright 2023 Google LLC. All Rights Reserved.
|
|
207
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
208
|
+
* you may not use this file except in compliance with the License.
|
|
209
|
+
* You may obtain a copy of the License at
|
|
210
|
+
*
|
|
211
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
212
|
+
*
|
|
213
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
214
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
215
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
216
|
+
* See the License for the specific language governing permissions and
|
|
217
|
+
* limitations under the License.
|
|
218
|
+
* =============================================================================
|
|
219
|
+
*/
|
package/js/types/DeepAR.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="dom-mediacapture-transform" />
|
|
1
2
|
import { ARTouchInfo } from "./touchType";
|
|
2
3
|
import { DeepARCallbacks } from "./callbacks";
|
|
3
4
|
import { DeepARParams } from "./initParams";
|
|
@@ -24,6 +25,7 @@ export declare class DeepAR {
|
|
|
24
25
|
* @private
|
|
25
26
|
*/
|
|
26
27
|
private module;
|
|
28
|
+
private canvasTouchHelper;
|
|
27
29
|
/**
|
|
28
30
|
* Callbacks property is used to add/remove/change callbacks called by the DeepAR SDK. See list of all callbacks at {@link DeepARCallbacks}. <br><br>
|
|
29
31
|
* Example: To add/change certain callback:
|
|
@@ -101,18 +103,50 @@ export declare class DeepAR {
|
|
|
101
103
|
*/
|
|
102
104
|
takeScreenshot(): Promise<string>;
|
|
103
105
|
/**
|
|
104
|
-
*
|
|
106
|
+
* Start video recording of the DeepAR preview.
|
|
107
|
+
*
|
|
108
|
+
* To stop video recording call {@link finishVideoRecording}.
|
|
109
|
+
* By default, the audio is not recorded. To record audio set the recordAudio parameter. Note that if the user did not give the microphone permission, the recording will not start until the permission is granted. If permission is denied, the function will throw.
|
|
110
|
+
* The recorded video will be mp4 on all browsers except Firefox where it will be webm.
|
|
111
|
+
* Audio recording is currently not available on Android.
|
|
112
|
+
*
|
|
105
113
|
* @param options Parameters that specify the format of recorded videos
|
|
106
|
-
* @param options.
|
|
114
|
+
* @param options.recordAudio If set, microphone sound will be recorded as well. If this parameter is set, options.audioTrack is ignored.
|
|
115
|
+
* @param options.audioTrack If passed, this audio track is going to be recorded.
|
|
116
|
+
* @param options.audioBitRate Sets audio bit rate. By default 128000.
|
|
117
|
+
* @param options.audioSampleRate Set audio sample rate. On firefox it is 48k. On other browsers defaults to audioTrack.getCapabilities().sampleRate.max or to the value passed here.
|
|
118
|
+
* @param options.videoBitRate Sets video bit rate. By default 4000000.
|
|
119
|
+
* @param options.videoFrameRate Sets video frame rate. By default 30.
|
|
107
120
|
*/
|
|
108
121
|
startVideoRecording(options?: {
|
|
109
|
-
|
|
110
|
-
|
|
122
|
+
recordAudio?: boolean;
|
|
123
|
+
audioTrack?: MediaStreamAudioTrack;
|
|
124
|
+
audioBitRate?: number;
|
|
125
|
+
audioSampleRate?: number;
|
|
126
|
+
videoBitRate?: number;
|
|
127
|
+
videoFrameRate?: number;
|
|
128
|
+
}): Promise<void>;
|
|
111
129
|
/**
|
|
112
130
|
* Stops the video recording and returns a video blob.
|
|
113
131
|
* @returns A promise resolving to Blob of a video.
|
|
114
132
|
*/
|
|
115
133
|
finishVideoRecording(): Promise<Blob>;
|
|
134
|
+
/**
|
|
135
|
+
* Enable background blur.
|
|
136
|
+
*
|
|
137
|
+
* Background blur is usually used in video calling use cases.
|
|
138
|
+
*
|
|
139
|
+
* @param enable - Boolean indicating whether to enable or disable the background blur effect.
|
|
140
|
+
* @param strength - Blur strength. Integer number in range 1-10.
|
|
141
|
+
*/
|
|
142
|
+
backgroundBlur(enable: boolean, strength: number): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Enable background replacement (also known as background removal or green screen effect).
|
|
145
|
+
*
|
|
146
|
+
* @param enable - Boolean indicating whether to enable or disable the background replacement effect.
|
|
147
|
+
* @param image - The URL of the image to be used as the background.
|
|
148
|
+
*/
|
|
149
|
+
backgroundReplacement(enable: boolean, image: string): Promise<void>;
|
|
116
150
|
/**
|
|
117
151
|
* Starts the camera preview. By default, the camera will be user facing. The returned promise will resolve after the camera starts
|
|
118
152
|
* or it will reject if camera permission was denied.
|
|
@@ -158,6 +192,12 @@ export declare class DeepAR {
|
|
|
158
192
|
* After shutdown call, it is possible to call {@link initialize} again.
|
|
159
193
|
*/
|
|
160
194
|
shutdown(): void;
|
|
195
|
+
/**
|
|
196
|
+
* Mutes or un-mutes all the sounds that are currently playing.
|
|
197
|
+
*
|
|
198
|
+
* @param muteSound true if you want to mute all the sounds.
|
|
199
|
+
*/
|
|
200
|
+
muteSound(muteSound: boolean): void;
|
|
161
201
|
/**
|
|
162
202
|
* Feed RGBA image to DeepAR as input instead of camera or video. Used for processing single image. Can be used instead of {@link startCamera} or {@link setVideoElement}.
|
|
163
203
|
* Can be called in a loop.
|
|
@@ -218,11 +258,6 @@ export declare class DeepAR {
|
|
|
218
258
|
* @param trigger The name of the trigger.
|
|
219
259
|
*/
|
|
220
260
|
fireTrigger(trigger: string): void;
|
|
221
|
-
/**
|
|
222
|
-
* Informs DeepAR that the specified touch event occurred.
|
|
223
|
-
* @param touchInfo Touch event information.
|
|
224
|
-
*/
|
|
225
|
-
touchOccurred(touchInfo: ARTouchInfo): void;
|
|
226
261
|
/**
|
|
227
262
|
* Change face detection sensitivity
|
|
228
263
|
* @param sensitivity 0 .. 5 (0 is fast, 4,5 is slow but allows to find smaller faces)
|
|
@@ -240,6 +275,16 @@ export declare class DeepAR {
|
|
|
240
275
|
* @param enable True - DeepAR will use its internal timer for the rendering loop. Rendering will work even when tab is not focused. False - DeepAR will use requestAnimationFrame() for the rendering loop.
|
|
241
276
|
*/
|
|
242
277
|
setOffscreenRenderingEnabled(enable: boolean): void;
|
|
278
|
+
/**
|
|
279
|
+
* Retrieves the HTML canvas element used for AR preview.
|
|
280
|
+
*
|
|
281
|
+
* The returned canvas is used for DeepAR rendering of camera preview and AR filters.
|
|
282
|
+
* Most commonly canvas is needed when you want to do some postprocessing on it or feed it
|
|
283
|
+
* into some video calling library.
|
|
284
|
+
*
|
|
285
|
+
* @return {HTMLCanvasElement} The HTML canvas element.
|
|
286
|
+
*/
|
|
287
|
+
getCanvas(): HTMLCanvasElement;
|
|
243
288
|
/**
|
|
244
289
|
* Set the FPS of DeepAR rendering.
|
|
245
290
|
* @param fps New FPS.
|
|
@@ -297,27 +342,15 @@ export declare class DeepAR {
|
|
|
297
342
|
*/
|
|
298
343
|
moveGameObject(selectedGameObject: string, targetGameObject: string): void;
|
|
299
344
|
/**
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
* @param muteSound true if you want to mute all the sounds.
|
|
303
|
-
*/
|
|
304
|
-
muteSound(muteSound: boolean): void;
|
|
305
|
-
/**
|
|
306
|
-
* Enable background blur.
|
|
307
|
-
*
|
|
308
|
-
* Background blur is usually used in video calling use cases.
|
|
345
|
+
* Informs DeepAR that the specified touch event occurred.
|
|
309
346
|
*
|
|
310
|
-
* @
|
|
311
|
-
*
|
|
312
|
-
|
|
313
|
-
backgroundBlur(enable: boolean, strength: number): Promise<void>;
|
|
314
|
-
/**
|
|
315
|
-
* Enable background replacement (also known as background removal or green screen effect).
|
|
347
|
+
* @deprecated
|
|
348
|
+
* Since version 5.4.0 DeepAR will automatically register touch events from canvas.
|
|
349
|
+
* There is no need to call this function anymore.
|
|
316
350
|
*
|
|
317
|
-
* @param
|
|
318
|
-
* @param image - The URL of the image to be used as the background.
|
|
351
|
+
* @param touchInfo Touch event information.
|
|
319
352
|
*/
|
|
320
|
-
|
|
353
|
+
touchOccurred(touchInfo: ARTouchInfo): void;
|
|
321
354
|
/** INTERNAL API **/
|
|
322
355
|
/**
|
|
323
356
|
* @internal
|
package/js/types/callbacks.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ declare const preRenderUpdate: () => void;
|
|
|
8
8
|
declare const postRenderUpdate: () => void;
|
|
9
9
|
/**
|
|
10
10
|
* Creates a canvas and appends it to the target element.
|
|
11
|
-
* @param
|
|
11
|
+
* @param previewElement
|
|
12
12
|
*/
|
|
13
|
-
declare function createCanvas(
|
|
13
|
+
declare function createCanvas(previewElement: HTMLElement): HTMLCanvasElement;
|
|
14
14
|
/**
|
|
15
15
|
* Removes the created canvas and invalidates the current context.
|
|
16
16
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ARTouchInfo } from "./touchType";
|
|
2
|
+
export declare class CanvasTouchHelper {
|
|
3
|
+
private canvas;
|
|
4
|
+
private canvasListeners;
|
|
5
|
+
private touchOccurring;
|
|
6
|
+
private touchListeners;
|
|
7
|
+
constructor(canvas: HTMLCanvasElement, listener: (info: ARTouchInfo) => void | null);
|
|
8
|
+
cleanUpCanvasListeners(): void;
|
|
9
|
+
addTouchListener(listener: (info: ARTouchInfo) => void): void;
|
|
10
|
+
private touchOccurred;
|
|
11
|
+
private registerCanvasListener;
|
|
12
|
+
private touchInfo;
|
|
13
|
+
}
|
package/js/types/initParams.d.ts
CHANGED
|
@@ -7,20 +7,20 @@ export interface DeepARParams {
|
|
|
7
7
|
*/
|
|
8
8
|
licenseKey: string;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* > ⚠️ You must specify {@link targetElement} or {@link canvas}.
|
|
10
|
+
* HTML element where AR preview will be presented.
|
|
13
11
|
*
|
|
14
12
|
* This is usually a <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div">div</a> element which
|
|
15
|
-
* is used solely for AR preview. AR preview will fully occupy the
|
|
16
|
-
* Therefore, position and size your
|
|
13
|
+
* is used solely for AR preview. AR preview will fully occupy the previewElement's space.
|
|
14
|
+
* Therefore, position and size your previewElement according to your preferred AR preview dimensions.
|
|
17
15
|
*
|
|
18
|
-
* > NOTE: AR preview will adjust to the size of the
|
|
16
|
+
* > NOTE: AR preview will adjust to the size of the previewElement if it changes.
|
|
19
17
|
*
|
|
20
|
-
* The canvas element will be appended as child to the
|
|
18
|
+
* The canvas element will be appended as child to the previewElement. If you wish to work with the canvas element directly
|
|
21
19
|
* and position and size it yourself then use {@link canvas} parameter instead.
|
|
20
|
+
*
|
|
21
|
+
* > ⚠️ You must specify {@link previewElement} or {@link canvas}.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
previewElement?: HTMLElement;
|
|
24
24
|
/**
|
|
25
25
|
* The URL of a DeepAR effect file. This effect will be applied when DeepAR is initialized.
|
|
26
26
|
* This parameter is optional. You can always later switch to a different effect with {@link DeepAR.switchEffect}.
|
|
@@ -42,9 +42,9 @@ export interface DeepARParams {
|
|
|
42
42
|
/**
|
|
43
43
|
* Canvas element where DeepAR will render the AR preview.
|
|
44
44
|
*
|
|
45
|
-
* > ⚠️ You must specify {@link
|
|
45
|
+
* > ⚠️ You must specify {@link previewElement} or {@link canvas}.
|
|
46
46
|
*
|
|
47
|
-
* The preferred way is by using the {@link
|
|
47
|
+
* The preferred way is by using the {@link previewElement} parameter.
|
|
48
48
|
* In that case, the DeepAR will take care of correctly sizing the canvas.
|
|
49
49
|
*
|
|
50
50
|
* @example
|
|
@@ -109,14 +109,58 @@ export interface DeepARParams {
|
|
|
109
109
|
*/
|
|
110
110
|
modelPath: string;
|
|
111
111
|
};
|
|
112
|
+
rigidFaceTrackingConfig?: {
|
|
113
|
+
/**
|
|
114
|
+
* Path to the pose libPoseEstimation.wasm file, e.g. "/path/to/deepar/wasm/libPoseEstimation.wasm".
|
|
115
|
+
*/
|
|
116
|
+
poseEstimationWasmPath?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Path to the detector model, e.g. "/path/to/deepar/models/foot/foot-detector.bin".
|
|
119
|
+
*/
|
|
120
|
+
detectorPath?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Path to the tracker model, e.g. "/path/to/deepar/models/foot/foot-tracker.bin".
|
|
123
|
+
*/
|
|
124
|
+
trackerPath?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Path to the foot model object file, e.g. "/path/to/deepar/models/foot/foot-model.obj".
|
|
127
|
+
*/
|
|
128
|
+
objPath?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Path to tfjs-backend-wasm.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm.wasm"
|
|
131
|
+
*/
|
|
132
|
+
tfjsBackendWasmPath?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Path to tfjs-backend-wasm-simd.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm-simd.wasm"
|
|
135
|
+
*/
|
|
136
|
+
tfjsBackendWasmSimdPath?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Path to tfjs-backend-wasm-threaded-simd.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm-threaded-simd.wasm"
|
|
139
|
+
*/
|
|
140
|
+
tfjsBackendWasmThreadedSimdPath?: string;
|
|
141
|
+
};
|
|
112
142
|
/**
|
|
113
143
|
* Segmentation module path and options.
|
|
114
144
|
*/
|
|
115
145
|
segmentationConfig?: {
|
|
116
146
|
/**
|
|
117
|
-
* Path to the segmentation model. Something like "path/to/deepar/models/segmentation/segmentation-192x192.bin".
|
|
147
|
+
* Path to the base segmentation model. Something like "path/to/deepar/models/segmentation/segmentation-192x192.bin".
|
|
148
|
+
* Thi is not used by default.
|
|
118
149
|
*/
|
|
119
|
-
modelPath
|
|
150
|
+
modelPath?: string;
|
|
151
|
+
/**
|
|
152
|
+
* MediaPipe segmentation config.
|
|
153
|
+
*/
|
|
154
|
+
mediaPipeConfig?: {
|
|
155
|
+
/**
|
|
156
|
+
* Base path to wasm fileset. Something like "path/to/deepar/mediaPipe/segmentation/wasm".
|
|
157
|
+
*/
|
|
158
|
+
wasmBasePath?: string;
|
|
159
|
+
/**
|
|
160
|
+
* MediaPipe selfie segmenter model to be used. Something like "path/to/deepar/mediaPipe/segmentation/model/selfie_segmenter.tflite".
|
|
161
|
+
*/
|
|
162
|
+
modelPath?: string;
|
|
163
|
+
};
|
|
120
164
|
};
|
|
121
165
|
/**
|
|
122
166
|
* Foot tracking module paths and options.
|
|
@@ -188,5 +232,13 @@ export interface DeepARParams {
|
|
|
188
232
|
* Path to deepar.wasm file. Something like "/path/to/deepar/wasm/deepar.wasm".
|
|
189
233
|
*/
|
|
190
234
|
deeparWasmPath?: string;
|
|
235
|
+
dynamicModulesConfig?: {
|
|
236
|
+
xzimgPath?: string;
|
|
237
|
+
mediaPipePath?: string;
|
|
238
|
+
};
|
|
239
|
+
embeddedEffectsConfig?: {
|
|
240
|
+
backgroundBlurPath?: string;
|
|
241
|
+
backgroundReplacementPath?: string;
|
|
242
|
+
};
|
|
191
243
|
};
|
|
192
244
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="dom-mediacapture-transform" />
|
|
2
|
+
export declare function startMediaRecorderVideoRecording(canvas: HTMLCanvasElement, options: {
|
|
3
|
+
audioTrack?: MediaStreamAudioTrack;
|
|
4
|
+
audioBitRate?: number;
|
|
5
|
+
audioSampleRate: number;
|
|
6
|
+
videoBitRate: number;
|
|
7
|
+
videoFrameRate: number;
|
|
8
|
+
mimeType: string;
|
|
9
|
+
}): void;
|
|
10
|
+
export declare function finishMediaRecorderVideoRecording(): Promise<Blob>;
|
package/js/types/version.d.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="dom-mediacapture-transform" />
|
|
2
|
+
import { DeepARCallbacks } from './callbacks';
|
|
3
|
+
export declare function startWebCodecVideoRecording(canvas: HTMLCanvasElement, callbacks: DeepARCallbacks, options: {
|
|
4
|
+
audioTrack?: MediaStreamAudioTrack;
|
|
5
|
+
audioBitRate?: number;
|
|
6
|
+
audioSampleRate: number;
|
|
7
|
+
videoBitRate: number;
|
|
8
|
+
videoFrameRate: number;
|
|
9
|
+
mimeType: string;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
export declare function finishWebCodecVideoRecording(callbacks: DeepARCallbacks): Promise<Blob>;
|
package/lib/LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Please see: https://developer.deepar.ai/customer-agreement
|