deepar 4.1.0 → 5.0.0-alpha-2
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 +123 -131
- package/effects/aviators +0 -0
- package/effects/dalmatian +0 -0
- package/effects/koala +0 -0
- package/effects/lion +0 -0
- package/js/deepar.esm.js +1 -1
- package/js/deepar.js +1 -1
- package/js/types/DeepAR.d.ts +306 -0
- package/js/types/callbacks.d.ts +42 -0
- package/js/types/faceData.d.ts +33 -0
- package/js/types/footData.d.ts +9 -0
- package/js/types/index.d.ts +7 -0
- package/js/types/initParams.d.ts +124 -0
- package/js/types/logType.d.ts +18 -0
- package/js/types/touchType.d.ts +34 -0
- package/js/types/version.d.ts +5 -0
- package/package.json +9 -3
- package/wasm/deepar.wasm +0 -0
- package/wasm/tfjs-backend-wasm-simd.wasm +0 -0
- package/wasm/tfjs-backend-wasm-threaded-simd.wasm +0 -0
- package/wasm/tfjs-backend-wasm.wasm +0 -0
- package/js/deepar.d.ts +0 -492
- package/js/deepar.esm.d.ts +0 -492
package/js/deepar.d.ts
DELETED
|
@@ -1,492 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Information about the face being tracked. FaceData object is constructed and passed in the {@link DeepARCallbacks.onFaceTracked} callback.
|
|
3
|
-
*/
|
|
4
|
-
export interface FaceData {
|
|
5
|
-
/**
|
|
6
|
-
* True if the face is detected, false otherwise.
|
|
7
|
-
*/
|
|
8
|
-
detected: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Array of 3 floats containing (x, y, z) position (translation) of the face in 3D space.
|
|
11
|
-
*/
|
|
12
|
-
translation: number[];
|
|
13
|
-
/**
|
|
14
|
-
* Array of 3 floats containing (x, y, z) rotation of the face in 3D space.
|
|
15
|
-
*/
|
|
16
|
-
rotation: number[];
|
|
17
|
-
/**
|
|
18
|
-
* Array of 16 floats containing 4x4 matrix representing translation and rotation of the face in 3D space.
|
|
19
|
-
*/
|
|
20
|
-
poseMatrix: number[];
|
|
21
|
-
/**
|
|
22
|
-
* Array of 63*3 floats containing (x, y, z) positions of the 3D face landmarks. Read more <a href="https://help.deepar.ai/en/articles/4351347-deepar-reference-tracking-models">here</a>.
|
|
23
|
-
*/
|
|
24
|
-
landmarks: number[];
|
|
25
|
-
/**
|
|
26
|
-
* Array of 63*2 floats containing (x, y) positions of the 2D face landmarks in screen space. Usually more precise than 3D points but no estimation for z translation. Read more here about feature points. Read more <a href="https://help.deepar.ai/en/articles/4351347-deepar-reference-tracking-models">here</a>.
|
|
27
|
-
*/
|
|
28
|
-
landmarks2d: number[];
|
|
29
|
-
/**
|
|
30
|
-
* Array of 4 floats. Rectangle (x, y, width, height) containing the face in screen coordinates.
|
|
31
|
-
*/
|
|
32
|
-
faceRect: number[];
|
|
33
|
-
}
|
|
34
|
-
export interface FootData {
|
|
35
|
-
/**
|
|
36
|
-
* True if the foot is detected, false otherwise.
|
|
37
|
-
*/
|
|
38
|
-
detected: boolean;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Functions that gets called by the DeepAR SDK.
|
|
42
|
-
* Pass them when creating {@link DeepAR} object in {@link DeepARParams.callbacks} object.
|
|
43
|
-
*/
|
|
44
|
-
export interface DeepARCallbacks {
|
|
45
|
-
/**
|
|
46
|
-
* Gets called when the SDK is fully initialized. <br>
|
|
47
|
-
* After this method is called you can safely call all methods of the {@link DeepAR} object. <br><br>
|
|
48
|
-
* NOTE: Some methods of {@link DeepAR} object can be called before the SDK is initialized. Those are: <br>
|
|
49
|
-
* - {@link DeepAR.downloadFaceTrackingModel} <br>
|
|
50
|
-
* - {@link DeepAR.setFaceTrackingModel} <br>
|
|
51
|
-
*/
|
|
52
|
-
onInitialize: () => void;
|
|
53
|
-
/**
|
|
54
|
-
* Called when the video is started after the call to {@link DeepAR.startVideo}.
|
|
55
|
-
*/
|
|
56
|
-
onVideoStarted?: () => void;
|
|
57
|
-
/**
|
|
58
|
-
* Called when the animation player transitions to a new state.
|
|
59
|
-
* @param newState Name of the new state that is being transitioned to.
|
|
60
|
-
*/
|
|
61
|
-
onAnimationTransitionedToState?: (newState: string) => void;
|
|
62
|
-
/**
|
|
63
|
-
* Called when the screenshot is taken after the call to {@link DeepAR.takeScreenshot}.
|
|
64
|
-
* @param photo The URL of the screenshot - result of HTMLCanvasElement.toDataURL("image/png")
|
|
65
|
-
*/
|
|
66
|
-
onScreenshotTaken?: (photo: string) => void;
|
|
67
|
-
/**
|
|
68
|
-
* Called when the screenshot is taken after the call to {@link DeepAR.takeScreenshot}.
|
|
69
|
-
* @param canvas Canvas containing the screenshot image. You can call canvas.toDataURL("image/png") to get the image or similar.
|
|
70
|
-
*/
|
|
71
|
-
onScreenshotTakenCanvas?: (canvas: HTMLCanvasElement) => void;
|
|
72
|
-
/**
|
|
73
|
-
* Called when the camera permission is asked after the call to {@link DeepAR.startVideo}.
|
|
74
|
-
*/
|
|
75
|
-
onCameraPermissionAsked?: () => void;
|
|
76
|
-
/**
|
|
77
|
-
* Called when the camera permission is denied after the call to {@link DeepAR.startVideo}.
|
|
78
|
-
*/
|
|
79
|
-
onCameraPermissionDenied?: () => void;
|
|
80
|
-
/**
|
|
81
|
-
* Called when the camera permission is granted after the call to {@link DeepAR.startVideo}.
|
|
82
|
-
*/
|
|
83
|
-
onCameraPermissionGranted?: () => void;
|
|
84
|
-
/**
|
|
85
|
-
* Called whenever the face enters or exits the camera field of view. <br>
|
|
86
|
-
* NOTE: This callback is only called when the SDK does face tracking. For example, you laded some effect that uses face tracking (most of them do). But if no effect is loaded this callback will not get called because the SDK is not performing face tracking.
|
|
87
|
-
* @param visible True if the face is visible on the camera, false otherwise.
|
|
88
|
-
*/
|
|
89
|
-
onFaceVisibilityChanged?: (visible: boolean) => void;
|
|
90
|
-
/**
|
|
91
|
-
* Passes the information about the detected faces. If this callback is set, it will get called every frame when a face is detected.
|
|
92
|
-
* @param faceDataArray Information about all the tracked faces.
|
|
93
|
-
*/
|
|
94
|
-
onFaceTracked?: (faceDataArray: FaceData[]) => void;
|
|
95
|
-
/**
|
|
96
|
-
* Called when foot tracking is fully initialized.
|
|
97
|
-
*/
|
|
98
|
-
onFootTrackingInitialized?: () => void;
|
|
99
|
-
/**
|
|
100
|
-
* Passes the information about the detected feet. If this callback is set, it will get called every frame when a foot is detected.
|
|
101
|
-
* @param leftFootData Information about the left foot.
|
|
102
|
-
* @param rightFootData Information about the right foot.
|
|
103
|
-
*/
|
|
104
|
-
onFeetTracked?: (leftFootData: FootData, rightFootData: FootData) => void;
|
|
105
|
-
/**
|
|
106
|
-
* Called when any DeepAR related event happens
|
|
107
|
-
* @param errorType Type of message.
|
|
108
|
-
* @param message Message contents
|
|
109
|
-
*/
|
|
110
|
-
onError?: (errorType: string, message: string) => void;
|
|
111
|
-
/**
|
|
112
|
-
* Called when the number of detected faces changes.
|
|
113
|
-
* @param n Number of faces detected.
|
|
114
|
-
*/
|
|
115
|
-
onNumberOfFacesVisibleChanged?: (n: number) => void;
|
|
116
|
-
/**
|
|
117
|
-
* Called after DeepAR successfully shuts down. Gets called after {@link DeepAR.shutdown}.
|
|
118
|
-
*/
|
|
119
|
-
onShutdown?: () => void;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Parameters for the initialization of {@link DeepAR} object.
|
|
123
|
-
*/
|
|
124
|
-
export interface DeepARParams {
|
|
125
|
-
/**
|
|
126
|
-
* License key created on <a href="https://developer.deepar.ai/">DeepAR developer portal</a> for your web app.
|
|
127
|
-
*/
|
|
128
|
-
licenseKey: string;
|
|
129
|
-
/**
|
|
130
|
-
* Canvas element where DeepAR will render the camera and effects/filters.
|
|
131
|
-
*/
|
|
132
|
-
canvas: HTMLCanvasElement;
|
|
133
|
-
/**
|
|
134
|
-
* Object containing configuration about the DeepAR segmentation which is used by background removal effects.
|
|
135
|
-
*/
|
|
136
|
-
segmentationConfig?: {
|
|
137
|
-
/**
|
|
138
|
-
* Path to the segmentation model. Something like "path/to/segmentation-192x192.bin".
|
|
139
|
-
*/
|
|
140
|
-
modelPath: string;
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* Object containing configuration for DeepAR foot tracking which is used for virtual shoe try on.
|
|
144
|
-
*/
|
|
145
|
-
footTrackingConfig?: DeepARFootTrackingConfig;
|
|
146
|
-
/**
|
|
147
|
-
* Path to deepar.wasm file. Something like "path/to/deepar.wasm".
|
|
148
|
-
*/
|
|
149
|
-
deeparWasmPath: string;
|
|
150
|
-
/**
|
|
151
|
-
* Object containing callback functions that get called by the DeepAR SDK.
|
|
152
|
-
*/
|
|
153
|
-
callbacks?: DeepARCallbacks;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Foot tracking initialization parameters.
|
|
157
|
-
*/
|
|
158
|
-
export interface DeepARFootTrackingConfig {
|
|
159
|
-
/**
|
|
160
|
-
* Path to the pose estimation wasm file, e.g. "/path/to/libPoseEstimation.wasm".
|
|
161
|
-
*/
|
|
162
|
-
poseEstimationWasmPath: string;
|
|
163
|
-
/**
|
|
164
|
-
* Path to the detector model, e.g. "/path/to/foot-detection-96x96x6.bin".
|
|
165
|
-
*/
|
|
166
|
-
detectorPath: string;
|
|
167
|
-
/**
|
|
168
|
-
* Path to the tracker model, e.g. "/path/to/foot-tracker-96x96x18-test.bin".
|
|
169
|
-
* For better performance on older devices, you can use "/path/to/foot-tracker-96x96x13-test.bin".
|
|
170
|
-
*/
|
|
171
|
-
trackerPath: string;
|
|
172
|
-
/**
|
|
173
|
-
* Path to the foot model object file, e.g. "/path/to/foot-model.obj".
|
|
174
|
-
*/
|
|
175
|
-
objPath: string;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Describes the touch/click type.
|
|
179
|
-
*/
|
|
180
|
-
export declare enum ARTouchType {
|
|
181
|
-
/**
|
|
182
|
-
* Touch started.
|
|
183
|
-
*/
|
|
184
|
-
Start = 0,
|
|
185
|
-
/**
|
|
186
|
-
* Touch is pressed and is being moved.
|
|
187
|
-
*/
|
|
188
|
-
Move = 1,
|
|
189
|
-
/**
|
|
190
|
-
* Touch ended.
|
|
191
|
-
*/
|
|
192
|
-
End = 2
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Information about the touch. Used by {@link DeepAR.touchOccurred}.
|
|
196
|
-
*/
|
|
197
|
-
export interface ARTouchInfo {
|
|
198
|
-
/**
|
|
199
|
-
* X coordinate.
|
|
200
|
-
*/
|
|
201
|
-
x: number;
|
|
202
|
-
/**
|
|
203
|
-
* Y coordinate
|
|
204
|
-
*/
|
|
205
|
-
y: number;
|
|
206
|
-
/**
|
|
207
|
-
* Touch type.
|
|
208
|
-
*/
|
|
209
|
-
touchType: ARTouchType;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* @internal
|
|
213
|
-
* Enum that defines possible types of logging messages.
|
|
214
|
-
*/
|
|
215
|
-
declare enum LogType {
|
|
216
|
-
/**
|
|
217
|
-
* Information logging message.
|
|
218
|
-
*/
|
|
219
|
-
INFO = 1,
|
|
220
|
-
/**
|
|
221
|
-
* Warning logging message.
|
|
222
|
-
*/
|
|
223
|
-
WARNING = 2,
|
|
224
|
-
/**
|
|
225
|
-
* Error logging message.
|
|
226
|
-
*/
|
|
227
|
-
ERROR = 3
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Parameters that specify the format of recorded videos. Used by {@link DeepAR.startVideoRecording}.
|
|
231
|
-
*/
|
|
232
|
-
export interface VideoRecordingOptions {
|
|
233
|
-
/**
|
|
234
|
-
* A MIME type specyfing the format for the resulting video, such as `video/webm` or `video/mp4`.
|
|
235
|
-
* Corresponds to the MIME type used by <a href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a>
|
|
236
|
-
* objects and <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder">MediaRecorder</a>
|
|
237
|
-
* from the MediaStream Recording API.
|
|
238
|
-
*
|
|
239
|
-
* Note that `video/mp4` may not be supported in all browsers.
|
|
240
|
-
*/
|
|
241
|
-
mimeType?: string;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Main class for interacting with DeepAR SDK.
|
|
245
|
-
*/
|
|
246
|
-
export declare class DeepAR {
|
|
247
|
-
private module;
|
|
248
|
-
private functionsToCallOnInitialize;
|
|
249
|
-
/**
|
|
250
|
-
* Callbacks property is used to add/remove/change callbacks called by the DeepAR SDK. See list of all callbacks at {@link DeepARCallbacks}. <br><br>
|
|
251
|
-
* Example : To add/change certain callback:
|
|
252
|
-
* ```javascript
|
|
253
|
-
* let deepAR = new DeepAR({...});
|
|
254
|
-
* deepAR.callbacks.onScreenshotTaken = (url) => {
|
|
255
|
-
* // download or show the image from url
|
|
256
|
-
* };
|
|
257
|
-
* ```
|
|
258
|
-
*
|
|
259
|
-
* To remove certain callback:
|
|
260
|
-
* ```javascript
|
|
261
|
-
* deepAR.callbacks.onScreenshotTaken = undefined;
|
|
262
|
-
* ```
|
|
263
|
-
*/
|
|
264
|
-
callbacks: DeepARCallbacks;
|
|
265
|
-
/**
|
|
266
|
-
* Downloads the effect file and loads it into the SDK for preview. The method used to switch any effect in the scene.
|
|
267
|
-
* @param face Specifies on which face the effect will be applied. The allowed values are 0, 1, 2 and 3.
|
|
268
|
-
* @param slot Specifies a namespace for the effect in the scene. In each slot, there can be only one effect. If you load another effect in the same slot the previous one will be removed and replaced with a new effect.
|
|
269
|
-
* @param path Path to the effect file exported from DeepAR studio.
|
|
270
|
-
* @param callback Callback to be called when the switching is complete.
|
|
271
|
-
*/
|
|
272
|
-
switchEffect(face: number, slot: string, path: string, callback?: () => void): void;
|
|
273
|
-
/**
|
|
274
|
-
* Clears the given slot of any loaded effects.
|
|
275
|
-
* @param slot The effect slot name.
|
|
276
|
-
*/
|
|
277
|
-
clearEffect(slot: string): void;
|
|
278
|
-
/**
|
|
279
|
-
* Starts the camera preview. <br><br>
|
|
280
|
-
* Order of events may look something like this: <br>
|
|
281
|
-
* - {@link DeepARCallbacks.onCameraPermissionAsked}
|
|
282
|
-
* - {@link DeepARCallbacks.onCameraPermissionGranted} or {@link DeepARCallbacks.onCameraPermissionDenied}
|
|
283
|
-
* - {@link DeepARCallbacks.onVideoStarted}
|
|
284
|
-
* @param mirror Mirror the video horizontally.
|
|
285
|
-
* @param mediaStreamConstraints Options passed to MediaDevices.getUserMedia().
|
|
286
|
-
*/
|
|
287
|
-
startVideo(mirror: boolean, mediaStreamConstraints?: MediaStreamConstraints): void;
|
|
288
|
-
/**
|
|
289
|
-
* Stops the camera preview.
|
|
290
|
-
*/
|
|
291
|
-
stopVideo(): void;
|
|
292
|
-
/**
|
|
293
|
-
* Used to pass the HTMLVideoElement to the DeepAR SDK. The SDK will grab frames from the video element and render the frames with masks/filters to the canvas. This method should be used instead of {@link DeepAR.startVideo} when you want to handle getUserMedia outside the SDK or you need to apply the masks to any video stream.
|
|
294
|
-
* @param videoElement Video element.
|
|
295
|
-
* @param mirror Mirror the video horizontally.
|
|
296
|
-
*/
|
|
297
|
-
setVideoElement(videoElement: HTMLVideoElement, mirror: boolean): void;
|
|
298
|
-
/**
|
|
299
|
-
* Shuts down the DeepAR SDK. Make sure to call if you do not want DeepAR processing frames anymore.
|
|
300
|
-
*/
|
|
301
|
-
shutdown(): void;
|
|
302
|
-
/**
|
|
303
|
-
* Downloads the face tracking model and initializes the face tracking. When it's done, the callback is invoked.
|
|
304
|
-
* @param path Path to the face tracking model. Something like "path/to/models-68-extreme.bin".
|
|
305
|
-
* @param callback Callback to be called when the download is complete.
|
|
306
|
-
*/
|
|
307
|
-
downloadFaceTrackingModel(path: string, callback?: () => void): void;
|
|
308
|
-
/**
|
|
309
|
-
* Downloads the foot tracking models and initializes foot tracking.
|
|
310
|
-
* @param options Foot tracking initialization options.
|
|
311
|
-
* @param options.config Foot tracking configuration. It will extend any previously defined foot tracking configuration.
|
|
312
|
-
* @param options.onInitialized Callback that gets called when foot tracking is fully initialized.
|
|
313
|
-
*/
|
|
314
|
-
initializeFootTracking(options?: {
|
|
315
|
-
config?: DeepARFootTrackingConfig;
|
|
316
|
-
onInitialized?: () => void;
|
|
317
|
-
}): void;
|
|
318
|
-
/**
|
|
319
|
-
* Sets the face tracking model data.
|
|
320
|
-
* @param byteArray Face tracking model data.
|
|
321
|
-
*/
|
|
322
|
-
setFaceTrackingModel(byteArray: Uint8Array): void;
|
|
323
|
-
/**
|
|
324
|
-
* Display debugging stats on screen.
|
|
325
|
-
* @param enabled
|
|
326
|
-
*/
|
|
327
|
-
showStats(enabled: boolean): void;
|
|
328
|
-
/**
|
|
329
|
-
* Enable or disable global physics simulation.
|
|
330
|
-
* @param enabled
|
|
331
|
-
*/
|
|
332
|
-
simulatePhysics(enabled: boolean): void;
|
|
333
|
-
/**
|
|
334
|
-
* Display physics colliders preview on screen.
|
|
335
|
-
* @param enabled
|
|
336
|
-
*/
|
|
337
|
-
showColliders(enabled: boolean): void;
|
|
338
|
-
/**
|
|
339
|
-
* Process RGBA image. Used for processing single image. Can be used instead of {@link DeepAR.startVideo} or {@link DeepAR.setVideoElement}.
|
|
340
|
-
* @param frame Image.
|
|
341
|
-
* @param width Width of the image.
|
|
342
|
-
* @param height Height of the image.
|
|
343
|
-
* @param mirror Mirror frame horizontally.
|
|
344
|
-
*/
|
|
345
|
-
processFrame(frame: Uint8Array, width: number, height: number, mirror: boolean): void;
|
|
346
|
-
/**
|
|
347
|
-
* If you want to apply DeepAR processing on a single image instead of a camera stream use this method. Can be used instead of {@link DeepAR.startVideo} or {@link DeepAR.setVideoElement}. See example usage <a href="https://github.com/DeepARSDK/photoedit-web-js">here</a>.
|
|
348
|
-
* @param image
|
|
349
|
-
*/
|
|
350
|
-
processImage(image: HTMLImageElement): void;
|
|
351
|
-
/**
|
|
352
|
-
* Resumes the previously paused processing and rendering of DeepAR SDK. You can pause SDK with {@link DeepAR.pause}.
|
|
353
|
-
*/
|
|
354
|
-
resume(): void;
|
|
355
|
-
/**
|
|
356
|
-
* Pauses the DeepAR processing and rendering on canvas. You can resume it with {@link DeepAR.resume}.
|
|
357
|
-
*/
|
|
358
|
-
pause(): void;
|
|
359
|
-
/**
|
|
360
|
-
* Changes a node or component bool parameter of the currently loaded effect. For more details about changeParameter API read our docs <a href="https://docs.deepar.ai/guides-and-tutorials/changing-filter-parameters-from-code">here</a>.
|
|
361
|
-
* @param gameObject The name of the node from DeepAR Studio. If multiple nodes share the same name, only the first one will be affected.
|
|
362
|
-
* @param component The name of the component. If the name of the component is null or an empty string, the node itself will be affected.
|
|
363
|
-
* @param parameter The name of the parameter.
|
|
364
|
-
* @param value New parameter value.
|
|
365
|
-
*/
|
|
366
|
-
changeParameterFloat(gameObject: string, component: string, parameter: string, value: number): void;
|
|
367
|
-
/**
|
|
368
|
-
* Changes a node or component float parameter of the currently loaded effect. For more details about changeParameter API read our docs <a href="https://docs.deepar.ai/guides-and-tutorials/changing-filter-parameters-from-code">here</a>.
|
|
369
|
-
* @param gameObject The name of the node from DeepAR Studio. If multiple nodes share the same name, only the first one will be affected.
|
|
370
|
-
* @param component The name of the component. If the name of the component is null or an empty string, the node itself will be affected.
|
|
371
|
-
* @param parameter The name of the parameter.
|
|
372
|
-
* @param value New parameter value.
|
|
373
|
-
*/
|
|
374
|
-
changeParameterBool(gameObject: string, component: string, parameter: string, value: boolean): void;
|
|
375
|
-
/**
|
|
376
|
-
* Changes a node or component vector parameter of the currently loaded effect. For more details about changeParameter API read our docs <a href="https://docs.deepar.ai/guides-and-tutorials/changing-filter-parameters-from-code">here</a>.
|
|
377
|
-
* @param gameObject The name of the node from DeepAR Studio. If multiple nodes share the same name, only the first one will be affected.
|
|
378
|
-
* @param component The name of the component. If the name of the component is null or an empty string, the node itself will be affected.
|
|
379
|
-
* @param parameter The name of the parameter.
|
|
380
|
-
* @param x X component of the new parameter vector.
|
|
381
|
-
* @param y Y component of the new parameter vector.
|
|
382
|
-
* @param z Z component of the new parameter vector.
|
|
383
|
-
* @param w W component of the new parameter vector.
|
|
384
|
-
*/
|
|
385
|
-
changeParameterVector(gameObject: string, component: string, parameter: string, x: number, y: number, z: number, w: number): void;
|
|
386
|
-
/**
|
|
387
|
-
* Changes a node or component texture parameter of the currently loaded effect. For more details about changeParameter API read our docs <a href="https://docs.deepar.ai/guides-and-tutorials/changing-filter-parameters-from-code">here</a>.
|
|
388
|
-
* @param gameObject The name of the node from DeepAR Studio. If multiple nodes share the same name, only the first one will be affected.
|
|
389
|
-
* @param component The name of the component. If the name of the component is null or an empty string, the node itself will be affected.
|
|
390
|
-
* @param parameter The name of the parameter.
|
|
391
|
-
* @param textureUrl Url of the image that is going to be used as texture.
|
|
392
|
-
*/
|
|
393
|
-
changeParameterTexture(gameObject: string, component: string, parameter: string, textureUrl: string): void;
|
|
394
|
-
/**
|
|
395
|
-
* Captures a screenshot of the current screen. Callback {@link DeepARCallbacks.onScreenshotTaken} will be called after it's done.
|
|
396
|
-
*/
|
|
397
|
-
takeScreenshot(): void;
|
|
398
|
-
/**
|
|
399
|
-
* Set the FPS.
|
|
400
|
-
* @param fps New FPS.
|
|
401
|
-
*/
|
|
402
|
-
setFps(fps: number): void;
|
|
403
|
-
/**
|
|
404
|
-
* Moves the selected game object from its current position in a tree and sets it as a direct child of a target game object.
|
|
405
|
-
* This is equivalent to moving around a node in the node hierarchy in the DeepAR Studio.
|
|
406
|
-
* @param selectedGameObject Node to move.
|
|
407
|
-
* @param targetGameObject New node parent.
|
|
408
|
-
*/
|
|
409
|
-
moveGameObject(selectedGameObject: string, targetGameObject: string): void;
|
|
410
|
-
/**
|
|
411
|
-
* This method allows the user to fire a custom animation trigger for model animations from code. To fire a custom trigger,
|
|
412
|
-
* the trigger string must match the custom trigger set in the Studio when creating the effect. Read more <a href="https://help.deepar.ai/en/articles/4354740-animations-tutorial-fbx-model-animations">here</a>.
|
|
413
|
-
* @param trigger The name of the trigger.
|
|
414
|
-
*/
|
|
415
|
-
fireTrigger(trigger: string): void;
|
|
416
|
-
/**
|
|
417
|
-
* Informs DeepAR that the specified touch event occurred.
|
|
418
|
-
* @param touchInfo Touch event information.
|
|
419
|
-
*/
|
|
420
|
-
touchOccurred(touchInfo: ARTouchInfo): void;
|
|
421
|
-
/**
|
|
422
|
-
* Starts video recording of the canvas.
|
|
423
|
-
* @param options Video recording options.
|
|
424
|
-
*/
|
|
425
|
-
startVideoRecording(options?: VideoRecordingOptions): void;
|
|
426
|
-
/**
|
|
427
|
-
* Stops the video recording and returns a video blob via callback.
|
|
428
|
-
* @param callback A callback function with single argument that will be a blob of video/mp4 file.
|
|
429
|
-
*/
|
|
430
|
-
finishVideoRecording(callback: (video: Blob) => void): void;
|
|
431
|
-
/**
|
|
432
|
-
* @internal
|
|
433
|
-
* Pushes message to the console log buffer.
|
|
434
|
-
* @param message Message to be pushed to the console log buffer.
|
|
435
|
-
* @param logType Logging type.
|
|
436
|
-
* @returns true if the message was successfully pushed, false otherwise
|
|
437
|
-
*/
|
|
438
|
-
pushConsoleLog(message: string, logType: LogType): boolean;
|
|
439
|
-
/**
|
|
440
|
-
* @internal
|
|
441
|
-
* Returns all the messages pushed to the console log buffer and empties
|
|
442
|
-
* the buffer.
|
|
443
|
-
* @returns All the messages from console log buffer.
|
|
444
|
-
*/
|
|
445
|
-
getConsoleLogs(): any;
|
|
446
|
-
/**
|
|
447
|
-
* Change face detection sensitivity
|
|
448
|
-
* @param sensitivity 0 .. 5 (0 is fast, 4,5 is slow but allows to find smaller faces)
|
|
449
|
-
*/
|
|
450
|
-
setFaceDetectionSensitivity(sensitivity: number): void;
|
|
451
|
-
/**
|
|
452
|
-
* Enable/disable forced rendering on the canvas. It is useful to enable offscreen rendering in scenarios when the browser
|
|
453
|
-
* does not call requestAnimationFrame() function. DeepAR internally uses requestAnimationFrame() for the rendering loop.
|
|
454
|
-
* For example, when the browser tab is not focused, the browser will not call requestAnimationFrame() and DeepAR will not
|
|
455
|
-
* render. If offscreen rendering is enabled, DeepAR will use its internal timer for the rendering loop. Note that offscreen
|
|
456
|
-
* rendering enabled will not have as good results in terms of FPS compared to offscreen rendering disabled. <br><br>
|
|
457
|
-
*
|
|
458
|
-
* If you need to use offscreen rendering. The best practice is to enable it only when needed - like when the browser tab is not focused.
|
|
459
|
-
* Otherwise, it is best to always disable offscreen rendering.
|
|
460
|
-
* @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.
|
|
461
|
-
*/
|
|
462
|
-
setOffscreenRenderingEnabled(enable: boolean): void;
|
|
463
|
-
/**
|
|
464
|
-
* @internal
|
|
465
|
-
* @param enable
|
|
466
|
-
*/
|
|
467
|
-
enableAutoframing(enable: boolean): void;
|
|
468
|
-
/**
|
|
469
|
-
* Used to initialize the DeepAR SDK.<br><br>
|
|
470
|
-
* <strong><u>IMPORTANT</u></strong>: Note that this is now called with the <b>new</b> keyword. In previous versions of SDK this was just a plain function called without new keyword
|
|
471
|
-
* Also, you cannot create more than one {@link DeepAR} object instances. You need to call {@link DeepAR.shutdown} first if you want to create another {@link DeepAR} object. <br><br>
|
|
472
|
-
* @param {DeepARParams} params An object containing the DeepAR initialization parameters. See example below.
|
|
473
|
-
* @example
|
|
474
|
-
* let deepAR = new DeepAR({
|
|
475
|
-
* licenseKey: 'your_license_key_here',
|
|
476
|
-
* canvas: document.getElementById('deepar-canvas'),
|
|
477
|
-
* deeparWasmPath: 'path/to/deepar.wasm',
|
|
478
|
-
* segmentationConfig: {
|
|
479
|
-
* modelPath: "path/to/segmentation-192x192.bin" // Not needed if you don't use background removal effects.
|
|
480
|
-
* },
|
|
481
|
-
* callbacks: {
|
|
482
|
-
* onInitialize: function() {
|
|
483
|
-
* deepAR.startVideo(true);
|
|
484
|
-
* }
|
|
485
|
-
* }
|
|
486
|
-
* });
|
|
487
|
-
* // download the face tracking model
|
|
488
|
-
* deepAR.downloadFaceTrackingModel('models/models-68-extreme.bin');
|
|
489
|
-
*/
|
|
490
|
-
constructor(params: DeepARParams);
|
|
491
|
-
}
|
|
492
|
-
export {};
|