@stream-io/video-client 0.7.7 → 0.7.8
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 +7 -0
- package/dist/index.browser.es.js +358 -4
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +359 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +358 -4
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +12 -0
- package/dist/src/StreamSfuClient.d.ts +2 -0
- package/dist/src/devices/InputMediaDeviceManager.d.ts +1 -1
- package/dist/src/devices/MicrophoneManager.d.ts +17 -0
- package/dist/src/gen/coordinator/index.d.ts +96 -34
- package/dist/src/gen/video/sfu/signal_rpc/signal.client.d.ts +17 -1
- package/dist/src/gen/video/sfu/signal_rpc/signal.d.ts +76 -0
- package/package.json +6 -5
- package/src/Call.ts +22 -0
- package/src/StreamSfuClient.ts +20 -0
- package/src/devices/InputMediaDeviceManager.ts +2 -1
- package/src/devices/MicrophoneManager.ts +123 -1
- package/src/devices/__tests__/MicrophoneManager.test.ts +121 -4
- package/src/devices/__tests__/MicrophoneManagerRN.test.ts +24 -0
- package/src/devices/__tests__/mocks.ts +17 -1
- package/src/gen/coordinator/index.ts +102 -49
- package/src/gen/google/protobuf/struct.ts +1 -1
- package/src/gen/google/protobuf/timestamp.ts +1 -1
- package/src/gen/video/sfu/event/events.ts +1 -1
- package/src/gen/video/sfu/models/models.ts +1 -1
- package/src/gen/video/sfu/signal_rpc/signal.client.ts +47 -1
- package/src/gen/video/sfu/signal_rpc/signal.ts +369 -1
- package/src/helpers/sound-detector.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.7.8](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.7.7...@stream-io/video-client-0.7.8) (2024-04-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* Noise Cancellation ([#1321](https://github.com/GetStream/stream-video-js/issues/1321)) ([9144385](https://github.com/GetStream/stream-video-js/commit/91443852986ad7453d82efb900626266d8df0e96))
|
|
11
|
+
|
|
5
12
|
### [0.7.7](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.7.6...@stream-io/video-client-0.7.7) (2024-04-23)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.browser.es.js
CHANGED
|
@@ -33,6 +33,22 @@ const CreateDeviceRequestPushProviderEnum = {
|
|
|
33
33
|
HUAWEI: 'huawei',
|
|
34
34
|
XIAOMI: 'xiaomi',
|
|
35
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* @export
|
|
38
|
+
*/
|
|
39
|
+
const NoiseCancellationSettingsModeEnum = {
|
|
40
|
+
AVAILABLE: 'available',
|
|
41
|
+
DISABLED: 'disabled',
|
|
42
|
+
AUTO_ON: 'auto-on',
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* @export
|
|
46
|
+
*/
|
|
47
|
+
const NoiseCancellationSettingsRequestModeEnum = {
|
|
48
|
+
AVAILABLE: 'available',
|
|
49
|
+
DISABLED: 'disabled',
|
|
50
|
+
AUTO_ON: 'auto-on',
|
|
51
|
+
};
|
|
36
52
|
/**
|
|
37
53
|
* All possibility of string to use
|
|
38
54
|
* @export
|
|
@@ -41,6 +57,7 @@ const OwnCapability = {
|
|
|
41
57
|
BLOCK_USERS: 'block-users',
|
|
42
58
|
CREATE_CALL: 'create-call',
|
|
43
59
|
CREATE_REACTION: 'create-reaction',
|
|
60
|
+
ENABLE_NOISE_CANCELLATION: 'enable-noise-cancellation',
|
|
44
61
|
END_CALL: 'end-call',
|
|
45
62
|
JOIN_BACKSTAGE: 'join-backstage',
|
|
46
63
|
JOIN_CALL: 'join-call',
|
|
@@ -2422,10 +2439,196 @@ var models = /*#__PURE__*/Object.freeze({
|
|
|
2422
2439
|
});
|
|
2423
2440
|
|
|
2424
2441
|
/* eslint-disable */
|
|
2425
|
-
// @generated by protobuf-ts 2.9.
|
|
2442
|
+
// @generated by protobuf-ts 2.9.4 with parameter long_type_string,client_generic,server_none,eslint_disable
|
|
2426
2443
|
// @generated from protobuf file "video/sfu/signal_rpc/signal.proto" (package "stream.video.sfu.signal", syntax proto3)
|
|
2427
2444
|
// tslint:disable
|
|
2428
2445
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
2446
|
+
class StartNoiseCancellationRequest$Type extends MessageType {
|
|
2447
|
+
constructor() {
|
|
2448
|
+
super('stream.video.sfu.signal.StartNoiseCancellationRequest', [
|
|
2449
|
+
{ no: 1, name: 'session_id', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
|
|
2450
|
+
]);
|
|
2451
|
+
}
|
|
2452
|
+
create(value) {
|
|
2453
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
2454
|
+
message.sessionId = '';
|
|
2455
|
+
if (value !== undefined)
|
|
2456
|
+
reflectionMergePartial(this, message, value);
|
|
2457
|
+
return message;
|
|
2458
|
+
}
|
|
2459
|
+
internalBinaryRead(reader, length, options, target) {
|
|
2460
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2461
|
+
while (reader.pos < end) {
|
|
2462
|
+
let [fieldNo, wireType] = reader.tag();
|
|
2463
|
+
switch (fieldNo) {
|
|
2464
|
+
case /* string session_id */ 1:
|
|
2465
|
+
message.sessionId = reader.string();
|
|
2466
|
+
break;
|
|
2467
|
+
default:
|
|
2468
|
+
let u = options.readUnknownField;
|
|
2469
|
+
if (u === 'throw')
|
|
2470
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2471
|
+
let d = reader.skip(wireType);
|
|
2472
|
+
if (u !== false)
|
|
2473
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
return message;
|
|
2477
|
+
}
|
|
2478
|
+
internalBinaryWrite(message, writer, options) {
|
|
2479
|
+
/* string session_id = 1; */
|
|
2480
|
+
if (message.sessionId !== '')
|
|
2481
|
+
writer.tag(1, WireType.LengthDelimited).string(message.sessionId);
|
|
2482
|
+
let u = options.writeUnknownFields;
|
|
2483
|
+
if (u !== false)
|
|
2484
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2485
|
+
return writer;
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
/**
|
|
2489
|
+
* @generated MessageType for protobuf message stream.video.sfu.signal.StartNoiseCancellationRequest
|
|
2490
|
+
*/
|
|
2491
|
+
const StartNoiseCancellationRequest = new StartNoiseCancellationRequest$Type();
|
|
2492
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
2493
|
+
class StartNoiseCancellationResponse$Type extends MessageType {
|
|
2494
|
+
constructor() {
|
|
2495
|
+
super('stream.video.sfu.signal.StartNoiseCancellationResponse', [
|
|
2496
|
+
{ no: 1, name: 'error', kind: 'message', T: () => Error$2 },
|
|
2497
|
+
]);
|
|
2498
|
+
}
|
|
2499
|
+
create(value) {
|
|
2500
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
2501
|
+
if (value !== undefined)
|
|
2502
|
+
reflectionMergePartial(this, message, value);
|
|
2503
|
+
return message;
|
|
2504
|
+
}
|
|
2505
|
+
internalBinaryRead(reader, length, options, target) {
|
|
2506
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2507
|
+
while (reader.pos < end) {
|
|
2508
|
+
let [fieldNo, wireType] = reader.tag();
|
|
2509
|
+
switch (fieldNo) {
|
|
2510
|
+
case /* stream.video.sfu.models.Error error */ 1:
|
|
2511
|
+
message.error = Error$2.internalBinaryRead(reader, reader.uint32(), options, message.error);
|
|
2512
|
+
break;
|
|
2513
|
+
default:
|
|
2514
|
+
let u = options.readUnknownField;
|
|
2515
|
+
if (u === 'throw')
|
|
2516
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2517
|
+
let d = reader.skip(wireType);
|
|
2518
|
+
if (u !== false)
|
|
2519
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
return message;
|
|
2523
|
+
}
|
|
2524
|
+
internalBinaryWrite(message, writer, options) {
|
|
2525
|
+
/* stream.video.sfu.models.Error error = 1; */
|
|
2526
|
+
if (message.error)
|
|
2527
|
+
Error$2.internalBinaryWrite(message.error, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
2528
|
+
let u = options.writeUnknownFields;
|
|
2529
|
+
if (u !== false)
|
|
2530
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2531
|
+
return writer;
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
/**
|
|
2535
|
+
* @generated MessageType for protobuf message stream.video.sfu.signal.StartNoiseCancellationResponse
|
|
2536
|
+
*/
|
|
2537
|
+
const StartNoiseCancellationResponse = new StartNoiseCancellationResponse$Type();
|
|
2538
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
2539
|
+
class StopNoiseCancellationRequest$Type extends MessageType {
|
|
2540
|
+
constructor() {
|
|
2541
|
+
super('stream.video.sfu.signal.StopNoiseCancellationRequest', [
|
|
2542
|
+
{ no: 1, name: 'session_id', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
|
|
2543
|
+
]);
|
|
2544
|
+
}
|
|
2545
|
+
create(value) {
|
|
2546
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
2547
|
+
message.sessionId = '';
|
|
2548
|
+
if (value !== undefined)
|
|
2549
|
+
reflectionMergePartial(this, message, value);
|
|
2550
|
+
return message;
|
|
2551
|
+
}
|
|
2552
|
+
internalBinaryRead(reader, length, options, target) {
|
|
2553
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2554
|
+
while (reader.pos < end) {
|
|
2555
|
+
let [fieldNo, wireType] = reader.tag();
|
|
2556
|
+
switch (fieldNo) {
|
|
2557
|
+
case /* string session_id */ 1:
|
|
2558
|
+
message.sessionId = reader.string();
|
|
2559
|
+
break;
|
|
2560
|
+
default:
|
|
2561
|
+
let u = options.readUnknownField;
|
|
2562
|
+
if (u === 'throw')
|
|
2563
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2564
|
+
let d = reader.skip(wireType);
|
|
2565
|
+
if (u !== false)
|
|
2566
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
return message;
|
|
2570
|
+
}
|
|
2571
|
+
internalBinaryWrite(message, writer, options) {
|
|
2572
|
+
/* string session_id = 1; */
|
|
2573
|
+
if (message.sessionId !== '')
|
|
2574
|
+
writer.tag(1, WireType.LengthDelimited).string(message.sessionId);
|
|
2575
|
+
let u = options.writeUnknownFields;
|
|
2576
|
+
if (u !== false)
|
|
2577
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2578
|
+
return writer;
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
/**
|
|
2582
|
+
* @generated MessageType for protobuf message stream.video.sfu.signal.StopNoiseCancellationRequest
|
|
2583
|
+
*/
|
|
2584
|
+
const StopNoiseCancellationRequest = new StopNoiseCancellationRequest$Type();
|
|
2585
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
2586
|
+
class StopNoiseCancellationResponse$Type extends MessageType {
|
|
2587
|
+
constructor() {
|
|
2588
|
+
super('stream.video.sfu.signal.StopNoiseCancellationResponse', [
|
|
2589
|
+
{ no: 1, name: 'error', kind: 'message', T: () => Error$2 },
|
|
2590
|
+
]);
|
|
2591
|
+
}
|
|
2592
|
+
create(value) {
|
|
2593
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
2594
|
+
if (value !== undefined)
|
|
2595
|
+
reflectionMergePartial(this, message, value);
|
|
2596
|
+
return message;
|
|
2597
|
+
}
|
|
2598
|
+
internalBinaryRead(reader, length, options, target) {
|
|
2599
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2600
|
+
while (reader.pos < end) {
|
|
2601
|
+
let [fieldNo, wireType] = reader.tag();
|
|
2602
|
+
switch (fieldNo) {
|
|
2603
|
+
case /* stream.video.sfu.models.Error error */ 1:
|
|
2604
|
+
message.error = Error$2.internalBinaryRead(reader, reader.uint32(), options, message.error);
|
|
2605
|
+
break;
|
|
2606
|
+
default:
|
|
2607
|
+
let u = options.readUnknownField;
|
|
2608
|
+
if (u === 'throw')
|
|
2609
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2610
|
+
let d = reader.skip(wireType);
|
|
2611
|
+
if (u !== false)
|
|
2612
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
return message;
|
|
2616
|
+
}
|
|
2617
|
+
internalBinaryWrite(message, writer, options) {
|
|
2618
|
+
/* stream.video.sfu.models.Error error = 1; */
|
|
2619
|
+
if (message.error)
|
|
2620
|
+
Error$2.internalBinaryWrite(message.error, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
2621
|
+
let u = options.writeUnknownFields;
|
|
2622
|
+
if (u !== false)
|
|
2623
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2624
|
+
return writer;
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
/**
|
|
2628
|
+
* @generated MessageType for protobuf message stream.video.sfu.signal.StopNoiseCancellationResponse
|
|
2629
|
+
*/
|
|
2630
|
+
const StopNoiseCancellationResponse = new StopNoiseCancellationResponse$Type();
|
|
2631
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
2429
2632
|
class SendStatsRequest$Type extends MessageType {
|
|
2430
2633
|
constructor() {
|
|
2431
2634
|
super('stream.video.sfu.signal.SendStatsRequest', [
|
|
@@ -3475,6 +3678,18 @@ const SignalServer = new ServiceType('stream.video.sfu.signal.SignalServer', [
|
|
|
3475
3678
|
I: SendStatsRequest,
|
|
3476
3679
|
O: SendStatsResponse,
|
|
3477
3680
|
},
|
|
3681
|
+
{
|
|
3682
|
+
name: 'StartNoiseCancellation',
|
|
3683
|
+
options: {},
|
|
3684
|
+
I: StartNoiseCancellationRequest,
|
|
3685
|
+
O: StartNoiseCancellationResponse,
|
|
3686
|
+
},
|
|
3687
|
+
{
|
|
3688
|
+
name: 'StopNoiseCancellation',
|
|
3689
|
+
options: {},
|
|
3690
|
+
I: StopNoiseCancellationRequest,
|
|
3691
|
+
O: StopNoiseCancellationResponse,
|
|
3692
|
+
},
|
|
3478
3693
|
]);
|
|
3479
3694
|
|
|
3480
3695
|
/**
|
|
@@ -5777,6 +5992,20 @@ class SignalServerClient {
|
|
|
5777
5992
|
const method = this.methods[6], opt = this._transport.mergeOptions(options);
|
|
5778
5993
|
return stackIntercept('unary', this._transport, method, opt, input);
|
|
5779
5994
|
}
|
|
5995
|
+
/**
|
|
5996
|
+
* @generated from protobuf rpc: StartNoiseCancellation(stream.video.sfu.signal.StartNoiseCancellationRequest) returns (stream.video.sfu.signal.StartNoiseCancellationResponse);
|
|
5997
|
+
*/
|
|
5998
|
+
startNoiseCancellation(input, options) {
|
|
5999
|
+
const method = this.methods[7], opt = this._transport.mergeOptions(options);
|
|
6000
|
+
return stackIntercept('unary', this._transport, method, opt, input);
|
|
6001
|
+
}
|
|
6002
|
+
/**
|
|
6003
|
+
* @generated from protobuf rpc: StopNoiseCancellation(stream.video.sfu.signal.StopNoiseCancellationRequest) returns (stream.video.sfu.signal.StopNoiseCancellationResponse);
|
|
6004
|
+
*/
|
|
6005
|
+
stopNoiseCancellation(input, options) {
|
|
6006
|
+
const method = this.methods[8], opt = this._transport.mergeOptions(options);
|
|
6007
|
+
return stackIntercept('unary', this._transport, method, opt, input);
|
|
6008
|
+
}
|
|
5780
6009
|
}
|
|
5781
6010
|
|
|
5782
6011
|
const defaultOptions = {
|
|
@@ -8674,6 +8903,16 @@ class StreamSfuClient {
|
|
|
8674
8903
|
sessionId: this.sessionId,
|
|
8675
8904
|
}), this.logger);
|
|
8676
8905
|
};
|
|
8906
|
+
this.startNoiseCancellation = async () => {
|
|
8907
|
+
return retryable(() => this.rpc.startNoiseCancellation({
|
|
8908
|
+
sessionId: this.sessionId,
|
|
8909
|
+
}), this.logger);
|
|
8910
|
+
};
|
|
8911
|
+
this.stopNoiseCancellation = async () => {
|
|
8912
|
+
return retryable(() => this.rpc.stopNoiseCancellation({
|
|
8913
|
+
sessionId: this.sessionId,
|
|
8914
|
+
}), this.logger);
|
|
8915
|
+
};
|
|
8677
8916
|
this.join = async (data) => {
|
|
8678
8917
|
const joinRequest = JoinRequest.create({
|
|
8679
8918
|
...data,
|
|
@@ -11006,7 +11245,9 @@ const createSoundDetector = (audioStream, onSoundDetectedStateChanged, options =
|
|
|
11006
11245
|
// clean-up the AudioContext elements
|
|
11007
11246
|
microphone.disconnect();
|
|
11008
11247
|
analyser.disconnect();
|
|
11009
|
-
|
|
11248
|
+
if (audioContext.state !== 'closed') {
|
|
11249
|
+
await audioContext.close();
|
|
11250
|
+
}
|
|
11010
11251
|
// stop the stream
|
|
11011
11252
|
if (destroyStreamOnStop) {
|
|
11012
11253
|
audioStream.getTracks().forEach((track) => {
|
|
@@ -11137,6 +11378,99 @@ class MicrophoneManager extends InputMediaDeviceManager {
|
|
|
11137
11378
|
await this.stopSpeakingWhileMutedDetection();
|
|
11138
11379
|
}
|
|
11139
11380
|
});
|
|
11381
|
+
this.subscriptions.push(createSubscription(this.call.state.callingState$, (callingState) => {
|
|
11382
|
+
// do nothing when noise filtering isn't turned on
|
|
11383
|
+
if (!this.noiseCancellationRegistration || !this.noiseCancellation)
|
|
11384
|
+
return;
|
|
11385
|
+
const autoOn = this.call.state.settings?.audio.noise_cancellation?.mode ===
|
|
11386
|
+
NoiseCancellationSettingsModeEnum.AUTO_ON;
|
|
11387
|
+
if (autoOn && callingState === CallingState.JOINED) {
|
|
11388
|
+
this.noiseCancellationRegistration
|
|
11389
|
+
.then(() => this.noiseCancellation?.enable())
|
|
11390
|
+
.catch((err) => {
|
|
11391
|
+
this.logger('warn', `Failed to enable noise cancellation`, err);
|
|
11392
|
+
return this.call.notifyNoiseCancellationStopped();
|
|
11393
|
+
});
|
|
11394
|
+
}
|
|
11395
|
+
else if (callingState === CallingState.LEFT) {
|
|
11396
|
+
this.noiseCancellationRegistration
|
|
11397
|
+
.then(() => this.noiseCancellation?.disable())
|
|
11398
|
+
.catch((err) => {
|
|
11399
|
+
this.logger('warn', `Failed to disable noise cancellation`, err);
|
|
11400
|
+
});
|
|
11401
|
+
}
|
|
11402
|
+
}));
|
|
11403
|
+
}
|
|
11404
|
+
/**
|
|
11405
|
+
* Enables noise cancellation for the microphone.
|
|
11406
|
+
*
|
|
11407
|
+
* Note: not supported in React Native.
|
|
11408
|
+
* @param noiseCancellation - a noise cancellation instance to use.
|
|
11409
|
+
*/
|
|
11410
|
+
async enableNoiseCancellation(noiseCancellation) {
|
|
11411
|
+
if (isReactNative()) {
|
|
11412
|
+
throw new Error('Noise cancellation is not supported in React Native');
|
|
11413
|
+
}
|
|
11414
|
+
const { ownCapabilities, settings } = this.call.state;
|
|
11415
|
+
const hasNoiseCancellationCapability = ownCapabilities.includes(OwnCapability.ENABLE_NOISE_CANCELLATION);
|
|
11416
|
+
if (!hasNoiseCancellationCapability) {
|
|
11417
|
+
throw new Error('Noise cancellation is not available.');
|
|
11418
|
+
}
|
|
11419
|
+
const noiseCancellationSettings = settings?.audio.noise_cancellation;
|
|
11420
|
+
if (!noiseCancellationSettings ||
|
|
11421
|
+
noiseCancellationSettings.mode ===
|
|
11422
|
+
NoiseCancellationSettingsModeEnum.DISABLED) {
|
|
11423
|
+
throw new Error('Noise cancellation is disabled for this call type.');
|
|
11424
|
+
}
|
|
11425
|
+
try {
|
|
11426
|
+
this.noiseCancellation = noiseCancellation;
|
|
11427
|
+
// listen for change events and notify the SFU
|
|
11428
|
+
this.noiseCancellationChangeUnsubscribe = this.noiseCancellation.on('change', (enabled) => {
|
|
11429
|
+
if (enabled) {
|
|
11430
|
+
this.call.notifyNoiseCancellationStarting().catch((err) => {
|
|
11431
|
+
this.logger('warn', `notifyNoiseCancellationStart failed`, err);
|
|
11432
|
+
});
|
|
11433
|
+
}
|
|
11434
|
+
else {
|
|
11435
|
+
this.call.notifyNoiseCancellationStopped().catch((err) => {
|
|
11436
|
+
this.logger('warn', `notifyNoiseCancellationStop failed`, err);
|
|
11437
|
+
});
|
|
11438
|
+
}
|
|
11439
|
+
});
|
|
11440
|
+
this.noiseCancellationRegistration = this.registerFilter(noiseCancellation.toFilter());
|
|
11441
|
+
await this.noiseCancellationRegistration;
|
|
11442
|
+
// handles an edge case where a noise cancellation is enabled after
|
|
11443
|
+
// the participant as joined the call -> we immediately enable NC
|
|
11444
|
+
if (noiseCancellationSettings.mode ===
|
|
11445
|
+
NoiseCancellationSettingsModeEnum.AUTO_ON &&
|
|
11446
|
+
this.call.state.callingState === CallingState.JOINED) {
|
|
11447
|
+
noiseCancellation.enable();
|
|
11448
|
+
}
|
|
11449
|
+
}
|
|
11450
|
+
catch (e) {
|
|
11451
|
+
this.logger('warn', 'Failed to enable noise cancellation', e);
|
|
11452
|
+
await this.disableNoiseCancellation().catch((err) => {
|
|
11453
|
+
this.logger('warn', 'Failed to disable noise cancellation', err);
|
|
11454
|
+
});
|
|
11455
|
+
}
|
|
11456
|
+
}
|
|
11457
|
+
/**
|
|
11458
|
+
* Disables noise cancellation for the microphone.
|
|
11459
|
+
*
|
|
11460
|
+
* Note: not supported in React Native.
|
|
11461
|
+
*/
|
|
11462
|
+
async disableNoiseCancellation() {
|
|
11463
|
+
if (isReactNative()) {
|
|
11464
|
+
throw new Error('Noise cancellation is not supported in React Native');
|
|
11465
|
+
}
|
|
11466
|
+
await this.noiseCancellationRegistration
|
|
11467
|
+
?.then((unregister) => unregister())
|
|
11468
|
+
.then(() => this.noiseCancellation?.disable())
|
|
11469
|
+
.then(() => this.noiseCancellationChangeUnsubscribe?.())
|
|
11470
|
+
.catch((err) => {
|
|
11471
|
+
this.logger('warn', 'Failed to unregister noise cancellation', err);
|
|
11472
|
+
});
|
|
11473
|
+
await this.call.notifyNoiseCancellationStopped();
|
|
11140
11474
|
}
|
|
11141
11475
|
getDevices() {
|
|
11142
11476
|
return getAudioDevices();
|
|
@@ -12163,6 +12497,26 @@ class Call {
|
|
|
12163
12497
|
this.logger('info', `stopPublish ${TrackType[trackType]}, stop tracks: ${stopTrack}`);
|
|
12164
12498
|
await this.publisher?.unpublishStream(trackType, stopTrack);
|
|
12165
12499
|
};
|
|
12500
|
+
/**
|
|
12501
|
+
* Notifies the SFU that a noise cancellation process has started.
|
|
12502
|
+
*
|
|
12503
|
+
* @internal
|
|
12504
|
+
*/
|
|
12505
|
+
this.notifyNoiseCancellationStarting = async () => {
|
|
12506
|
+
return this.sfuClient?.startNoiseCancellation().catch((err) => {
|
|
12507
|
+
this.logger('warn', 'Failed to notify start of noise cancellation', err);
|
|
12508
|
+
});
|
|
12509
|
+
};
|
|
12510
|
+
/**
|
|
12511
|
+
* Notifies the SFU that a noise cancellation process has stopped.
|
|
12512
|
+
*
|
|
12513
|
+
* @internal
|
|
12514
|
+
*/
|
|
12515
|
+
this.notifyNoiseCancellationStopped = async () => {
|
|
12516
|
+
return this.sfuClient?.stopNoiseCancellation().catch((err) => {
|
|
12517
|
+
this.logger('warn', 'Failed to notify stop of noise cancellation', err);
|
|
12518
|
+
});
|
|
12519
|
+
};
|
|
12166
12520
|
/**
|
|
12167
12521
|
* Update track subscription configuration for one or more participants.
|
|
12168
12522
|
* You have to create a subscription for each participant for all the different kinds of tracks you want to receive.
|
|
@@ -14482,7 +14836,7 @@ class StreamClient {
|
|
|
14482
14836
|
});
|
|
14483
14837
|
};
|
|
14484
14838
|
this.getUserAgent = () => {
|
|
14485
|
-
const version = "0.7.
|
|
14839
|
+
const version = "0.7.8" ;
|
|
14486
14840
|
return (this.userAgent ||
|
|
14487
14841
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
14488
14842
|
};
|
|
@@ -14958,5 +15312,5 @@ class StreamVideoClient {
|
|
|
14958
15312
|
}
|
|
14959
15313
|
}
|
|
14960
15314
|
|
|
14961
|
-
export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, MicrophoneManagerState, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, getWebRTCInfo, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, setWebRTCInfo, speakerLayoutSortPreset, speaking };
|
|
15315
|
+
export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, NoiseCancellationSettingsRequestModeEnum, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, getWebRTCInfo, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, setWebRTCInfo, speakerLayoutSortPreset, speaking };
|
|
14962
15316
|
//# sourceMappingURL=index.browser.es.js.map
|