@stream-io/video-client 0.7.6 → 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 +14 -0
- package/dist/index.browser.es.js +362 -6
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +363 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +362 -6
- 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 +26 -2
- 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/dist/index.es.js
CHANGED
|
@@ -34,6 +34,22 @@ const CreateDeviceRequestPushProviderEnum = {
|
|
|
34
34
|
HUAWEI: 'huawei',
|
|
35
35
|
XIAOMI: 'xiaomi',
|
|
36
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* @export
|
|
39
|
+
*/
|
|
40
|
+
const NoiseCancellationSettingsModeEnum = {
|
|
41
|
+
AVAILABLE: 'available',
|
|
42
|
+
DISABLED: 'disabled',
|
|
43
|
+
AUTO_ON: 'auto-on',
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* @export
|
|
47
|
+
*/
|
|
48
|
+
const NoiseCancellationSettingsRequestModeEnum = {
|
|
49
|
+
AVAILABLE: 'available',
|
|
50
|
+
DISABLED: 'disabled',
|
|
51
|
+
AUTO_ON: 'auto-on',
|
|
52
|
+
};
|
|
37
53
|
/**
|
|
38
54
|
* All possibility of string to use
|
|
39
55
|
* @export
|
|
@@ -42,6 +58,7 @@ const OwnCapability = {
|
|
|
42
58
|
BLOCK_USERS: 'block-users',
|
|
43
59
|
CREATE_CALL: 'create-call',
|
|
44
60
|
CREATE_REACTION: 'create-reaction',
|
|
61
|
+
ENABLE_NOISE_CANCELLATION: 'enable-noise-cancellation',
|
|
45
62
|
END_CALL: 'end-call',
|
|
46
63
|
JOIN_BACKSTAGE: 'join-backstage',
|
|
47
64
|
JOIN_CALL: 'join-call',
|
|
@@ -2423,10 +2440,196 @@ var models = /*#__PURE__*/Object.freeze({
|
|
|
2423
2440
|
});
|
|
2424
2441
|
|
|
2425
2442
|
/* eslint-disable */
|
|
2426
|
-
// @generated by protobuf-ts 2.9.
|
|
2443
|
+
// @generated by protobuf-ts 2.9.4 with parameter long_type_string,client_generic,server_none,eslint_disable
|
|
2427
2444
|
// @generated from protobuf file "video/sfu/signal_rpc/signal.proto" (package "stream.video.sfu.signal", syntax proto3)
|
|
2428
2445
|
// tslint:disable
|
|
2429
2446
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
2447
|
+
class StartNoiseCancellationRequest$Type extends MessageType {
|
|
2448
|
+
constructor() {
|
|
2449
|
+
super('stream.video.sfu.signal.StartNoiseCancellationRequest', [
|
|
2450
|
+
{ no: 1, name: 'session_id', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
|
|
2451
|
+
]);
|
|
2452
|
+
}
|
|
2453
|
+
create(value) {
|
|
2454
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
2455
|
+
message.sessionId = '';
|
|
2456
|
+
if (value !== undefined)
|
|
2457
|
+
reflectionMergePartial(this, message, value);
|
|
2458
|
+
return message;
|
|
2459
|
+
}
|
|
2460
|
+
internalBinaryRead(reader, length, options, target) {
|
|
2461
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2462
|
+
while (reader.pos < end) {
|
|
2463
|
+
let [fieldNo, wireType] = reader.tag();
|
|
2464
|
+
switch (fieldNo) {
|
|
2465
|
+
case /* string session_id */ 1:
|
|
2466
|
+
message.sessionId = reader.string();
|
|
2467
|
+
break;
|
|
2468
|
+
default:
|
|
2469
|
+
let u = options.readUnknownField;
|
|
2470
|
+
if (u === 'throw')
|
|
2471
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2472
|
+
let d = reader.skip(wireType);
|
|
2473
|
+
if (u !== false)
|
|
2474
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
return message;
|
|
2478
|
+
}
|
|
2479
|
+
internalBinaryWrite(message, writer, options) {
|
|
2480
|
+
/* string session_id = 1; */
|
|
2481
|
+
if (message.sessionId !== '')
|
|
2482
|
+
writer.tag(1, WireType.LengthDelimited).string(message.sessionId);
|
|
2483
|
+
let u = options.writeUnknownFields;
|
|
2484
|
+
if (u !== false)
|
|
2485
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2486
|
+
return writer;
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
/**
|
|
2490
|
+
* @generated MessageType for protobuf message stream.video.sfu.signal.StartNoiseCancellationRequest
|
|
2491
|
+
*/
|
|
2492
|
+
const StartNoiseCancellationRequest = new StartNoiseCancellationRequest$Type();
|
|
2493
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
2494
|
+
class StartNoiseCancellationResponse$Type extends MessageType {
|
|
2495
|
+
constructor() {
|
|
2496
|
+
super('stream.video.sfu.signal.StartNoiseCancellationResponse', [
|
|
2497
|
+
{ no: 1, name: 'error', kind: 'message', T: () => Error$2 },
|
|
2498
|
+
]);
|
|
2499
|
+
}
|
|
2500
|
+
create(value) {
|
|
2501
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
2502
|
+
if (value !== undefined)
|
|
2503
|
+
reflectionMergePartial(this, message, value);
|
|
2504
|
+
return message;
|
|
2505
|
+
}
|
|
2506
|
+
internalBinaryRead(reader, length, options, target) {
|
|
2507
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2508
|
+
while (reader.pos < end) {
|
|
2509
|
+
let [fieldNo, wireType] = reader.tag();
|
|
2510
|
+
switch (fieldNo) {
|
|
2511
|
+
case /* stream.video.sfu.models.Error error */ 1:
|
|
2512
|
+
message.error = Error$2.internalBinaryRead(reader, reader.uint32(), options, message.error);
|
|
2513
|
+
break;
|
|
2514
|
+
default:
|
|
2515
|
+
let u = options.readUnknownField;
|
|
2516
|
+
if (u === 'throw')
|
|
2517
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2518
|
+
let d = reader.skip(wireType);
|
|
2519
|
+
if (u !== false)
|
|
2520
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
return message;
|
|
2524
|
+
}
|
|
2525
|
+
internalBinaryWrite(message, writer, options) {
|
|
2526
|
+
/* stream.video.sfu.models.Error error = 1; */
|
|
2527
|
+
if (message.error)
|
|
2528
|
+
Error$2.internalBinaryWrite(message.error, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
2529
|
+
let u = options.writeUnknownFields;
|
|
2530
|
+
if (u !== false)
|
|
2531
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2532
|
+
return writer;
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
/**
|
|
2536
|
+
* @generated MessageType for protobuf message stream.video.sfu.signal.StartNoiseCancellationResponse
|
|
2537
|
+
*/
|
|
2538
|
+
const StartNoiseCancellationResponse = new StartNoiseCancellationResponse$Type();
|
|
2539
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
2540
|
+
class StopNoiseCancellationRequest$Type extends MessageType {
|
|
2541
|
+
constructor() {
|
|
2542
|
+
super('stream.video.sfu.signal.StopNoiseCancellationRequest', [
|
|
2543
|
+
{ no: 1, name: 'session_id', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
|
|
2544
|
+
]);
|
|
2545
|
+
}
|
|
2546
|
+
create(value) {
|
|
2547
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
2548
|
+
message.sessionId = '';
|
|
2549
|
+
if (value !== undefined)
|
|
2550
|
+
reflectionMergePartial(this, message, value);
|
|
2551
|
+
return message;
|
|
2552
|
+
}
|
|
2553
|
+
internalBinaryRead(reader, length, options, target) {
|
|
2554
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2555
|
+
while (reader.pos < end) {
|
|
2556
|
+
let [fieldNo, wireType] = reader.tag();
|
|
2557
|
+
switch (fieldNo) {
|
|
2558
|
+
case /* string session_id */ 1:
|
|
2559
|
+
message.sessionId = reader.string();
|
|
2560
|
+
break;
|
|
2561
|
+
default:
|
|
2562
|
+
let u = options.readUnknownField;
|
|
2563
|
+
if (u === 'throw')
|
|
2564
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2565
|
+
let d = reader.skip(wireType);
|
|
2566
|
+
if (u !== false)
|
|
2567
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
return message;
|
|
2571
|
+
}
|
|
2572
|
+
internalBinaryWrite(message, writer, options) {
|
|
2573
|
+
/* string session_id = 1; */
|
|
2574
|
+
if (message.sessionId !== '')
|
|
2575
|
+
writer.tag(1, WireType.LengthDelimited).string(message.sessionId);
|
|
2576
|
+
let u = options.writeUnknownFields;
|
|
2577
|
+
if (u !== false)
|
|
2578
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2579
|
+
return writer;
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
/**
|
|
2583
|
+
* @generated MessageType for protobuf message stream.video.sfu.signal.StopNoiseCancellationRequest
|
|
2584
|
+
*/
|
|
2585
|
+
const StopNoiseCancellationRequest = new StopNoiseCancellationRequest$Type();
|
|
2586
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
2587
|
+
class StopNoiseCancellationResponse$Type extends MessageType {
|
|
2588
|
+
constructor() {
|
|
2589
|
+
super('stream.video.sfu.signal.StopNoiseCancellationResponse', [
|
|
2590
|
+
{ no: 1, name: 'error', kind: 'message', T: () => Error$2 },
|
|
2591
|
+
]);
|
|
2592
|
+
}
|
|
2593
|
+
create(value) {
|
|
2594
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
2595
|
+
if (value !== undefined)
|
|
2596
|
+
reflectionMergePartial(this, message, value);
|
|
2597
|
+
return message;
|
|
2598
|
+
}
|
|
2599
|
+
internalBinaryRead(reader, length, options, target) {
|
|
2600
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2601
|
+
while (reader.pos < end) {
|
|
2602
|
+
let [fieldNo, wireType] = reader.tag();
|
|
2603
|
+
switch (fieldNo) {
|
|
2604
|
+
case /* stream.video.sfu.models.Error error */ 1:
|
|
2605
|
+
message.error = Error$2.internalBinaryRead(reader, reader.uint32(), options, message.error);
|
|
2606
|
+
break;
|
|
2607
|
+
default:
|
|
2608
|
+
let u = options.readUnknownField;
|
|
2609
|
+
if (u === 'throw')
|
|
2610
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2611
|
+
let d = reader.skip(wireType);
|
|
2612
|
+
if (u !== false)
|
|
2613
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
return message;
|
|
2617
|
+
}
|
|
2618
|
+
internalBinaryWrite(message, writer, options) {
|
|
2619
|
+
/* stream.video.sfu.models.Error error = 1; */
|
|
2620
|
+
if (message.error)
|
|
2621
|
+
Error$2.internalBinaryWrite(message.error, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
2622
|
+
let u = options.writeUnknownFields;
|
|
2623
|
+
if (u !== false)
|
|
2624
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2625
|
+
return writer;
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
/**
|
|
2629
|
+
* @generated MessageType for protobuf message stream.video.sfu.signal.StopNoiseCancellationResponse
|
|
2630
|
+
*/
|
|
2631
|
+
const StopNoiseCancellationResponse = new StopNoiseCancellationResponse$Type();
|
|
2632
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
2430
2633
|
class SendStatsRequest$Type extends MessageType {
|
|
2431
2634
|
constructor() {
|
|
2432
2635
|
super('stream.video.sfu.signal.SendStatsRequest', [
|
|
@@ -3476,6 +3679,18 @@ const SignalServer = new ServiceType('stream.video.sfu.signal.SignalServer', [
|
|
|
3476
3679
|
I: SendStatsRequest,
|
|
3477
3680
|
O: SendStatsResponse,
|
|
3478
3681
|
},
|
|
3682
|
+
{
|
|
3683
|
+
name: 'StartNoiseCancellation',
|
|
3684
|
+
options: {},
|
|
3685
|
+
I: StartNoiseCancellationRequest,
|
|
3686
|
+
O: StartNoiseCancellationResponse,
|
|
3687
|
+
},
|
|
3688
|
+
{
|
|
3689
|
+
name: 'StopNoiseCancellation',
|
|
3690
|
+
options: {},
|
|
3691
|
+
I: StopNoiseCancellationRequest,
|
|
3692
|
+
O: StopNoiseCancellationResponse,
|
|
3693
|
+
},
|
|
3479
3694
|
]);
|
|
3480
3695
|
|
|
3481
3696
|
/**
|
|
@@ -5778,6 +5993,20 @@ class SignalServerClient {
|
|
|
5778
5993
|
const method = this.methods[6], opt = this._transport.mergeOptions(options);
|
|
5779
5994
|
return stackIntercept('unary', this._transport, method, opt, input);
|
|
5780
5995
|
}
|
|
5996
|
+
/**
|
|
5997
|
+
* @generated from protobuf rpc: StartNoiseCancellation(stream.video.sfu.signal.StartNoiseCancellationRequest) returns (stream.video.sfu.signal.StartNoiseCancellationResponse);
|
|
5998
|
+
*/
|
|
5999
|
+
startNoiseCancellation(input, options) {
|
|
6000
|
+
const method = this.methods[7], opt = this._transport.mergeOptions(options);
|
|
6001
|
+
return stackIntercept('unary', this._transport, method, opt, input);
|
|
6002
|
+
}
|
|
6003
|
+
/**
|
|
6004
|
+
* @generated from protobuf rpc: StopNoiseCancellation(stream.video.sfu.signal.StopNoiseCancellationRequest) returns (stream.video.sfu.signal.StopNoiseCancellationResponse);
|
|
6005
|
+
*/
|
|
6006
|
+
stopNoiseCancellation(input, options) {
|
|
6007
|
+
const method = this.methods[8], opt = this._transport.mergeOptions(options);
|
|
6008
|
+
return stackIntercept('unary', this._transport, method, opt, input);
|
|
6009
|
+
}
|
|
5781
6010
|
}
|
|
5782
6011
|
|
|
5783
6012
|
const defaultOptions = {
|
|
@@ -8675,6 +8904,16 @@ class StreamSfuClient {
|
|
|
8675
8904
|
sessionId: this.sessionId,
|
|
8676
8905
|
}), this.logger);
|
|
8677
8906
|
};
|
|
8907
|
+
this.startNoiseCancellation = async () => {
|
|
8908
|
+
return retryable(() => this.rpc.startNoiseCancellation({
|
|
8909
|
+
sessionId: this.sessionId,
|
|
8910
|
+
}), this.logger);
|
|
8911
|
+
};
|
|
8912
|
+
this.stopNoiseCancellation = async () => {
|
|
8913
|
+
return retryable(() => this.rpc.stopNoiseCancellation({
|
|
8914
|
+
sessionId: this.sessionId,
|
|
8915
|
+
}), this.logger);
|
|
8916
|
+
};
|
|
8678
8917
|
this.join = async (data) => {
|
|
8679
8918
|
const joinRequest = JoinRequest.create({
|
|
8680
8919
|
...data,
|
|
@@ -11007,7 +11246,9 @@ const createSoundDetector = (audioStream, onSoundDetectedStateChanged, options =
|
|
|
11007
11246
|
// clean-up the AudioContext elements
|
|
11008
11247
|
microphone.disconnect();
|
|
11009
11248
|
analyser.disconnect();
|
|
11010
|
-
|
|
11249
|
+
if (audioContext.state !== 'closed') {
|
|
11250
|
+
await audioContext.close();
|
|
11251
|
+
}
|
|
11011
11252
|
// stop the stream
|
|
11012
11253
|
if (destroyStreamOnStop) {
|
|
11013
11254
|
audioStream.getTracks().forEach((track) => {
|
|
@@ -11138,6 +11379,99 @@ class MicrophoneManager extends InputMediaDeviceManager {
|
|
|
11138
11379
|
await this.stopSpeakingWhileMutedDetection();
|
|
11139
11380
|
}
|
|
11140
11381
|
});
|
|
11382
|
+
this.subscriptions.push(createSubscription(this.call.state.callingState$, (callingState) => {
|
|
11383
|
+
// do nothing when noise filtering isn't turned on
|
|
11384
|
+
if (!this.noiseCancellationRegistration || !this.noiseCancellation)
|
|
11385
|
+
return;
|
|
11386
|
+
const autoOn = this.call.state.settings?.audio.noise_cancellation?.mode ===
|
|
11387
|
+
NoiseCancellationSettingsModeEnum.AUTO_ON;
|
|
11388
|
+
if (autoOn && callingState === CallingState.JOINED) {
|
|
11389
|
+
this.noiseCancellationRegistration
|
|
11390
|
+
.then(() => this.noiseCancellation?.enable())
|
|
11391
|
+
.catch((err) => {
|
|
11392
|
+
this.logger('warn', `Failed to enable noise cancellation`, err);
|
|
11393
|
+
return this.call.notifyNoiseCancellationStopped();
|
|
11394
|
+
});
|
|
11395
|
+
}
|
|
11396
|
+
else if (callingState === CallingState.LEFT) {
|
|
11397
|
+
this.noiseCancellationRegistration
|
|
11398
|
+
.then(() => this.noiseCancellation?.disable())
|
|
11399
|
+
.catch((err) => {
|
|
11400
|
+
this.logger('warn', `Failed to disable noise cancellation`, err);
|
|
11401
|
+
});
|
|
11402
|
+
}
|
|
11403
|
+
}));
|
|
11404
|
+
}
|
|
11405
|
+
/**
|
|
11406
|
+
* Enables noise cancellation for the microphone.
|
|
11407
|
+
*
|
|
11408
|
+
* Note: not supported in React Native.
|
|
11409
|
+
* @param noiseCancellation - a noise cancellation instance to use.
|
|
11410
|
+
*/
|
|
11411
|
+
async enableNoiseCancellation(noiseCancellation) {
|
|
11412
|
+
if (isReactNative()) {
|
|
11413
|
+
throw new Error('Noise cancellation is not supported in React Native');
|
|
11414
|
+
}
|
|
11415
|
+
const { ownCapabilities, settings } = this.call.state;
|
|
11416
|
+
const hasNoiseCancellationCapability = ownCapabilities.includes(OwnCapability.ENABLE_NOISE_CANCELLATION);
|
|
11417
|
+
if (!hasNoiseCancellationCapability) {
|
|
11418
|
+
throw new Error('Noise cancellation is not available.');
|
|
11419
|
+
}
|
|
11420
|
+
const noiseCancellationSettings = settings?.audio.noise_cancellation;
|
|
11421
|
+
if (!noiseCancellationSettings ||
|
|
11422
|
+
noiseCancellationSettings.mode ===
|
|
11423
|
+
NoiseCancellationSettingsModeEnum.DISABLED) {
|
|
11424
|
+
throw new Error('Noise cancellation is disabled for this call type.');
|
|
11425
|
+
}
|
|
11426
|
+
try {
|
|
11427
|
+
this.noiseCancellation = noiseCancellation;
|
|
11428
|
+
// listen for change events and notify the SFU
|
|
11429
|
+
this.noiseCancellationChangeUnsubscribe = this.noiseCancellation.on('change', (enabled) => {
|
|
11430
|
+
if (enabled) {
|
|
11431
|
+
this.call.notifyNoiseCancellationStarting().catch((err) => {
|
|
11432
|
+
this.logger('warn', `notifyNoiseCancellationStart failed`, err);
|
|
11433
|
+
});
|
|
11434
|
+
}
|
|
11435
|
+
else {
|
|
11436
|
+
this.call.notifyNoiseCancellationStopped().catch((err) => {
|
|
11437
|
+
this.logger('warn', `notifyNoiseCancellationStop failed`, err);
|
|
11438
|
+
});
|
|
11439
|
+
}
|
|
11440
|
+
});
|
|
11441
|
+
this.noiseCancellationRegistration = this.registerFilter(noiseCancellation.toFilter());
|
|
11442
|
+
await this.noiseCancellationRegistration;
|
|
11443
|
+
// handles an edge case where a noise cancellation is enabled after
|
|
11444
|
+
// the participant as joined the call -> we immediately enable NC
|
|
11445
|
+
if (noiseCancellationSettings.mode ===
|
|
11446
|
+
NoiseCancellationSettingsModeEnum.AUTO_ON &&
|
|
11447
|
+
this.call.state.callingState === CallingState.JOINED) {
|
|
11448
|
+
noiseCancellation.enable();
|
|
11449
|
+
}
|
|
11450
|
+
}
|
|
11451
|
+
catch (e) {
|
|
11452
|
+
this.logger('warn', 'Failed to enable noise cancellation', e);
|
|
11453
|
+
await this.disableNoiseCancellation().catch((err) => {
|
|
11454
|
+
this.logger('warn', 'Failed to disable noise cancellation', err);
|
|
11455
|
+
});
|
|
11456
|
+
}
|
|
11457
|
+
}
|
|
11458
|
+
/**
|
|
11459
|
+
* Disables noise cancellation for the microphone.
|
|
11460
|
+
*
|
|
11461
|
+
* Note: not supported in React Native.
|
|
11462
|
+
*/
|
|
11463
|
+
async disableNoiseCancellation() {
|
|
11464
|
+
if (isReactNative()) {
|
|
11465
|
+
throw new Error('Noise cancellation is not supported in React Native');
|
|
11466
|
+
}
|
|
11467
|
+
await this.noiseCancellationRegistration
|
|
11468
|
+
?.then((unregister) => unregister())
|
|
11469
|
+
.then(() => this.noiseCancellation?.disable())
|
|
11470
|
+
.then(() => this.noiseCancellationChangeUnsubscribe?.())
|
|
11471
|
+
.catch((err) => {
|
|
11472
|
+
this.logger('warn', 'Failed to unregister noise cancellation', err);
|
|
11473
|
+
});
|
|
11474
|
+
await this.call.notifyNoiseCancellationStopped();
|
|
11141
11475
|
}
|
|
11142
11476
|
getDevices() {
|
|
11143
11477
|
return getAudioDevices();
|
|
@@ -12164,6 +12498,26 @@ class Call {
|
|
|
12164
12498
|
this.logger('info', `stopPublish ${TrackType[trackType]}, stop tracks: ${stopTrack}`);
|
|
12165
12499
|
await this.publisher?.unpublishStream(trackType, stopTrack);
|
|
12166
12500
|
};
|
|
12501
|
+
/**
|
|
12502
|
+
* Notifies the SFU that a noise cancellation process has started.
|
|
12503
|
+
*
|
|
12504
|
+
* @internal
|
|
12505
|
+
*/
|
|
12506
|
+
this.notifyNoiseCancellationStarting = async () => {
|
|
12507
|
+
return this.sfuClient?.startNoiseCancellation().catch((err) => {
|
|
12508
|
+
this.logger('warn', 'Failed to notify start of noise cancellation', err);
|
|
12509
|
+
});
|
|
12510
|
+
};
|
|
12511
|
+
/**
|
|
12512
|
+
* Notifies the SFU that a noise cancellation process has stopped.
|
|
12513
|
+
*
|
|
12514
|
+
* @internal
|
|
12515
|
+
*/
|
|
12516
|
+
this.notifyNoiseCancellationStopped = async () => {
|
|
12517
|
+
return this.sfuClient?.stopNoiseCancellation().catch((err) => {
|
|
12518
|
+
this.logger('warn', 'Failed to notify stop of noise cancellation', err);
|
|
12519
|
+
});
|
|
12520
|
+
};
|
|
12167
12521
|
/**
|
|
12168
12522
|
* Update track subscription configuration for one or more participants.
|
|
12169
12523
|
* You have to create a subscription for each participant for all the different kinds of tracks you want to receive.
|
|
@@ -12638,12 +12992,14 @@ class Call {
|
|
|
12638
12992
|
if (rating < 1 || rating > 5) {
|
|
12639
12993
|
throw new Error('Rating must be between 1 and 5');
|
|
12640
12994
|
}
|
|
12641
|
-
const userSessionId = this.sfuClient?.sessionId;
|
|
12642
12995
|
const callSessionId = this.state.session?.id;
|
|
12643
|
-
if (!callSessionId
|
|
12996
|
+
if (!callSessionId) {
|
|
12644
12997
|
throw new Error('Feedback can be submitted only in the context of a call session');
|
|
12645
12998
|
}
|
|
12646
12999
|
const { sdkName, sdkVersion, ...platform } = getSdkSignature(getClientDetails());
|
|
13000
|
+
// user sessionId is not available once the call has been left
|
|
13001
|
+
// until we relax the backend validation, we'll send N/A
|
|
13002
|
+
const userSessionId = this.sfuClient?.sessionId ?? 'N/A';
|
|
12647
13003
|
const endpoint = `${this.streamClientBasePath}/feedback/${callSessionId}`;
|
|
12648
13004
|
return this.streamClient.post(endpoint, {
|
|
12649
13005
|
rating,
|
|
@@ -14479,7 +14835,7 @@ class StreamClient {
|
|
|
14479
14835
|
});
|
|
14480
14836
|
};
|
|
14481
14837
|
this.getUserAgent = () => {
|
|
14482
|
-
const version = "0.7.
|
|
14838
|
+
const version = "0.7.8" ;
|
|
14483
14839
|
return (this.userAgent ||
|
|
14484
14840
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
14485
14841
|
};
|
|
@@ -14955,5 +15311,5 @@ class StreamVideoClient {
|
|
|
14955
15311
|
}
|
|
14956
15312
|
}
|
|
14957
15313
|
|
|
14958
|
-
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 };
|
|
15314
|
+
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 };
|
|
14959
15315
|
//# sourceMappingURL=index.es.js.map
|