@stream-io/video-client 0.7.7 → 0.7.9
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 +14 -0
- package/dist/index.browser.es.js +368 -8
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +369 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +368 -8
- 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/src/store/CallState.ts +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.7.9](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.7.8...@stream-io/video-client-0.7.9) (2024-04-26)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* update call state with transcription events ([ab933ae](https://github.com/GetStream/stream-video-js/commit/ab933aee820fae199935380c7bab6edc7790f0ca))
|
|
11
|
+
|
|
12
|
+
### [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)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* Noise Cancellation ([#1321](https://github.com/GetStream/stream-video-js/issues/1321)) ([9144385](https://github.com/GetStream/stream-video-js/commit/91443852986ad7453d82efb900626266d8df0e96))
|
|
18
|
+
|
|
5
19
|
### [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
20
|
|
|
7
21
|
|
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 = {
|
|
@@ -7050,13 +7279,11 @@ class CallState {
|
|
|
7050
7279
|
this.eventHandlers = {
|
|
7051
7280
|
// these events are not updating the call state:
|
|
7052
7281
|
'call.closed_caption': undefined,
|
|
7282
|
+
'call.deleted': undefined,
|
|
7053
7283
|
'call.permission_request': undefined,
|
|
7054
7284
|
'call.recording_failed': undefined,
|
|
7055
7285
|
'call.recording_ready': undefined,
|
|
7056
|
-
'call.transcription_started': undefined,
|
|
7057
|
-
'call.transcription_stopped': undefined,
|
|
7058
7286
|
'call.transcription_ready': undefined,
|
|
7059
|
-
'call.transcription_failed': undefined,
|
|
7060
7287
|
'call.user_muted': undefined,
|
|
7061
7288
|
'connection.error': undefined,
|
|
7062
7289
|
'connection.ok': undefined,
|
|
@@ -7092,9 +7319,17 @@ class CallState {
|
|
|
7092
7319
|
'call.session_participant_joined': this.updateFromSessionParticipantJoined,
|
|
7093
7320
|
'call.session_participant_left': this.updateFromSessionParticipantLeft,
|
|
7094
7321
|
'call.session_started': (e) => this.updateFromCallResponse(e.call),
|
|
7322
|
+
'call.transcription_started': () => {
|
|
7323
|
+
this.setCurrentValue(this.transcribingSubject, true);
|
|
7324
|
+
},
|
|
7325
|
+
'call.transcription_stopped': () => {
|
|
7326
|
+
this.setCurrentValue(this.transcribingSubject, false);
|
|
7327
|
+
},
|
|
7328
|
+
'call.transcription_failed': () => {
|
|
7329
|
+
this.setCurrentValue(this.transcribingSubject, false);
|
|
7330
|
+
},
|
|
7095
7331
|
'call.unblocked_user': this.unblockUser,
|
|
7096
7332
|
'call.updated': (e) => this.updateFromCallResponse(e.call),
|
|
7097
|
-
'call.deleted': undefined,
|
|
7098
7333
|
};
|
|
7099
7334
|
}
|
|
7100
7335
|
/**
|
|
@@ -8674,6 +8909,16 @@ class StreamSfuClient {
|
|
|
8674
8909
|
sessionId: this.sessionId,
|
|
8675
8910
|
}), this.logger);
|
|
8676
8911
|
};
|
|
8912
|
+
this.startNoiseCancellation = async () => {
|
|
8913
|
+
return retryable(() => this.rpc.startNoiseCancellation({
|
|
8914
|
+
sessionId: this.sessionId,
|
|
8915
|
+
}), this.logger);
|
|
8916
|
+
};
|
|
8917
|
+
this.stopNoiseCancellation = async () => {
|
|
8918
|
+
return retryable(() => this.rpc.stopNoiseCancellation({
|
|
8919
|
+
sessionId: this.sessionId,
|
|
8920
|
+
}), this.logger);
|
|
8921
|
+
};
|
|
8677
8922
|
this.join = async (data) => {
|
|
8678
8923
|
const joinRequest = JoinRequest.create({
|
|
8679
8924
|
...data,
|
|
@@ -11006,7 +11251,9 @@ const createSoundDetector = (audioStream, onSoundDetectedStateChanged, options =
|
|
|
11006
11251
|
// clean-up the AudioContext elements
|
|
11007
11252
|
microphone.disconnect();
|
|
11008
11253
|
analyser.disconnect();
|
|
11009
|
-
|
|
11254
|
+
if (audioContext.state !== 'closed') {
|
|
11255
|
+
await audioContext.close();
|
|
11256
|
+
}
|
|
11010
11257
|
// stop the stream
|
|
11011
11258
|
if (destroyStreamOnStop) {
|
|
11012
11259
|
audioStream.getTracks().forEach((track) => {
|
|
@@ -11137,6 +11384,99 @@ class MicrophoneManager extends InputMediaDeviceManager {
|
|
|
11137
11384
|
await this.stopSpeakingWhileMutedDetection();
|
|
11138
11385
|
}
|
|
11139
11386
|
});
|
|
11387
|
+
this.subscriptions.push(createSubscription(this.call.state.callingState$, (callingState) => {
|
|
11388
|
+
// do nothing when noise filtering isn't turned on
|
|
11389
|
+
if (!this.noiseCancellationRegistration || !this.noiseCancellation)
|
|
11390
|
+
return;
|
|
11391
|
+
const autoOn = this.call.state.settings?.audio.noise_cancellation?.mode ===
|
|
11392
|
+
NoiseCancellationSettingsModeEnum.AUTO_ON;
|
|
11393
|
+
if (autoOn && callingState === CallingState.JOINED) {
|
|
11394
|
+
this.noiseCancellationRegistration
|
|
11395
|
+
.then(() => this.noiseCancellation?.enable())
|
|
11396
|
+
.catch((err) => {
|
|
11397
|
+
this.logger('warn', `Failed to enable noise cancellation`, err);
|
|
11398
|
+
return this.call.notifyNoiseCancellationStopped();
|
|
11399
|
+
});
|
|
11400
|
+
}
|
|
11401
|
+
else if (callingState === CallingState.LEFT) {
|
|
11402
|
+
this.noiseCancellationRegistration
|
|
11403
|
+
.then(() => this.noiseCancellation?.disable())
|
|
11404
|
+
.catch((err) => {
|
|
11405
|
+
this.logger('warn', `Failed to disable noise cancellation`, err);
|
|
11406
|
+
});
|
|
11407
|
+
}
|
|
11408
|
+
}));
|
|
11409
|
+
}
|
|
11410
|
+
/**
|
|
11411
|
+
* Enables noise cancellation for the microphone.
|
|
11412
|
+
*
|
|
11413
|
+
* Note: not supported in React Native.
|
|
11414
|
+
* @param noiseCancellation - a noise cancellation instance to use.
|
|
11415
|
+
*/
|
|
11416
|
+
async enableNoiseCancellation(noiseCancellation) {
|
|
11417
|
+
if (isReactNative()) {
|
|
11418
|
+
throw new Error('Noise cancellation is not supported in React Native');
|
|
11419
|
+
}
|
|
11420
|
+
const { ownCapabilities, settings } = this.call.state;
|
|
11421
|
+
const hasNoiseCancellationCapability = ownCapabilities.includes(OwnCapability.ENABLE_NOISE_CANCELLATION);
|
|
11422
|
+
if (!hasNoiseCancellationCapability) {
|
|
11423
|
+
throw new Error('Noise cancellation is not available.');
|
|
11424
|
+
}
|
|
11425
|
+
const noiseCancellationSettings = settings?.audio.noise_cancellation;
|
|
11426
|
+
if (!noiseCancellationSettings ||
|
|
11427
|
+
noiseCancellationSettings.mode ===
|
|
11428
|
+
NoiseCancellationSettingsModeEnum.DISABLED) {
|
|
11429
|
+
throw new Error('Noise cancellation is disabled for this call type.');
|
|
11430
|
+
}
|
|
11431
|
+
try {
|
|
11432
|
+
this.noiseCancellation = noiseCancellation;
|
|
11433
|
+
// listen for change events and notify the SFU
|
|
11434
|
+
this.noiseCancellationChangeUnsubscribe = this.noiseCancellation.on('change', (enabled) => {
|
|
11435
|
+
if (enabled) {
|
|
11436
|
+
this.call.notifyNoiseCancellationStarting().catch((err) => {
|
|
11437
|
+
this.logger('warn', `notifyNoiseCancellationStart failed`, err);
|
|
11438
|
+
});
|
|
11439
|
+
}
|
|
11440
|
+
else {
|
|
11441
|
+
this.call.notifyNoiseCancellationStopped().catch((err) => {
|
|
11442
|
+
this.logger('warn', `notifyNoiseCancellationStop failed`, err);
|
|
11443
|
+
});
|
|
11444
|
+
}
|
|
11445
|
+
});
|
|
11446
|
+
this.noiseCancellationRegistration = this.registerFilter(noiseCancellation.toFilter());
|
|
11447
|
+
await this.noiseCancellationRegistration;
|
|
11448
|
+
// handles an edge case where a noise cancellation is enabled after
|
|
11449
|
+
// the participant as joined the call -> we immediately enable NC
|
|
11450
|
+
if (noiseCancellationSettings.mode ===
|
|
11451
|
+
NoiseCancellationSettingsModeEnum.AUTO_ON &&
|
|
11452
|
+
this.call.state.callingState === CallingState.JOINED) {
|
|
11453
|
+
noiseCancellation.enable();
|
|
11454
|
+
}
|
|
11455
|
+
}
|
|
11456
|
+
catch (e) {
|
|
11457
|
+
this.logger('warn', 'Failed to enable noise cancellation', e);
|
|
11458
|
+
await this.disableNoiseCancellation().catch((err) => {
|
|
11459
|
+
this.logger('warn', 'Failed to disable noise cancellation', err);
|
|
11460
|
+
});
|
|
11461
|
+
}
|
|
11462
|
+
}
|
|
11463
|
+
/**
|
|
11464
|
+
* Disables noise cancellation for the microphone.
|
|
11465
|
+
*
|
|
11466
|
+
* Note: not supported in React Native.
|
|
11467
|
+
*/
|
|
11468
|
+
async disableNoiseCancellation() {
|
|
11469
|
+
if (isReactNative()) {
|
|
11470
|
+
throw new Error('Noise cancellation is not supported in React Native');
|
|
11471
|
+
}
|
|
11472
|
+
await this.noiseCancellationRegistration
|
|
11473
|
+
?.then((unregister) => unregister())
|
|
11474
|
+
.then(() => this.noiseCancellation?.disable())
|
|
11475
|
+
.then(() => this.noiseCancellationChangeUnsubscribe?.())
|
|
11476
|
+
.catch((err) => {
|
|
11477
|
+
this.logger('warn', 'Failed to unregister noise cancellation', err);
|
|
11478
|
+
});
|
|
11479
|
+
await this.call.notifyNoiseCancellationStopped();
|
|
11140
11480
|
}
|
|
11141
11481
|
getDevices() {
|
|
11142
11482
|
return getAudioDevices();
|
|
@@ -12163,6 +12503,26 @@ class Call {
|
|
|
12163
12503
|
this.logger('info', `stopPublish ${TrackType[trackType]}, stop tracks: ${stopTrack}`);
|
|
12164
12504
|
await this.publisher?.unpublishStream(trackType, stopTrack);
|
|
12165
12505
|
};
|
|
12506
|
+
/**
|
|
12507
|
+
* Notifies the SFU that a noise cancellation process has started.
|
|
12508
|
+
*
|
|
12509
|
+
* @internal
|
|
12510
|
+
*/
|
|
12511
|
+
this.notifyNoiseCancellationStarting = async () => {
|
|
12512
|
+
return this.sfuClient?.startNoiseCancellation().catch((err) => {
|
|
12513
|
+
this.logger('warn', 'Failed to notify start of noise cancellation', err);
|
|
12514
|
+
});
|
|
12515
|
+
};
|
|
12516
|
+
/**
|
|
12517
|
+
* Notifies the SFU that a noise cancellation process has stopped.
|
|
12518
|
+
*
|
|
12519
|
+
* @internal
|
|
12520
|
+
*/
|
|
12521
|
+
this.notifyNoiseCancellationStopped = async () => {
|
|
12522
|
+
return this.sfuClient?.stopNoiseCancellation().catch((err) => {
|
|
12523
|
+
this.logger('warn', 'Failed to notify stop of noise cancellation', err);
|
|
12524
|
+
});
|
|
12525
|
+
};
|
|
12166
12526
|
/**
|
|
12167
12527
|
* Update track subscription configuration for one or more participants.
|
|
12168
12528
|
* You have to create a subscription for each participant for all the different kinds of tracks you want to receive.
|
|
@@ -14482,7 +14842,7 @@ class StreamClient {
|
|
|
14482
14842
|
});
|
|
14483
14843
|
};
|
|
14484
14844
|
this.getUserAgent = () => {
|
|
14485
|
-
const version = "0.7.
|
|
14845
|
+
const version = "0.7.9" ;
|
|
14486
14846
|
return (this.userAgent ||
|
|
14487
14847
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
14488
14848
|
};
|
|
@@ -14958,5 +15318,5 @@ class StreamVideoClient {
|
|
|
14958
15318
|
}
|
|
14959
15319
|
}
|
|
14960
15320
|
|
|
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 };
|
|
15321
|
+
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
15322
|
//# sourceMappingURL=index.browser.es.js.map
|