@webex/web-media-effects-types 2.28.2 → 2.30.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.
- package/index.d.ts +132 -6
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import TypedEmitter from 'typed-emitter';
|
|
2
|
-
import { IFrameInferenceResult,
|
|
3
|
-
export { BlurStrength,
|
|
2
|
+
import { IFrameInferenceResult, Quality, BlurStrength, Pipeline } from '@webex/ladon-ts';
|
|
3
|
+
export { BlurStrength, Quality } from '@webex/ladon-ts';
|
|
4
4
|
import * as js_logger from 'js-logger';
|
|
5
5
|
export { default as Logger } from 'js-logger';
|
|
6
6
|
|
|
@@ -261,10 +261,57 @@ declare class PluginManager {
|
|
|
261
261
|
dispose(): void;
|
|
262
262
|
getPlugin<T extends PluginType>(name: string): T | undefined;
|
|
263
263
|
getPlugins(): Map<string, Plugin>;
|
|
264
|
+
getPluginCount(): number;
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
declare function debounce<F extends (...args: Parameters<F>) => ReturnType<F>>(func: F, delay: number): (...args: Parameters<F>) => void;
|
|
267
268
|
|
|
269
|
+
interface DebugStats {
|
|
270
|
+
frameRate: number;
|
|
271
|
+
modelReady: boolean;
|
|
272
|
+
effectEnabled: boolean;
|
|
273
|
+
trackEnabled: boolean;
|
|
274
|
+
mode: string;
|
|
275
|
+
quality: string;
|
|
276
|
+
frameInterval: number;
|
|
277
|
+
lastFrameTime: number;
|
|
278
|
+
inputDimensions: {
|
|
279
|
+
width: number;
|
|
280
|
+
height: number;
|
|
281
|
+
};
|
|
282
|
+
outputDimensions: {
|
|
283
|
+
width: number;
|
|
284
|
+
height: number;
|
|
285
|
+
};
|
|
286
|
+
videoWidth?: number;
|
|
287
|
+
videoHeight?: number;
|
|
288
|
+
videoFrameRate?: number;
|
|
289
|
+
cpuCores: number;
|
|
290
|
+
deviceMemory?: number;
|
|
291
|
+
connectionType?: string;
|
|
292
|
+
effectiveType?: string;
|
|
293
|
+
memoryUsage?: number;
|
|
294
|
+
webglVendor?: string;
|
|
295
|
+
webglRenderer?: string;
|
|
296
|
+
maxTextureSize?: number;
|
|
297
|
+
imageCaptureActive: boolean;
|
|
298
|
+
trackProcessorActive: boolean;
|
|
299
|
+
pluginCount: number;
|
|
300
|
+
totalFrameTime?: number;
|
|
301
|
+
modelInferenceTime?: number;
|
|
302
|
+
preprocessingTime?: number;
|
|
303
|
+
postprocessingTime?: number;
|
|
304
|
+
inferenceSkipped?: boolean;
|
|
305
|
+
modelInferenceFPS?: number;
|
|
306
|
+
averageFrameTime?: number;
|
|
307
|
+
frameDrops?: number;
|
|
308
|
+
computePressure?: {
|
|
309
|
+
state: 'nominal' | 'fair' | 'serious' | 'critical';
|
|
310
|
+
source: string;
|
|
311
|
+
};
|
|
312
|
+
errors: string[];
|
|
313
|
+
}
|
|
314
|
+
|
|
268
315
|
declare enum VirtualBackgroundMode {
|
|
269
316
|
Blur = "BLUR",
|
|
270
317
|
Image = "IMAGE",
|
|
@@ -276,6 +323,7 @@ declare type LadonOverrides = {
|
|
|
276
323
|
modelRank?: number;
|
|
277
324
|
workerUri?: string;
|
|
278
325
|
executionProviders?: string[];
|
|
326
|
+
generationIntervalMs?: number;
|
|
279
327
|
inputSize?: {
|
|
280
328
|
width: number;
|
|
281
329
|
height: number;
|
|
@@ -291,7 +339,6 @@ declare type LadonOverrides = {
|
|
|
291
339
|
modelUrlResolver?: (modelPath: string) => Promise<string>;
|
|
292
340
|
};
|
|
293
341
|
interface VirtualBackgroundEffectOptions extends EffectOptions {
|
|
294
|
-
generator: Generator;
|
|
295
342
|
mode: VirtualBackgroundMode;
|
|
296
343
|
quality: Quality;
|
|
297
344
|
frameRate?: number;
|
|
@@ -324,21 +371,23 @@ declare class VirtualBackgroundEffect extends BaseCameraEffect {
|
|
|
324
371
|
private preloadFuture?;
|
|
325
372
|
private loadFuture?;
|
|
326
373
|
private disposeFuture?;
|
|
374
|
+
private updateFuture?;
|
|
327
375
|
private lastFrameTime;
|
|
328
|
-
private frameInterval;
|
|
329
376
|
private restoreEffectOnTrackEnable;
|
|
330
377
|
private setTimeoutId?;
|
|
331
378
|
private rafId?;
|
|
332
|
-
private
|
|
379
|
+
private lastInferenceResult?;
|
|
333
380
|
private pluginManager;
|
|
334
381
|
private beforeInferenceCallbacks;
|
|
335
382
|
private afterInferenceCallbacks;
|
|
336
383
|
private offscreenCanvas?;
|
|
337
384
|
private inputCanvasContext?;
|
|
338
385
|
private configBuilder;
|
|
386
|
+
private debugStatsGenerator;
|
|
339
387
|
get isReady(): boolean;
|
|
340
388
|
get isLoaded(): boolean;
|
|
341
389
|
get frameRate(): number;
|
|
390
|
+
get frameInterval(): number;
|
|
342
391
|
constructor(options?: Partial<VirtualBackgroundEffectOptions>);
|
|
343
392
|
preloadAssets(): Promise<void>;
|
|
344
393
|
loadMediaStream(input: MediaStream): Promise<MediaStream>;
|
|
@@ -377,6 +426,7 @@ declare class VirtualBackgroundEffect extends BaseCameraEffect {
|
|
|
377
426
|
initializePlugins: () => void;
|
|
378
427
|
getPlugin: <T extends PluginType>(name: string) => T | undefined;
|
|
379
428
|
getPluginManager: () => PluginManager;
|
|
429
|
+
getStats(): DebugStats;
|
|
380
430
|
}
|
|
381
431
|
declare const createVirtualBackgroundEffect: (options?: VirtualBackgroundEffectOptions, preloadAssets?: boolean) => Promise<VirtualBackgroundEffect>;
|
|
382
432
|
|
|
@@ -384,6 +434,7 @@ declare abstract class BaseInferencePlugin<T, O> {
|
|
|
384
434
|
protected core: T;
|
|
385
435
|
protected options: O;
|
|
386
436
|
protected isEffectEnabled: boolean;
|
|
437
|
+
protected baseInferenceCleanup?: () => void;
|
|
387
438
|
isInitialized: boolean;
|
|
388
439
|
constructor(options?: Partial<O>);
|
|
389
440
|
initialize(effect: VirtualBackgroundEffect): void;
|
|
@@ -408,6 +459,7 @@ declare abstract class BaseEventEmitterPlugin<T extends EventEmitter<unknown>, O
|
|
|
408
459
|
}
|
|
409
460
|
|
|
410
461
|
declare abstract class BaseAfterInferencePlugin<T extends EventEmitter<unknown> = EventEmitter<unknown>, O extends object = Record<string, never>> extends BaseEventEmitterPlugin<T, O> {
|
|
462
|
+
private afterInferenceCleanup?;
|
|
411
463
|
constructor(options?: Partial<O>);
|
|
412
464
|
initialize(effect: VirtualBackgroundEffect): void;
|
|
413
465
|
dispose(): void;
|
|
@@ -426,6 +478,76 @@ declare class BeRightBackPlugin extends BaseAfterInferencePlugin<BeRightBack, Be
|
|
|
426
478
|
declare function getOptionsByMode(mode: BeRightBackPluginMode): BeRightBackOptions;
|
|
427
479
|
declare function makeBeRightBackOptions(mode: BeRightBackPluginMode, coreOptions?: Partial<BeRightBackOptions>): BeRightBackOptions;
|
|
428
480
|
|
|
481
|
+
interface DebugOverlayCoreOptions {
|
|
482
|
+
showOnInit?: boolean;
|
|
483
|
+
updateInterval?: number;
|
|
484
|
+
maxErrors?: number;
|
|
485
|
+
}
|
|
486
|
+
interface DebugOverlayPluginOptions {
|
|
487
|
+
debug?: boolean;
|
|
488
|
+
coreOptions?: DebugOverlayCoreOptions;
|
|
489
|
+
}
|
|
490
|
+
declare const DEFAULT_DEBUG_OVERLAY_OPTIONS: DebugOverlayPluginOptions;
|
|
491
|
+
|
|
492
|
+
declare class DebugOverlay extends EventEmitter<unknown> {
|
|
493
|
+
private getStats?;
|
|
494
|
+
private overlay?;
|
|
495
|
+
private statsContainer?;
|
|
496
|
+
private header?;
|
|
497
|
+
private resizeHandle?;
|
|
498
|
+
private sectionsCreated;
|
|
499
|
+
private sectionElements;
|
|
500
|
+
private effect?;
|
|
501
|
+
private pressureObserver?;
|
|
502
|
+
private isVisible;
|
|
503
|
+
private options;
|
|
504
|
+
private isResizing;
|
|
505
|
+
private startX;
|
|
506
|
+
private startY;
|
|
507
|
+
private startWidth;
|
|
508
|
+
private startHeight;
|
|
509
|
+
private updateInterval?;
|
|
510
|
+
private dom;
|
|
511
|
+
private styles;
|
|
512
|
+
private stats;
|
|
513
|
+
constructor(options?: Partial<DebugOverlayCoreOptions>);
|
|
514
|
+
show(): void;
|
|
515
|
+
hide(): void;
|
|
516
|
+
toggle(): void;
|
|
517
|
+
get visible(): boolean;
|
|
518
|
+
setStatsProvider(getStatsCallback: () => DebugStats): void;
|
|
519
|
+
private updateDisplayStats;
|
|
520
|
+
private showStatsError;
|
|
521
|
+
private hideStatsError;
|
|
522
|
+
private startUpdateInterval;
|
|
523
|
+
private stopUpdateInterval;
|
|
524
|
+
static getDefaultStats(): DebugStats;
|
|
525
|
+
private createOverlay;
|
|
526
|
+
private createStatsSections;
|
|
527
|
+
private renderStats;
|
|
528
|
+
private updateSectionContent;
|
|
529
|
+
private resetSections;
|
|
530
|
+
private setupKeyboardListener;
|
|
531
|
+
private setupPerformanceMonitoring;
|
|
532
|
+
private setupDragToMove;
|
|
533
|
+
private setupResizeHandlers;
|
|
534
|
+
dispose(): void;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
declare class DebugOverlayPlugin extends BaseAfterInferencePlugin<DebugOverlay, DebugOverlayPluginOptions> {
|
|
538
|
+
protected getDefaultOptions(): DebugOverlayPluginOptions;
|
|
539
|
+
protected createCore(): DebugOverlay;
|
|
540
|
+
protected onCoreCreated(): void;
|
|
541
|
+
initialize(effect: VirtualBackgroundEffect): void;
|
|
542
|
+
getDebugOverlay(): DebugOverlay;
|
|
543
|
+
show(): void;
|
|
544
|
+
hide(): void;
|
|
545
|
+
toggle(): void;
|
|
546
|
+
get visible(): boolean;
|
|
547
|
+
onAfterInference(timestamp: number, inferenceResult?: IFrameInferenceResult): Promise<void>;
|
|
548
|
+
dispose(): void;
|
|
549
|
+
}
|
|
550
|
+
|
|
429
551
|
interface FrameSkipperOptions {
|
|
430
552
|
baseMinSkipTime: number;
|
|
431
553
|
baseMaxSkipTime: number;
|
|
@@ -515,6 +637,7 @@ interface RateEstimatedValues {
|
|
|
515
637
|
rate?: number;
|
|
516
638
|
status: RateEstimatorStatus;
|
|
517
639
|
threshold: number;
|
|
640
|
+
targetRate: number;
|
|
518
641
|
}
|
|
519
642
|
interface RateEstimatorOptions {
|
|
520
643
|
hysteresisMargin: number;
|
|
@@ -522,6 +645,7 @@ interface RateEstimatorOptions {
|
|
|
522
645
|
lowThreshold: number;
|
|
523
646
|
minSamples: number;
|
|
524
647
|
maxSamples: number;
|
|
648
|
+
targetRate: number;
|
|
525
649
|
}
|
|
526
650
|
declare enum RateEstimatorEvent {
|
|
527
651
|
RateOk = "rate-ok",
|
|
@@ -567,9 +691,11 @@ declare class RateEstimationPlugin extends BaseAfterInferencePlugin<RateEstimato
|
|
|
567
691
|
onEffectEnabled(): void;
|
|
568
692
|
destroyCore(): void;
|
|
569
693
|
onAfterInference(timestamp: number): Promise<void>;
|
|
694
|
+
onOptionsUpdated(): void;
|
|
570
695
|
getRate(): number | undefined;
|
|
571
696
|
getThreshold(): number | undefined;
|
|
572
697
|
getStatus(): RateEstimatorStatus | undefined;
|
|
698
|
+
getTargetRate(): number | undefined;
|
|
573
699
|
}
|
|
574
700
|
|
|
575
701
|
declare class SkippedFrameRatePlugin extends BaseAfterInferencePlugin {
|
|
@@ -584,4 +710,4 @@ declare class SkippedFrameRatePlugin extends BaseAfterInferencePlugin {
|
|
|
584
710
|
declare const logger: js_logger.ILogger;
|
|
585
711
|
//# sourceMappingURL=logger.d.ts.map
|
|
586
712
|
|
|
587
|
-
export { AdaptiveFrameSkipper, BaseCameraEffect, BaseEffect, BaseMicrophoneEffect, BeRightBack, BeRightBackAction, BeRightBackDebugInfo, BeRightBackEvent, BeRightBackEventCallback, BeRightBackOptions, BeRightBackPlugin, BeRightBackPluginMode, BeRightBackPluginOptions, BeRightBackState, DEFAULT_FRAME_RATE, EffectEnv, EffectEvent, EffectEventCallback, EffectOptions, EffectState, FrameSkipperDebugInfo, FrameSkipperInferenceReason, FrameSkipperOptions, FrameSkipperPlugin, FrameSkipperPluginMode, FrameSkipperPluginOptions, GainEffect, LadonOverrides, MediaStreamOrTrack, NoiseReductionEffect, NoiseReductionEffectOptions, NoiseReductionMode, RateEstimatedValues, RateEstimationPlugin, RateEstimationPluginOptions, RateEstimator, RateEstimatorEvent, RateEstimatorEventCallback, RateEstimatorOptions, RateEstimatorStatus, SkippedFrameRatePlugin, TrackEffect, VirtualBackgroundEffect, VirtualBackgroundEffectOptions, VirtualBackgroundMode, createEffect, createNoiseReductionEffect, createVirtualBackgroundEffect, getOptionsByMode, logger, makeBeRightBackOptions, makeFrameSkipperOptions };
|
|
713
|
+
export { AdaptiveFrameSkipper, BaseCameraEffect, BaseEffect, BaseMicrophoneEffect, BeRightBack, BeRightBackAction, BeRightBackDebugInfo, BeRightBackEvent, BeRightBackEventCallback, BeRightBackOptions, BeRightBackPlugin, BeRightBackPluginMode, BeRightBackPluginOptions, BeRightBackState, DEFAULT_DEBUG_OVERLAY_OPTIONS, DEFAULT_FRAME_RATE, DebugOverlay, DebugOverlayCoreOptions, DebugOverlayPlugin, DebugOverlayPluginOptions, EffectEnv, EffectEvent, EffectEventCallback, EffectOptions, EffectState, FrameSkipperDebugInfo, FrameSkipperInferenceReason, FrameSkipperOptions, FrameSkipperPlugin, FrameSkipperPluginMode, FrameSkipperPluginOptions, GainEffect, LadonOverrides, MediaStreamOrTrack, NoiseReductionEffect, NoiseReductionEffectOptions, NoiseReductionMode, RateEstimatedValues, RateEstimationPlugin, RateEstimationPluginOptions, RateEstimator, RateEstimatorEvent, RateEstimatorEventCallback, RateEstimatorOptions, RateEstimatorStatus, SkippedFrameRatePlugin, TrackEffect, VirtualBackgroundEffect, VirtualBackgroundEffectOptions, VirtualBackgroundMode, createEffect, createNoiseReductionEffect, createVirtualBackgroundEffect, getOptionsByMode, logger, makeBeRightBackOptions, makeFrameSkipperOptions };
|