@stream-io/video-client 0.6.1 → 0.6.3
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 +289 -25
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +290 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +289 -25
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +10 -1
- package/dist/src/StreamSfuClient.d.ts +2 -1
- package/dist/src/client-details.d.ts +10 -1
- package/dist/src/gen/coordinator/index.d.ts +307 -0
- package/dist/src/gen/video/sfu/signal_rpc/signal.client.d.ts +9 -1
- package/dist/src/gen/video/sfu/signal_rpc/signal.d.ts +58 -0
- package/dist/src/rtc/flows/join.d.ts +1 -0
- package/dist/src/stats/SfuStatsReporter.d.ts +25 -0
- package/dist/src/stats/index.d.ts +3 -0
- package/dist/src/stats/utils.d.ts +6 -0
- package/dist/src/store/CallState.d.ts +1 -1
- package/package.json +1 -1
- package/src/Call.ts +39 -9
- package/src/StreamSfuClient.ts +12 -0
- package/src/client-details.ts +21 -2
- package/src/coordinator/connection/location.ts +2 -2
- package/src/gen/coordinator/index.ts +303 -0
- package/src/gen/video/sfu/signal_rpc/signal.client.ts +26 -0
- package/src/gen/video/sfu/signal_rpc/signal.ts +250 -0
- package/src/helpers/RNSpeechDetector.ts +1 -1
- package/src/rtc/Publisher.ts +2 -1
- package/src/rtc/Subscriber.ts +2 -1
- package/src/rtc/flows/join.ts +4 -2
- package/src/stats/SfuStatsReporter.ts +88 -0
- package/src/stats/index.ts +3 -0
- package/src/stats/{state-store-stats-reporter.ts → stateStoreStatsReporter.ts} +1 -13
- package/src/stats/utils.ts +12 -0
- package/src/store/CallState.ts +1 -1
- /package/dist/src/stats/{state-store-stats-reporter.d.ts → stateStoreStatsReporter.d.ts} +0 -0
package/dist/index.es.js
CHANGED
|
@@ -2449,6 +2449,159 @@ var models = /*#__PURE__*/Object.freeze({
|
|
|
2449
2449
|
// @generated from protobuf file "video/sfu/signal_rpc/signal.proto" (package "stream.video.sfu.signal", syntax proto3)
|
|
2450
2450
|
// tslint:disable
|
|
2451
2451
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
2452
|
+
class SendStatsRequest$Type extends MessageType {
|
|
2453
|
+
constructor() {
|
|
2454
|
+
super('stream.video.sfu.signal.SendStatsRequest', [
|
|
2455
|
+
{ no: 1, name: 'session_id', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
|
|
2456
|
+
{
|
|
2457
|
+
no: 2,
|
|
2458
|
+
name: 'subscriber_stats',
|
|
2459
|
+
kind: 'scalar',
|
|
2460
|
+
T: 9 /*ScalarType.STRING*/,
|
|
2461
|
+
},
|
|
2462
|
+
{
|
|
2463
|
+
no: 3,
|
|
2464
|
+
name: 'publisher_stats',
|
|
2465
|
+
kind: 'scalar',
|
|
2466
|
+
T: 9 /*ScalarType.STRING*/,
|
|
2467
|
+
},
|
|
2468
|
+
{
|
|
2469
|
+
no: 4,
|
|
2470
|
+
name: 'webrtc_version',
|
|
2471
|
+
kind: 'scalar',
|
|
2472
|
+
T: 9 /*ScalarType.STRING*/,
|
|
2473
|
+
},
|
|
2474
|
+
{ no: 5, name: 'sdk', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
|
|
2475
|
+
{
|
|
2476
|
+
no: 6,
|
|
2477
|
+
name: 'sdk_version',
|
|
2478
|
+
kind: 'scalar',
|
|
2479
|
+
T: 9 /*ScalarType.STRING*/,
|
|
2480
|
+
},
|
|
2481
|
+
]);
|
|
2482
|
+
}
|
|
2483
|
+
create(value) {
|
|
2484
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
2485
|
+
message.sessionId = '';
|
|
2486
|
+
message.subscriberStats = '';
|
|
2487
|
+
message.publisherStats = '';
|
|
2488
|
+
message.webrtcVersion = '';
|
|
2489
|
+
message.sdk = '';
|
|
2490
|
+
message.sdkVersion = '';
|
|
2491
|
+
if (value !== undefined)
|
|
2492
|
+
reflectionMergePartial(this, message, value);
|
|
2493
|
+
return message;
|
|
2494
|
+
}
|
|
2495
|
+
internalBinaryRead(reader, length, options, target) {
|
|
2496
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2497
|
+
while (reader.pos < end) {
|
|
2498
|
+
let [fieldNo, wireType] = reader.tag();
|
|
2499
|
+
switch (fieldNo) {
|
|
2500
|
+
case /* string session_id */ 1:
|
|
2501
|
+
message.sessionId = reader.string();
|
|
2502
|
+
break;
|
|
2503
|
+
case /* string subscriber_stats */ 2:
|
|
2504
|
+
message.subscriberStats = reader.string();
|
|
2505
|
+
break;
|
|
2506
|
+
case /* string publisher_stats */ 3:
|
|
2507
|
+
message.publisherStats = reader.string();
|
|
2508
|
+
break;
|
|
2509
|
+
case /* string webrtc_version */ 4:
|
|
2510
|
+
message.webrtcVersion = reader.string();
|
|
2511
|
+
break;
|
|
2512
|
+
case /* string sdk */ 5:
|
|
2513
|
+
message.sdk = reader.string();
|
|
2514
|
+
break;
|
|
2515
|
+
case /* string sdk_version */ 6:
|
|
2516
|
+
message.sdkVersion = reader.string();
|
|
2517
|
+
break;
|
|
2518
|
+
default:
|
|
2519
|
+
let u = options.readUnknownField;
|
|
2520
|
+
if (u === 'throw')
|
|
2521
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2522
|
+
let d = reader.skip(wireType);
|
|
2523
|
+
if (u !== false)
|
|
2524
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
return message;
|
|
2528
|
+
}
|
|
2529
|
+
internalBinaryWrite(message, writer, options) {
|
|
2530
|
+
/* string session_id = 1; */
|
|
2531
|
+
if (message.sessionId !== '')
|
|
2532
|
+
writer.tag(1, WireType.LengthDelimited).string(message.sessionId);
|
|
2533
|
+
/* string subscriber_stats = 2; */
|
|
2534
|
+
if (message.subscriberStats !== '')
|
|
2535
|
+
writer.tag(2, WireType.LengthDelimited).string(message.subscriberStats);
|
|
2536
|
+
/* string publisher_stats = 3; */
|
|
2537
|
+
if (message.publisherStats !== '')
|
|
2538
|
+
writer.tag(3, WireType.LengthDelimited).string(message.publisherStats);
|
|
2539
|
+
/* string webrtc_version = 4; */
|
|
2540
|
+
if (message.webrtcVersion !== '')
|
|
2541
|
+
writer.tag(4, WireType.LengthDelimited).string(message.webrtcVersion);
|
|
2542
|
+
/* string sdk = 5; */
|
|
2543
|
+
if (message.sdk !== '')
|
|
2544
|
+
writer.tag(5, WireType.LengthDelimited).string(message.sdk);
|
|
2545
|
+
/* string sdk_version = 6; */
|
|
2546
|
+
if (message.sdkVersion !== '')
|
|
2547
|
+
writer.tag(6, WireType.LengthDelimited).string(message.sdkVersion);
|
|
2548
|
+
let u = options.writeUnknownFields;
|
|
2549
|
+
if (u !== false)
|
|
2550
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2551
|
+
return writer;
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
/**
|
|
2555
|
+
* @generated MessageType for protobuf message stream.video.sfu.signal.SendStatsRequest
|
|
2556
|
+
*/
|
|
2557
|
+
const SendStatsRequest = new SendStatsRequest$Type();
|
|
2558
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
2559
|
+
class SendStatsResponse$Type extends MessageType {
|
|
2560
|
+
constructor() {
|
|
2561
|
+
super('stream.video.sfu.signal.SendStatsResponse', [
|
|
2562
|
+
{ no: 1, name: 'error', kind: 'message', T: () => Error$2 },
|
|
2563
|
+
]);
|
|
2564
|
+
}
|
|
2565
|
+
create(value) {
|
|
2566
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
2567
|
+
if (value !== undefined)
|
|
2568
|
+
reflectionMergePartial(this, message, value);
|
|
2569
|
+
return message;
|
|
2570
|
+
}
|
|
2571
|
+
internalBinaryRead(reader, length, options, target) {
|
|
2572
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
2573
|
+
while (reader.pos < end) {
|
|
2574
|
+
let [fieldNo, wireType] = reader.tag();
|
|
2575
|
+
switch (fieldNo) {
|
|
2576
|
+
case /* stream.video.sfu.models.Error error */ 1:
|
|
2577
|
+
message.error = Error$2.internalBinaryRead(reader, reader.uint32(), options, message.error);
|
|
2578
|
+
break;
|
|
2579
|
+
default:
|
|
2580
|
+
let u = options.readUnknownField;
|
|
2581
|
+
if (u === 'throw')
|
|
2582
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
2583
|
+
let d = reader.skip(wireType);
|
|
2584
|
+
if (u !== false)
|
|
2585
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
return message;
|
|
2589
|
+
}
|
|
2590
|
+
internalBinaryWrite(message, writer, options) {
|
|
2591
|
+
/* stream.video.sfu.models.Error error = 1; */
|
|
2592
|
+
if (message.error)
|
|
2593
|
+
Error$2.internalBinaryWrite(message.error, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
2594
|
+
let u = options.writeUnknownFields;
|
|
2595
|
+
if (u !== false)
|
|
2596
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
2597
|
+
return writer;
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
/**
|
|
2601
|
+
* @generated MessageType for protobuf message stream.video.sfu.signal.SendStatsResponse
|
|
2602
|
+
*/
|
|
2603
|
+
const SendStatsResponse = new SendStatsResponse$Type();
|
|
2604
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
2452
2605
|
class ICERestartRequest$Type extends MessageType {
|
|
2453
2606
|
constructor() {
|
|
2454
2607
|
super('stream.video.sfu.signal.ICERestartRequest', [
|
|
@@ -3339,6 +3492,12 @@ const SignalServer = new ServiceType('stream.video.sfu.signal.SignalServer', [
|
|
|
3339
3492
|
I: ICERestartRequest,
|
|
3340
3493
|
O: ICERestartResponse,
|
|
3341
3494
|
},
|
|
3495
|
+
{
|
|
3496
|
+
name: 'SendStats',
|
|
3497
|
+
options: {},
|
|
3498
|
+
I: SendStatsRequest,
|
|
3499
|
+
O: SendStatsResponse,
|
|
3500
|
+
},
|
|
3342
3501
|
]);
|
|
3343
3502
|
|
|
3344
3503
|
/**
|
|
@@ -5634,6 +5793,13 @@ class SignalServerClient {
|
|
|
5634
5793
|
const method = this.methods[5], opt = this._transport.mergeOptions(options);
|
|
5635
5794
|
return stackIntercept('unary', this._transport, method, opt, input);
|
|
5636
5795
|
}
|
|
5796
|
+
/**
|
|
5797
|
+
* @generated from protobuf rpc: SendStats(stream.video.sfu.signal.SendStatsRequest) returns (stream.video.sfu.signal.SendStatsResponse);
|
|
5798
|
+
*/
|
|
5799
|
+
sendStats(input, options) {
|
|
5800
|
+
const method = this.methods[6], opt = this._transport.mergeOptions(options);
|
|
5801
|
+
return stackIntercept('unary', this._transport, method, opt, input);
|
|
5802
|
+
}
|
|
5637
5803
|
}
|
|
5638
5804
|
|
|
5639
5805
|
const defaultOptions = {
|
|
@@ -5888,6 +6054,7 @@ function getIceCandidate(candidate) {
|
|
|
5888
6054
|
let sdkInfo;
|
|
5889
6055
|
let osInfo;
|
|
5890
6056
|
let deviceInfo;
|
|
6057
|
+
let webRtcInfo;
|
|
5891
6058
|
const setSdkInfo = (info) => {
|
|
5892
6059
|
sdkInfo = info;
|
|
5893
6060
|
};
|
|
@@ -5906,6 +6073,12 @@ const setDeviceInfo = (info) => {
|
|
|
5906
6073
|
const getDeviceInfo = () => {
|
|
5907
6074
|
return deviceInfo;
|
|
5908
6075
|
};
|
|
6076
|
+
const getWebRTCInfo = () => {
|
|
6077
|
+
return webRtcInfo;
|
|
6078
|
+
};
|
|
6079
|
+
const setWebRTCInfo = (info) => {
|
|
6080
|
+
webRtcInfo = info;
|
|
6081
|
+
};
|
|
5909
6082
|
const getClientDetails = () => {
|
|
5910
6083
|
if (isReactNative()) {
|
|
5911
6084
|
// Since RN doesn't support web, sharing browser info is not required
|
|
@@ -5929,7 +6102,9 @@ const getClientDetails = () => {
|
|
|
5929
6102
|
architecture: cpu.architecture || '',
|
|
5930
6103
|
},
|
|
5931
6104
|
device: {
|
|
5932
|
-
name:
|
|
6105
|
+
name: [device.vendor, device.model, device.type]
|
|
6106
|
+
.filter(Boolean)
|
|
6107
|
+
.join(' '),
|
|
5933
6108
|
version: '',
|
|
5934
6109
|
},
|
|
5935
6110
|
};
|
|
@@ -7907,7 +8082,8 @@ class Publisher {
|
|
|
7907
8082
|
this.onIceCandidateError = (e) => {
|
|
7908
8083
|
const errorMessage = e instanceof RTCPeerConnectionIceErrorEvent &&
|
|
7909
8084
|
`${e.errorCode}: ${e.errorText}`;
|
|
7910
|
-
const
|
|
8085
|
+
const iceState = this.pc.iceConnectionState;
|
|
8086
|
+
const logLevel = iceState === 'connected' || iceState === 'checking' ? 'debug' : 'warn';
|
|
7911
8087
|
logger$3(logLevel, `ICE Candidate error`, errorMessage);
|
|
7912
8088
|
};
|
|
7913
8089
|
this.onIceConnectionStateChange = () => {
|
|
@@ -8227,7 +8403,8 @@ class Subscriber {
|
|
|
8227
8403
|
this.onIceCandidateError = (e) => {
|
|
8228
8404
|
const errorMessage = e instanceof RTCPeerConnectionIceErrorEvent &&
|
|
8229
8405
|
`${e.errorCode}: ${e.errorText}`;
|
|
8230
|
-
const
|
|
8406
|
+
const iceState = this.pc.iceConnectionState;
|
|
8407
|
+
const logLevel = iceState === 'connected' || iceState === 'checking' ? 'debug' : 'warn';
|
|
8231
8408
|
logger$2(logLevel, `ICE Candidate error`, errorMessage);
|
|
8232
8409
|
};
|
|
8233
8410
|
this.sfuClient = sfuClient;
|
|
@@ -8485,6 +8662,12 @@ class StreamSfuClient {
|
|
|
8485
8662
|
sessionId: this.sessionId,
|
|
8486
8663
|
}), this.logger);
|
|
8487
8664
|
};
|
|
8665
|
+
this.sendStats = async (stats) => {
|
|
8666
|
+
return retryable(() => this.rpc.sendStats({
|
|
8667
|
+
...stats,
|
|
8668
|
+
sessionId: this.sessionId,
|
|
8669
|
+
}), this.logger);
|
|
8670
|
+
};
|
|
8488
8671
|
this.join = async (data) => {
|
|
8489
8672
|
const joinRequest = JoinRequest.create({
|
|
8490
8673
|
...data,
|
|
@@ -9019,8 +9202,7 @@ const registerRingingCallEventHandlers = (call) => {
|
|
|
9019
9202
|
* @param data the data for the call.
|
|
9020
9203
|
*/
|
|
9021
9204
|
const join = async (httpClient, type, id, data) => {
|
|
9022
|
-
const
|
|
9023
|
-
const { call, credentials, members, own_capabilities } = joinCallResponse;
|
|
9205
|
+
const { call, credentials, members, own_capabilities, stats_options } = await doJoin(httpClient, type, id, data);
|
|
9024
9206
|
return {
|
|
9025
9207
|
connectionConfig: toRtcConfiguration(credentials.ice_servers),
|
|
9026
9208
|
sfuServer: credentials.server,
|
|
@@ -9028,6 +9210,7 @@ const join = async (httpClient, type, id, data) => {
|
|
|
9028
9210
|
metadata: call,
|
|
9029
9211
|
members,
|
|
9030
9212
|
ownCapabilities: own_capabilities,
|
|
9213
|
+
statsOptions: stats_options,
|
|
9031
9214
|
};
|
|
9032
9215
|
};
|
|
9033
9216
|
const doJoin = async (httpClient, type, id, data) => {
|
|
@@ -9051,6 +9234,19 @@ const toRtcConfiguration = (config) => {
|
|
|
9051
9234
|
return rtcConfig;
|
|
9052
9235
|
};
|
|
9053
9236
|
|
|
9237
|
+
/**
|
|
9238
|
+
* Flatten the stats report into an array of stats objects.
|
|
9239
|
+
*
|
|
9240
|
+
* @param report the report to flatten.
|
|
9241
|
+
*/
|
|
9242
|
+
const flatten$1 = (report) => {
|
|
9243
|
+
const stats = [];
|
|
9244
|
+
report.forEach((s) => {
|
|
9245
|
+
stats.push(s);
|
|
9246
|
+
});
|
|
9247
|
+
return stats;
|
|
9248
|
+
};
|
|
9249
|
+
|
|
9054
9250
|
/**
|
|
9055
9251
|
* Creates a new StatsReporter instance that collects metrics about the ongoing call and reports them to the state store
|
|
9056
9252
|
*/
|
|
@@ -9271,18 +9467,58 @@ const aggregate = (stats) => {
|
|
|
9271
9467
|
}
|
|
9272
9468
|
return report;
|
|
9273
9469
|
};
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
const
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9470
|
+
|
|
9471
|
+
class SfuStatsReporter {
|
|
9472
|
+
constructor(sfuClient, { options, clientDetails, subscriber, publisher }) {
|
|
9473
|
+
this.logger = getLogger(['SfuStatsReporter']);
|
|
9474
|
+
this.run = async () => {
|
|
9475
|
+
const [subscriberStats, publisherStats] = await Promise.all([
|
|
9476
|
+
this.subscriber.getStats().then(flatten$1).then(JSON.stringify),
|
|
9477
|
+
this.publisher.getStats().then(flatten$1).then(JSON.stringify),
|
|
9478
|
+
]);
|
|
9479
|
+
await this.sfuClient.sendStats({
|
|
9480
|
+
sdk: this.sdkName,
|
|
9481
|
+
sdkVersion: this.sdkVersion,
|
|
9482
|
+
webrtcVersion: this.webRTCVersion,
|
|
9483
|
+
subscriberStats,
|
|
9484
|
+
publisherStats,
|
|
9485
|
+
});
|
|
9486
|
+
};
|
|
9487
|
+
this.start = () => {
|
|
9488
|
+
if (this.options.reporting_interval_ms <= 0)
|
|
9489
|
+
return;
|
|
9490
|
+
this.intervalId = setInterval(() => {
|
|
9491
|
+
this.run().catch((err) => {
|
|
9492
|
+
this.logger('warn', 'Failed to report stats', err);
|
|
9493
|
+
});
|
|
9494
|
+
}, this.options.reporting_interval_ms);
|
|
9495
|
+
};
|
|
9496
|
+
this.stop = () => {
|
|
9497
|
+
clearInterval(this.intervalId);
|
|
9498
|
+
this.intervalId = undefined;
|
|
9499
|
+
};
|
|
9500
|
+
this.sfuClient = sfuClient;
|
|
9501
|
+
this.options = options;
|
|
9502
|
+
this.subscriber = subscriber;
|
|
9503
|
+
this.publisher = publisher;
|
|
9504
|
+
const webRTCInfo = getWebRTCInfo();
|
|
9505
|
+
const { sdk, browser } = clientDetails;
|
|
9506
|
+
this.sdkName =
|
|
9507
|
+
sdk && sdk.type === SdkType.REACT
|
|
9508
|
+
? 'stream-react'
|
|
9509
|
+
: sdk && sdk.type === SdkType.REACT_NATIVE
|
|
9510
|
+
? 'stream-react-native'
|
|
9511
|
+
: 'stream-js';
|
|
9512
|
+
this.sdkVersion = sdk
|
|
9513
|
+
? `${sdk.major}.${sdk.minor}.${sdk.patch}`
|
|
9514
|
+
: '0.0.0-development';
|
|
9515
|
+
// The WebRTC version if passed from the SDK, it is taken else the browser info is sent.
|
|
9516
|
+
this.webRTCVersion =
|
|
9517
|
+
webRTCInfo?.version ||
|
|
9518
|
+
`${browser?.name || ''}-${browser?.version || ''}` ||
|
|
9519
|
+
'N/A';
|
|
9520
|
+
}
|
|
9521
|
+
}
|
|
9286
9522
|
|
|
9287
9523
|
const DEFAULT_THRESHOLD = 0.35;
|
|
9288
9524
|
class ViewportTracker {
|
|
@@ -11216,6 +11452,8 @@ class Call {
|
|
|
11216
11452
|
}
|
|
11217
11453
|
this.statsReporter?.stop();
|
|
11218
11454
|
this.statsReporter = undefined;
|
|
11455
|
+
this.sfuStatsReporter?.stop();
|
|
11456
|
+
this.sfuStatsReporter = undefined;
|
|
11219
11457
|
this.subscriber?.close();
|
|
11220
11458
|
this.subscriber = undefined;
|
|
11221
11459
|
this.publisher?.close();
|
|
@@ -11355,12 +11593,14 @@ class Call {
|
|
|
11355
11593
|
let sfuServer;
|
|
11356
11594
|
let sfuToken;
|
|
11357
11595
|
let connectionConfig;
|
|
11596
|
+
let statsOptions;
|
|
11358
11597
|
try {
|
|
11359
11598
|
if (this.sfuClient?.isFastReconnecting) {
|
|
11360
11599
|
// use previous SFU configuration and values
|
|
11361
11600
|
connectionConfig = this.publisher?.connectionConfiguration;
|
|
11362
11601
|
sfuServer = this.sfuClient.sfuServer;
|
|
11363
11602
|
sfuToken = this.sfuClient.token;
|
|
11603
|
+
statsOptions = this.sfuStatsReporter?.options;
|
|
11364
11604
|
}
|
|
11365
11605
|
else {
|
|
11366
11606
|
// full join flow - let the Coordinator pick a new SFU for us
|
|
@@ -11371,6 +11611,7 @@ class Call {
|
|
|
11371
11611
|
connectionConfig = call.connectionConfig;
|
|
11372
11612
|
sfuServer = call.sfuServer;
|
|
11373
11613
|
sfuToken = call.token;
|
|
11614
|
+
statsOptions = call.statsOptions;
|
|
11374
11615
|
}
|
|
11375
11616
|
if (this.streamClient._hasConnectionID()) {
|
|
11376
11617
|
this.watching = true;
|
|
@@ -11427,6 +11668,8 @@ class Call {
|
|
|
11427
11668
|
this.publisher = undefined;
|
|
11428
11669
|
this.statsReporter?.stop();
|
|
11429
11670
|
this.statsReporter = undefined;
|
|
11671
|
+
this.sfuStatsReporter?.stop();
|
|
11672
|
+
this.sfuStatsReporter = undefined;
|
|
11430
11673
|
// clean up current connection
|
|
11431
11674
|
sfuClient.close(StreamSfuClient.NORMAL_CLOSURE, 'js-client: attempting full reconnect');
|
|
11432
11675
|
}
|
|
@@ -11567,10 +11810,10 @@ class Call {
|
|
|
11567
11810
|
connectionConfig,
|
|
11568
11811
|
});
|
|
11569
11812
|
}
|
|
11570
|
-
const audioSettings = this.state.settings?.audio;
|
|
11571
|
-
const isDtxEnabled = !!audioSettings?.opus_dtx_enabled;
|
|
11572
|
-
const isRedEnabled = !!audioSettings?.redundant_coding_enabled;
|
|
11573
11813
|
if (!this.publisher) {
|
|
11814
|
+
const audioSettings = this.state.settings?.audio;
|
|
11815
|
+
const isDtxEnabled = !!audioSettings?.opus_dtx_enabled;
|
|
11816
|
+
const isRedEnabled = !!audioSettings?.redundant_coding_enabled;
|
|
11574
11817
|
this.publisher = new Publisher({
|
|
11575
11818
|
sfuClient,
|
|
11576
11819
|
dispatcher: this.dispatcher,
|
|
@@ -11587,6 +11830,16 @@ class Call {
|
|
|
11587
11830
|
state: this.state,
|
|
11588
11831
|
});
|
|
11589
11832
|
}
|
|
11833
|
+
const clientDetails = getClientDetails();
|
|
11834
|
+
if (!this.sfuStatsReporter && statsOptions) {
|
|
11835
|
+
this.sfuStatsReporter = new SfuStatsReporter(sfuClient, {
|
|
11836
|
+
clientDetails,
|
|
11837
|
+
options: statsOptions,
|
|
11838
|
+
subscriber: this.subscriber,
|
|
11839
|
+
publisher: this.publisher,
|
|
11840
|
+
});
|
|
11841
|
+
this.sfuStatsReporter.start();
|
|
11842
|
+
}
|
|
11590
11843
|
try {
|
|
11591
11844
|
// 1. wait for the signal server to be ready before sending "joinRequest"
|
|
11592
11845
|
sfuClient.signalReady
|
|
@@ -11606,7 +11859,7 @@ class Call {
|
|
|
11606
11859
|
: undefined;
|
|
11607
11860
|
return sfuClient.join({
|
|
11608
11861
|
subscriberSdp: sdp || '',
|
|
11609
|
-
clientDetails
|
|
11862
|
+
clientDetails,
|
|
11610
11863
|
migration,
|
|
11611
11864
|
fastReconnect: previousSfuClient?.isFastReconnecting ?? false,
|
|
11612
11865
|
});
|
|
@@ -12225,6 +12478,17 @@ class Call {
|
|
|
12225
12478
|
}
|
|
12226
12479
|
return this.streamClient.get(`${endpoint}/recordings`);
|
|
12227
12480
|
};
|
|
12481
|
+
/**
|
|
12482
|
+
* Retrieve call statistics for a particular call session (historical).
|
|
12483
|
+
* Here `callSessionID` is mandatory.
|
|
12484
|
+
*
|
|
12485
|
+
* @param callSessionID the call session ID to retrieve statistics for.
|
|
12486
|
+
* @returns The call stats.
|
|
12487
|
+
*/
|
|
12488
|
+
this.getCallStats = async (callSessionID) => {
|
|
12489
|
+
const endpoint = `${this.streamClientBasePath}/stats/${callSessionID}`;
|
|
12490
|
+
return this.streamClient.get(endpoint);
|
|
12491
|
+
};
|
|
12228
12492
|
/**
|
|
12229
12493
|
* Sends a custom event to all call participants.
|
|
12230
12494
|
*
|
|
@@ -13638,7 +13902,7 @@ const getLocationHint = async (hintUrl = HINT_URL, timeout = 2000) => {
|
|
|
13638
13902
|
const abortController = new AbortController();
|
|
13639
13903
|
const timeoutId = setTimeout(() => abortController.abort(), timeout);
|
|
13640
13904
|
try {
|
|
13641
|
-
const response = await fetch(
|
|
13905
|
+
const response = await fetch(hintUrl, {
|
|
13642
13906
|
method: 'HEAD',
|
|
13643
13907
|
signal: abortController.signal,
|
|
13644
13908
|
});
|
|
@@ -13647,7 +13911,7 @@ const getLocationHint = async (hintUrl = HINT_URL, timeout = 2000) => {
|
|
|
13647
13911
|
return awsPop.substring(0, 3); // AMS1-P2 -> AMS
|
|
13648
13912
|
}
|
|
13649
13913
|
catch (e) {
|
|
13650
|
-
logger('warn', `Failed to get location hint from ${
|
|
13914
|
+
logger('warn', `Failed to get location hint from ${hintUrl}`, e);
|
|
13651
13915
|
return 'ERR';
|
|
13652
13916
|
}
|
|
13653
13917
|
finally {
|
|
@@ -14094,7 +14358,7 @@ class StreamClient {
|
|
|
14094
14358
|
});
|
|
14095
14359
|
};
|
|
14096
14360
|
this.getUserAgent = () => {
|
|
14097
|
-
const version = "0.6.
|
|
14361
|
+
const version = "0.6.3" ;
|
|
14098
14362
|
return (this.userAgent ||
|
|
14099
14363
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
14100
14364
|
};
|
|
@@ -14642,5 +14906,5 @@ class StreamVideoServerClient extends StreamVideoClient {
|
|
|
14642
14906
|
}
|
|
14643
14907
|
}
|
|
14644
14908
|
|
|
14645
|
-
export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, LayoutSettingsNameEnum, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoServerClient, 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, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking };
|
|
14909
|
+
export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, LayoutSettingsNameEnum, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoServerClient, 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 };
|
|
14646
14910
|
//# sourceMappingURL=index.es.js.map
|