@voltkit-rtc/client 0.7.3 → 0.9.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/CHANGELOG.md +86 -0
- package/README.md +346 -2
- package/dist/cjs/adaptive.d.ts +104 -0
- package/dist/cjs/adaptive.d.ts.map +1 -0
- package/dist/cjs/adaptive.js +263 -0
- package/dist/cjs/adaptive.js.map +1 -0
- package/dist/cjs/devices.d.ts +42 -0
- package/dist/cjs/devices.d.ts.map +1 -0
- package/dist/cjs/devices.js +56 -0
- package/dist/cjs/devices.js.map +1 -0
- package/dist/cjs/diagnostics.d.ts +65 -0
- package/dist/cjs/diagnostics.d.ts.map +1 -0
- package/dist/cjs/diagnostics.js +69 -0
- package/dist/cjs/diagnostics.js.map +1 -0
- package/dist/cjs/effects-core.d.ts +95 -0
- package/dist/cjs/effects-core.d.ts.map +1 -0
- package/dist/cjs/effects-core.js +154 -0
- package/dist/cjs/effects-core.js.map +1 -0
- package/dist/cjs/effects-gl.d.ts +79 -0
- package/dist/cjs/effects-gl.d.ts.map +1 -0
- package/dist/cjs/effects-gl.js +351 -0
- package/dist/cjs/effects-gl.js.map +1 -0
- package/dist/cjs/fallback.d.ts +81 -0
- package/dist/cjs/fallback.d.ts.map +1 -0
- package/dist/cjs/fallback.js +148 -0
- package/dist/cjs/fallback.js.map +1 -0
- package/dist/cjs/health.d.ts +70 -0
- package/dist/cjs/health.d.ts.map +1 -0
- package/dist/cjs/health.js +116 -0
- package/dist/cjs/health.js.map +1 -0
- package/dist/cjs/index.d.ts +396 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1367 -81
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/link.d.ts +99 -0
- package/dist/cjs/link.d.ts.map +1 -0
- package/dist/cjs/link.js +219 -0
- package/dist/cjs/link.js.map +1 -0
- package/dist/cjs/noise-suppression.d.ts +44 -0
- package/dist/cjs/noise-suppression.d.ts.map +1 -0
- package/dist/cjs/noise-suppression.js +103 -0
- package/dist/cjs/noise-suppression.js.map +1 -0
- package/dist/cjs/preflight.d.ts +79 -0
- package/dist/cjs/preflight.d.ts.map +1 -0
- package/dist/cjs/preflight.js +159 -0
- package/dist/cjs/preflight.js.map +1 -0
- package/dist/cjs/processors.d.ts +34 -0
- package/dist/cjs/processors.d.ts.map +1 -0
- package/dist/cjs/processors.js +10 -0
- package/dist/cjs/processors.js.map +1 -0
- package/dist/cjs/speakers.d.ts +34 -0
- package/dist/cjs/speakers.d.ts.map +1 -0
- package/dist/cjs/speakers.js +71 -0
- package/dist/cjs/speakers.js.map +1 -0
- package/dist/cjs/video-effects.d.ts +93 -0
- package/dist/cjs/video-effects.d.ts.map +1 -0
- package/dist/cjs/video-effects.js +493 -0
- package/dist/cjs/video-effects.js.map +1 -0
- package/dist/esm/adaptive.d.ts +104 -0
- package/dist/esm/adaptive.d.ts.map +1 -0
- package/dist/esm/adaptive.js +256 -0
- package/dist/esm/adaptive.js.map +1 -0
- package/dist/esm/devices.d.ts +42 -0
- package/dist/esm/devices.d.ts.map +1 -0
- package/dist/esm/devices.js +50 -0
- package/dist/esm/devices.js.map +1 -0
- package/dist/esm/diagnostics.d.ts +65 -0
- package/dist/esm/diagnostics.d.ts.map +1 -0
- package/dist/esm/diagnostics.js +65 -0
- package/dist/esm/diagnostics.js.map +1 -0
- package/dist/esm/effects-core.d.ts +95 -0
- package/dist/esm/effects-core.d.ts.map +1 -0
- package/dist/esm/effects-core.js +142 -0
- package/dist/esm/effects-core.js.map +1 -0
- package/dist/esm/effects-gl.d.ts +79 -0
- package/dist/esm/effects-gl.d.ts.map +1 -0
- package/dist/esm/effects-gl.js +347 -0
- package/dist/esm/effects-gl.js.map +1 -0
- package/dist/esm/fallback.d.ts +81 -0
- package/dist/esm/fallback.d.ts.map +1 -0
- package/dist/esm/fallback.js +142 -0
- package/dist/esm/fallback.js.map +1 -0
- package/dist/esm/health.d.ts +70 -0
- package/dist/esm/health.d.ts.map +1 -0
- package/dist/esm/health.js +111 -0
- package/dist/esm/health.js.map +1 -0
- package/dist/esm/index.d.ts +396 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1365 -81
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/link.d.ts +99 -0
- package/dist/esm/link.d.ts.map +1 -0
- package/dist/esm/link.js +214 -0
- package/dist/esm/link.js.map +1 -0
- package/dist/esm/noise-suppression.d.ts +44 -0
- package/dist/esm/noise-suppression.d.ts.map +1 -0
- package/dist/esm/noise-suppression.js +99 -0
- package/dist/esm/noise-suppression.js.map +1 -0
- package/dist/esm/preflight.d.ts +79 -0
- package/dist/esm/preflight.d.ts.map +1 -0
- package/dist/esm/preflight.js +153 -0
- package/dist/esm/preflight.js.map +1 -0
- package/dist/esm/processors.d.ts +34 -0
- package/dist/esm/processors.d.ts.map +1 -0
- package/dist/esm/processors.js +9 -0
- package/dist/esm/processors.js.map +1 -0
- package/dist/esm/speakers.d.ts +34 -0
- package/dist/esm/speakers.d.ts.map +1 -0
- package/dist/esm/speakers.js +67 -0
- package/dist/esm/speakers.js.map +1 -0
- package/dist/esm/video-effects.d.ts +93 -0
- package/dist/esm/video-effects.d.ts.map +1 -0
- package/dist/esm/video-effects.js +488 -0
- package/dist/esm/video-effects.js.map +1 -0
- package/package.json +31 -1
- package/src/adaptive.ts +295 -0
- package/src/devices.ts +70 -0
- package/src/diagnostics.ts +94 -0
- package/src/effects-core.ts +177 -0
- package/src/effects-gl.ts +384 -0
- package/src/fallback.ts +169 -0
- package/src/health.ts +127 -0
- package/src/index.ts +1364 -81
- package/src/link.ts +255 -0
- package/src/noise-suppression.ts +135 -0
- package/src/preflight.ts +191 -0
- package/src/processors.ts +35 -0
- package/src/speakers.ts +66 -0
- package/src/video-effects.ts +552 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/preflight.ts"],"names":[],"mappings":";;;AA0EA,wCAgBC;AAGD,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AAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;QACxD,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC,IAAI,MAAM;YAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,IAAI,KAAK;YAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Track processors (docs/implementation-progress/RTC_PERF_PROGRESS.md P3-4, P3-5): the published microphone or
|
|
3
|
+
* camera sent through something that changes it first -- noise suppression, a blurred or replaced background, beauty.
|
|
4
|
+
* LiveKit (`setProcessor`: Krisp, background blur), Agora and TRTC (extensions and plugins) do it the same way: the
|
|
5
|
+
* device's track goes in, a processed track goes out and is published in its place; the device's own track stays the
|
|
6
|
+
* one watched for unplugging, given new constraints and released at the end.
|
|
7
|
+
*/
|
|
8
|
+
/** Something the microphone passes through before it is sent. */
|
|
9
|
+
export interface AudioTrackProcessor {
|
|
10
|
+
/** A short name, for diagnostics. */
|
|
11
|
+
readonly name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Process `track` and return the track to send. Called again whenever the microphone's track changes (another
|
|
14
|
+
* device, a reconnect): the processor then lets go of what it made for the previous one.
|
|
15
|
+
*/
|
|
16
|
+
process(track: MediaStreamTrack): Promise<MediaStreamTrack>;
|
|
17
|
+
/** Let go of everything (the processor was removed, or the session ended). */
|
|
18
|
+
destroy(): Promise<void> | void;
|
|
19
|
+
}
|
|
20
|
+
/** Something the camera passes through before it is sent (and shown in `client.local`). */
|
|
21
|
+
export interface VideoTrackProcessor {
|
|
22
|
+
/** A short name, for diagnostics. */
|
|
23
|
+
readonly name: string;
|
|
24
|
+
/**
|
|
25
|
+
* Process `track` and return the track to send, at the same size and frame rate. Called again when the camera's
|
|
26
|
+
* track changes (another camera, `replaceVideoTrack`): the processor then lets go of what it made for the previous
|
|
27
|
+
* one. A picture the SDK no longer sends is stopped by the SDK; stop drawing it once its `readyState` is 'ended',
|
|
28
|
+
* and skip the work while it is switched off (`enabled` false: the camera is paused).
|
|
29
|
+
*/
|
|
30
|
+
process(track: MediaStreamTrack): Promise<MediaStreamTrack>;
|
|
31
|
+
/** Let go of everything (the processor was removed, or the session ended). */
|
|
32
|
+
destroy(): Promise<void> | void;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=processors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processors.d.ts","sourceRoot":"","sources":["../../src/processors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iEAAiE;AACjE,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5D,8EAA8E;IAC9E,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACjC;AAED,2FAA2F;AAC3F,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5D,8EAA8E;IAC9E,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACjC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Track processors (docs/implementation-progress/RTC_PERF_PROGRESS.md P3-4, P3-5): the published microphone or
|
|
4
|
+
* camera sent through something that changes it first -- noise suppression, a blurred or replaced background, beauty.
|
|
5
|
+
* LiveKit (`setProcessor`: Krisp, background blur), Agora and TRTC (extensions and plugins) do it the same way: the
|
|
6
|
+
* device's track goes in, a processed track goes out and is published in its place; the device's own track stays the
|
|
7
|
+
* one watched for unplugging, given new constraints and released at the end.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=processors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processors.js","sourceRoot":"","sources":["../../src/processors.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audio levels and active speakers (docs/implementation-progress/RTC_PERF_PROGRESS.md J1).
|
|
3
|
+
*
|
|
4
|
+
* - Agora `volume-indicator` and Tencent TRTC `AUDIO_VOLUME` report every participant's volume on an interval.
|
|
5
|
+
* - Amazon Chime's `DefaultActiveSpeakerPolicy` (read from its code) ranks speakers: a volume above a silence
|
|
6
|
+
* threshold counts as speaking (1, else 0); each sample the speaker's score becomes `score × 0.9 + speaking × 0.1`,
|
|
7
|
+
* and everyone else's drops by `0.2 × speaking` (the takeover); scores under 0.01 are 0. Its detector updates every
|
|
8
|
+
* 200 ms. Sampled together here, so two people speaking at once both stay; the takeover applies to the silent.
|
|
9
|
+
* - LiveKit's server counts a participant as speaking above -35 dBov.
|
|
10
|
+
*
|
|
11
|
+
* Levels are WebRTC's `audioLevel`: linear, 0 = silence, 1 = 0 dBov. -35 dBov is 10^(-35/20) ≈ 0.0178.
|
|
12
|
+
* Pure: the ranking takes levels and gives the order.
|
|
13
|
+
*/
|
|
14
|
+
/** Above this level a participant is speaking (LiveKit's -35 dBov). */
|
|
15
|
+
export declare const SPEAKING_LEVEL = 0.0178;
|
|
16
|
+
/** How often levels are read while someone listens (Chime's detector: 200 ms). */
|
|
17
|
+
export declare const AUDIO_LEVEL_INTERVAL_MS = 250;
|
|
18
|
+
export declare const SPEAKER_WEIGHT = 0.9;
|
|
19
|
+
export declare const TAKEOVER_RATE = 0.2;
|
|
20
|
+
export declare const SCORE_CUTOFF = 0.01;
|
|
21
|
+
/** Chime's active speaker ranking: who has been speaking recently, the most recent and steady first. */
|
|
22
|
+
export declare class ActiveSpeakers {
|
|
23
|
+
private readonly scores;
|
|
24
|
+
private last;
|
|
25
|
+
/**
|
|
26
|
+
* One sample: each identity's loudest level now (0..1). Identities missing from it count as silent. Returns the new
|
|
27
|
+
* order when it changed, else null.
|
|
28
|
+
*/
|
|
29
|
+
update(levels: ReadonlyMap<string, number>): string[] | null;
|
|
30
|
+
/** Someone left: forget them. Returns the new order when it changed. */
|
|
31
|
+
remove(identity: string): string[] | null;
|
|
32
|
+
reset(): void;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=speakers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speakers.d.ts","sourceRoot":"","sources":["../../src/speakers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,uEAAuE;AACvE,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,wGAAwG;AACxG,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IACpD,OAAO,CAAC,IAAI,CAAgB;IAE5B;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,GAAG,IAAI;IAoB5D,wEAAwE;IACxE,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAQzC,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Audio levels and active speakers (docs/implementation-progress/RTC_PERF_PROGRESS.md J1).
|
|
4
|
+
*
|
|
5
|
+
* - Agora `volume-indicator` and Tencent TRTC `AUDIO_VOLUME` report every participant's volume on an interval.
|
|
6
|
+
* - Amazon Chime's `DefaultActiveSpeakerPolicy` (read from its code) ranks speakers: a volume above a silence
|
|
7
|
+
* threshold counts as speaking (1, else 0); each sample the speaker's score becomes `score × 0.9 + speaking × 0.1`,
|
|
8
|
+
* and everyone else's drops by `0.2 × speaking` (the takeover); scores under 0.01 are 0. Its detector updates every
|
|
9
|
+
* 200 ms. Sampled together here, so two people speaking at once both stay; the takeover applies to the silent.
|
|
10
|
+
* - LiveKit's server counts a participant as speaking above -35 dBov.
|
|
11
|
+
*
|
|
12
|
+
* Levels are WebRTC's `audioLevel`: linear, 0 = silence, 1 = 0 dBov. -35 dBov is 10^(-35/20) ≈ 0.0178.
|
|
13
|
+
* Pure: the ranking takes levels and gives the order.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.ActiveSpeakers = exports.SCORE_CUTOFF = exports.TAKEOVER_RATE = exports.SPEAKER_WEIGHT = exports.AUDIO_LEVEL_INTERVAL_MS = exports.SPEAKING_LEVEL = void 0;
|
|
17
|
+
/** Above this level a participant is speaking (LiveKit's -35 dBov). */
|
|
18
|
+
exports.SPEAKING_LEVEL = 0.0178;
|
|
19
|
+
/** How often levels are read while someone listens (Chime's detector: 200 ms). */
|
|
20
|
+
exports.AUDIO_LEVEL_INTERVAL_MS = 250;
|
|
21
|
+
exports.SPEAKER_WEIGHT = 0.9;
|
|
22
|
+
exports.TAKEOVER_RATE = 0.2;
|
|
23
|
+
exports.SCORE_CUTOFF = 0.01;
|
|
24
|
+
/** Chime's active speaker ranking: who has been speaking recently, the most recent and steady first. */
|
|
25
|
+
class ActiveSpeakers {
|
|
26
|
+
scores = new Map();
|
|
27
|
+
last = [];
|
|
28
|
+
/**
|
|
29
|
+
* One sample: each identity's loudest level now (0..1). Identities missing from it count as silent. Returns the new
|
|
30
|
+
* order when it changed, else null.
|
|
31
|
+
*/
|
|
32
|
+
update(levels) {
|
|
33
|
+
for (const id of levels.keys())
|
|
34
|
+
if (!this.scores.has(id))
|
|
35
|
+
this.scores.set(id, 0);
|
|
36
|
+
// Chime updates one attendee at a time as volumes arrive; here everyone is sampled together, so people speaking
|
|
37
|
+
// at the same moment do not take over from each other -- only the silent ones lose ground.
|
|
38
|
+
const speakingNow = new Set([...levels].filter(([, level]) => level > exports.SPEAKING_LEVEL).map(([id]) => id));
|
|
39
|
+
for (const id of this.scores.keys()) {
|
|
40
|
+
const speaking = speakingNow.has(id) ? 1 : 0;
|
|
41
|
+
let score = (this.scores.get(id) ?? 0) * exports.SPEAKER_WEIGHT + speaking * (1 - exports.SPEAKER_WEIGHT);
|
|
42
|
+
if (!speaking && speakingNow.size > 0)
|
|
43
|
+
score = Math.max(score - exports.TAKEOVER_RATE, 0);
|
|
44
|
+
this.scores.set(id, score);
|
|
45
|
+
}
|
|
46
|
+
const order = [...this.scores.entries()]
|
|
47
|
+
.filter(([, score]) => score >= exports.SCORE_CUTOFF)
|
|
48
|
+
.sort((a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1))
|
|
49
|
+
.map(([id]) => id);
|
|
50
|
+
if (order.length === this.last.length && order.every((id, i) => id === this.last[i]))
|
|
51
|
+
return null;
|
|
52
|
+
this.last = order;
|
|
53
|
+
return order;
|
|
54
|
+
}
|
|
55
|
+
/** Someone left: forget them. Returns the new order when it changed. */
|
|
56
|
+
remove(identity) {
|
|
57
|
+
if (!this.scores.delete(identity))
|
|
58
|
+
return null;
|
|
59
|
+
const order = this.last.filter((id) => id !== identity);
|
|
60
|
+
if (order.length === this.last.length)
|
|
61
|
+
return null;
|
|
62
|
+
this.last = order;
|
|
63
|
+
return order;
|
|
64
|
+
}
|
|
65
|
+
reset() {
|
|
66
|
+
this.scores.clear();
|
|
67
|
+
this.last = [];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.ActiveSpeakers = ActiveSpeakers;
|
|
71
|
+
//# sourceMappingURL=speakers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speakers.js","sourceRoot":"","sources":["../../src/speakers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,uEAAuE;AAC1D,QAAA,cAAc,GAAG,MAAM,CAAC;AACrC,kFAAkF;AACrE,QAAA,uBAAuB,GAAG,GAAG,CAAC;AAE9B,QAAA,cAAc,GAAG,GAAG,CAAC;AACrB,QAAA,aAAa,GAAG,GAAG,CAAC;AACpB,QAAA,YAAY,GAAG,IAAI,CAAC;AAEjC,wGAAwG;AACxG,MAAa,cAAc;IACR,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,IAAI,GAAa,EAAE,CAAC;IAE5B;;;OAGG;IACH,MAAM,CAAC,MAAmC;QACxC,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;gBAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACjF,gHAAgH;QAChH,2FAA2F;QAC3F,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,sBAAc,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACzG,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,MAAM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AC;YAAE,OAAO,IAAI,CAAC;QAClG,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,wEAAwE;IACxE,MAAM,CAAC,QAAgB;QACrB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;YAAE,OAAO,IAAI,CAAC;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;QACxD,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACjB,CAAC;CACF;AAzCD,wCAyCC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Virtual background and beauty for the camera (docs/implementation-progress/RTC_PERF_PROGRESS.md P3-5): a blurred or
|
|
3
|
+
* replaced background and skin smoothing, as LiveKit's track processors, Agora's and ZEGOCLOUD's virtual background and
|
|
4
|
+
* beauty extensions, and Tencent TRTC's video effect plugin do -- in the browser, on the GPU.
|
|
5
|
+
*
|
|
6
|
+
* Imported on its own (`@voltkit-rtc/client/video-effects`), so an app that does not use it never ships it:
|
|
7
|
+
*
|
|
8
|
+
* import { createVideoEffects } from '@voltkit-rtc/client/video-effects';
|
|
9
|
+
* const effects = createVideoEffects({ background: 'blur', beauty: true });
|
|
10
|
+
* await client.setVideoProcessor(effects);
|
|
11
|
+
* await effects.update({ background: { image: '/office.jpg' } }); // live, no pause for viewers
|
|
12
|
+
*
|
|
13
|
+
* Finding the person takes Google's MediaPipe selfie segmenter: install `@mediapipe/tasks-vision@0.10.35` next to the
|
|
14
|
+
* SDK (an optional peer dependency, 0.10.35 exactly -- later versions report usage to Google). Its wasm (3 MB
|
|
15
|
+
* compressed) and the model (250 kB) load the first time a background effect is used: the wasm from jsDelivr at that
|
|
16
|
+
* version and the model from Google, unless you serve them yourself (`wasmPath`, `modelUrl`). Beauty alone needs none
|
|
17
|
+
* of it.
|
|
18
|
+
*
|
|
19
|
+
* Chrome and Edge process each camera frame as it arrives (insertable streams: smooth, and it keeps going in a
|
|
20
|
+
* background tab). Firefox and Safari draw from a hidden video on a worker's timer into a captured canvas -- what
|
|
21
|
+
* LiveKit, Twilio and Amazon Chime fall back to -- which a background tab can slow down.
|
|
22
|
+
*/
|
|
23
|
+
import { type BackgroundSetting, type BeautyOptions, type BeautySettings } from './effects-core.js';
|
|
24
|
+
import type { VideoTrackProcessor } from './processors.js';
|
|
25
|
+
export type { BackgroundImageSource, BackgroundSetting, BeautyOptions, BeautySettings } from './effects-core.js';
|
|
26
|
+
/** The `@mediapipe/tasks-vision` version this SDK was tested with; the default wasm URL points at it. */
|
|
27
|
+
export declare const MEDIAPIPE_VERSION = "0.10.35";
|
|
28
|
+
/** Google's selfie segmenter for portrait and square pictures (phones), at a fixed version. */
|
|
29
|
+
export declare const DEFAULT_SEGMENTER_MODEL = "https://storage.googleapis.com/mediapipe-models/image_segmenter/selfie_segmenter/float16/1/selfie_segmenter.tflite";
|
|
30
|
+
/**
|
|
31
|
+
* Its landscape version, for wide pictures (webcams): fed a 16:9 frame, the square model leaves patches of the room
|
|
32
|
+
* beside the head, the landscape one traces it cleanly (as LiveKit, Twilio, Chime and TRTC use for webcams).
|
|
33
|
+
*/
|
|
34
|
+
export declare const DEFAULT_LANDSCAPE_MODEL = "https://storage.googleapis.com/mediapipe-models/image_segmenter/selfie_segmenter_landscape/float16/1/selfie_segmenter_landscape.tflite";
|
|
35
|
+
export interface VideoEffectsOptions {
|
|
36
|
+
/** `'none'` (default), `'blur'`, or `{ image }`: a URL, Blob, image, canvas or ImageBitmap, fitted to cover. */
|
|
37
|
+
background?: BackgroundSetting;
|
|
38
|
+
/** Blur strength, 1 (light) to 10 (strong). Default 5. */
|
|
39
|
+
blur?: number;
|
|
40
|
+
/** Beauty: `true` for the defaults, or each of `smooth`, `brighten`, `redness`, `sharpen` (0-1). Off by default. */
|
|
41
|
+
beauty?: BeautyOptions | boolean | null;
|
|
42
|
+
/** A folder serving `vision_wasm_internal.{js,wasm}` and `vision_wasm_nosimd_internal.{js,wasm}` (from
|
|
43
|
+
* `node_modules/@mediapipe/tasks-vision/wasm`). Default: jsDelivr at MEDIAPIPE_VERSION. */
|
|
44
|
+
wasmPath?: string;
|
|
45
|
+
/** Where the segmentation model is served, for every picture. Default: DEFAULT_LANDSCAPE_MODEL for wide pictures,
|
|
46
|
+
* DEFAULT_SEGMENTER_MODEL for portrait and square ones. */
|
|
47
|
+
modelUrl?: string;
|
|
48
|
+
/** The most frames a second to process; the camera's rate by default. */
|
|
49
|
+
maxFrameRate?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Told when this device cannot keep up even finding the person only every few frames (Agora's `onoverload`): turn
|
|
52
|
+
* the background off, or lower the camera's frame rate or size. Told again with `false` when it can.
|
|
53
|
+
*/
|
|
54
|
+
onOverload?: (overloaded: boolean) => void;
|
|
55
|
+
}
|
|
56
|
+
/** What `update` can change while the effects run. */
|
|
57
|
+
export type VideoEffectsUpdate = Pick<VideoEffectsOptions, 'background' | 'blur' | 'beauty'>;
|
|
58
|
+
export interface VideoEffects extends VideoTrackProcessor {
|
|
59
|
+
/**
|
|
60
|
+
* Change the effects while they run: no new camera, no pause for viewers. Resolves once the change shows; a picture
|
|
61
|
+
* that cannot be loaded, or a segmenter that cannot start, rejects and leaves the effects as they were.
|
|
62
|
+
*/
|
|
63
|
+
update(changes: VideoEffectsUpdate): Promise<void>;
|
|
64
|
+
/** The effects in force now. */
|
|
65
|
+
readonly settings: {
|
|
66
|
+
background: 'none' | 'blur' | 'image';
|
|
67
|
+
blur: number;
|
|
68
|
+
beauty: BeautySettings | null;
|
|
69
|
+
};
|
|
70
|
+
/** How hard the device works: the person is found every `segmentEvery` frames, in `segmentMs` on average. */
|
|
71
|
+
readonly stats: {
|
|
72
|
+
segmentEvery: number;
|
|
73
|
+
segmentMs: number;
|
|
74
|
+
overloaded: boolean;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** What finds the person: MediaPipe's ImageSegmenter, or a stand-in in tests. */
|
|
78
|
+
export interface PersonSegmenter {
|
|
79
|
+
/** Find the person in `input`; `use` gets the confidence (0-1) of each pixel being the person, at `input`'s size. */
|
|
80
|
+
segment(input: TexImageSource, timestampMs: number, use: (confidence: Float32Array) => void): void;
|
|
81
|
+
close(): void;
|
|
82
|
+
}
|
|
83
|
+
/** Stood in for by tests. */
|
|
84
|
+
export interface VideoEffectsDeps {
|
|
85
|
+
loadSegmenter(wasmPath: string, modelUrl: string): Promise<PersonSegmenter>;
|
|
86
|
+
/** How frames are taken and given back; chosen from the browser's features when absent. */
|
|
87
|
+
pump?: 'insertable' | 'canvas';
|
|
88
|
+
}
|
|
89
|
+
/** Whether this browser can run the effects (WebGL2, and a way to take and give back frames). */
|
|
90
|
+
export declare function isVideoEffectsSupported(): boolean;
|
|
91
|
+
/** Virtual background and beauty, for `client.setVideoProcessor()`. */
|
|
92
|
+
export declare function createVideoEffects(options?: VideoEffectsOptions, stand?: Partial<VideoEffectsDeps>): VideoEffects;
|
|
93
|
+
//# sourceMappingURL=video-effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-effects.d.ts","sourceRoot":"","sources":["../../src/video-effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAWL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,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