@stream-io/video-client 1.20.1 → 1.20.2
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 +29 -14
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +29 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +29 -14
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +1 -1
- package/dist/src/gen/coordinator/index.d.ts +7 -0
- package/dist/src/types.d.ts +7 -2
- package/package.json +1 -1
- package/src/Call.ts +12 -10
- package/src/__tests__/Call.autodrop.test.ts +101 -0
- package/src/events/__tests__/call.test.ts +5 -1
- package/src/events/call.ts +8 -4
- package/src/events/internal.ts +1 -1
- package/src/gen/coordinator/index.ts +7 -0
- package/src/store/stateStore.ts +1 -1
- package/src/types.ts +8 -2
package/dist/index.es.js
CHANGED
|
@@ -118,6 +118,7 @@ const FrameRecordingSettingsRequestQualityEnum = {
|
|
|
118
118
|
_720P: '720p',
|
|
119
119
|
_1080P: '1080p',
|
|
120
120
|
_1440P: '1440p',
|
|
121
|
+
_2160P: '2160p',
|
|
121
122
|
};
|
|
122
123
|
/**
|
|
123
124
|
* @export
|
|
@@ -190,11 +191,13 @@ const RTMPBroadcastRequestQualityEnum = {
|
|
|
190
191
|
_720P: '720p',
|
|
191
192
|
_1080P: '1080p',
|
|
192
193
|
_1440P: '1440p',
|
|
194
|
+
_2160P: '2160p',
|
|
193
195
|
PORTRAIT_360X640: 'portrait-360x640',
|
|
194
196
|
PORTRAIT_480X854: 'portrait-480x854',
|
|
195
197
|
PORTRAIT_720X1280: 'portrait-720x1280',
|
|
196
198
|
PORTRAIT_1080X1920: 'portrait-1080x1920',
|
|
197
199
|
PORTRAIT_1440X2560: 'portrait-1440x2560',
|
|
200
|
+
PORTRAIT_2160X3840: 'portrait-2160x3840',
|
|
198
201
|
};
|
|
199
202
|
/**
|
|
200
203
|
* @export
|
|
@@ -205,11 +208,13 @@ const RTMPSettingsRequestQualityEnum = {
|
|
|
205
208
|
_720P: '720p',
|
|
206
209
|
_1080P: '1080p',
|
|
207
210
|
_1440P: '1440p',
|
|
211
|
+
_2160P: '2160p',
|
|
208
212
|
PORTRAIT_360X640: 'portrait-360x640',
|
|
209
213
|
PORTRAIT_480X854: 'portrait-480x854',
|
|
210
214
|
PORTRAIT_720X1280: 'portrait-720x1280',
|
|
211
215
|
PORTRAIT_1080X1920: 'portrait-1080x1920',
|
|
212
216
|
PORTRAIT_1440X2560: 'portrait-1440x2560',
|
|
217
|
+
PORTRAIT_2160X3840: 'portrait-2160x3840',
|
|
213
218
|
};
|
|
214
219
|
/**
|
|
215
220
|
* @export
|
|
@@ -228,11 +233,13 @@ const RecordSettingsRequestQualityEnum = {
|
|
|
228
233
|
_720P: '720p',
|
|
229
234
|
_1080P: '1080p',
|
|
230
235
|
_1440P: '1440p',
|
|
236
|
+
_2160P: '2160p',
|
|
231
237
|
PORTRAIT_360X640: 'portrait-360x640',
|
|
232
238
|
PORTRAIT_480X854: 'portrait-480x854',
|
|
233
239
|
PORTRAIT_720X1280: 'portrait-720x1280',
|
|
234
240
|
PORTRAIT_1080X1920: 'portrait-1080x1920',
|
|
235
241
|
PORTRAIT_1440X2560: 'portrait-1440x2560',
|
|
242
|
+
PORTRAIT_2160X3840: 'portrait-2160x3840',
|
|
236
243
|
};
|
|
237
244
|
/**
|
|
238
245
|
* @export
|
|
@@ -4059,7 +4066,7 @@ class StreamVideoWriteableStateStore {
|
|
|
4059
4066
|
continue;
|
|
4060
4067
|
logger('info', `User disconnected, leaving call: ${call.cid}`);
|
|
4061
4068
|
await call
|
|
4062
|
-
.leave({
|
|
4069
|
+
.leave({ message: 'client.disconnectUser() called' })
|
|
4063
4070
|
.catch((err) => {
|
|
4064
4071
|
logger('error', `Error leaving call: ${call.cid}`, err);
|
|
4065
4072
|
});
|
|
@@ -5644,7 +5651,7 @@ const aggregate = (stats) => {
|
|
|
5644
5651
|
return report;
|
|
5645
5652
|
};
|
|
5646
5653
|
|
|
5647
|
-
const version = "1.20.
|
|
5654
|
+
const version = "1.20.2";
|
|
5648
5655
|
const [major, minor, patch] = version.split('.');
|
|
5649
5656
|
let sdkInfo = {
|
|
5650
5657
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -7602,13 +7609,17 @@ const watchCallRejected = (call) => {
|
|
|
7602
7609
|
.every((m) => rejectedBy[m.user_id]);
|
|
7603
7610
|
if (everyoneElseRejected) {
|
|
7604
7611
|
call.logger('info', 'everyone rejected, leaving the call');
|
|
7605
|
-
await call.leave({
|
|
7612
|
+
await call.leave({
|
|
7613
|
+
reject: true,
|
|
7614
|
+
reason: 'cancel',
|
|
7615
|
+
message: 'ring: everyone rejected',
|
|
7616
|
+
});
|
|
7606
7617
|
}
|
|
7607
7618
|
}
|
|
7608
7619
|
else {
|
|
7609
7620
|
if (rejectedBy[eventCall.created_by.id]) {
|
|
7610
7621
|
call.logger('info', 'call creator rejected, leaving call');
|
|
7611
|
-
await call.leave({
|
|
7622
|
+
await call.leave({ message: 'ring: creator rejected' });
|
|
7612
7623
|
}
|
|
7613
7624
|
}
|
|
7614
7625
|
};
|
|
@@ -7622,7 +7633,7 @@ const watchCallEnded = (call) => {
|
|
|
7622
7633
|
if (callingState !== CallingState.IDLE &&
|
|
7623
7634
|
callingState !== CallingState.LEFT) {
|
|
7624
7635
|
call
|
|
7625
|
-
.leave({
|
|
7636
|
+
.leave({ message: 'call.ended event received', reject: false })
|
|
7626
7637
|
.catch((err) => {
|
|
7627
7638
|
call.logger('error', 'Failed to leave call after call.ended ', err);
|
|
7628
7639
|
});
|
|
@@ -7642,7 +7653,7 @@ const watchSfuCallEnded = (call) => {
|
|
|
7642
7653
|
// update the call state to reflect the call has ended.
|
|
7643
7654
|
call.state.setEndedAt(new Date());
|
|
7644
7655
|
const reason = CallEndedReason[e.reason];
|
|
7645
|
-
await call.leave({
|
|
7656
|
+
await call.leave({ message: `callEnded received: ${reason}` });
|
|
7646
7657
|
}
|
|
7647
7658
|
catch (err) {
|
|
7648
7659
|
call.logger('error', 'Failed to leave call after being ended by the SFU', err);
|
|
@@ -7709,7 +7720,7 @@ const watchLiveEnded = (dispatcher, call) => {
|
|
|
7709
7720
|
return;
|
|
7710
7721
|
call.state.setBackstage(true);
|
|
7711
7722
|
if (!call.permissionsContext.hasPermission(OwnCapability.JOIN_BACKSTAGE)) {
|
|
7712
|
-
call.leave({
|
|
7723
|
+
call.leave({ message: 'live ended' }).catch((err) => {
|
|
7713
7724
|
call.logger('error', 'Failed to leave call after live ended', err);
|
|
7714
7725
|
});
|
|
7715
7726
|
}
|
|
@@ -10571,7 +10582,7 @@ class Call {
|
|
|
10571
10582
|
const currentUserId = this.currentUserId;
|
|
10572
10583
|
if (currentUserId && blockedUserIds.includes(currentUserId)) {
|
|
10573
10584
|
this.logger('info', 'Leaving call because of being blocked');
|
|
10574
|
-
await this.leave({
|
|
10585
|
+
await this.leave({ message: 'user blocked' }).catch((err) => {
|
|
10575
10586
|
this.logger('error', 'Error leaving call after being blocked', err);
|
|
10576
10587
|
});
|
|
10577
10588
|
}
|
|
@@ -10724,7 +10735,7 @@ class Call {
|
|
|
10724
10735
|
/**
|
|
10725
10736
|
* Leave the call and stop the media streams that were published by the call.
|
|
10726
10737
|
*/
|
|
10727
|
-
this.leave = async ({ reject, reason
|
|
10738
|
+
this.leave = async ({ reject, reason, message } = {}) => {
|
|
10728
10739
|
await withoutConcurrency(this.joinLeaveConcurrencyTag, async () => {
|
|
10729
10740
|
const callingState = this.state.callingState;
|
|
10730
10741
|
if (callingState === CallingState.LEFT) {
|
|
@@ -10742,7 +10753,7 @@ class Call {
|
|
|
10742
10753
|
}
|
|
10743
10754
|
if (callingState === CallingState.RINGING && reject !== false) {
|
|
10744
10755
|
if (reject) {
|
|
10745
|
-
await this.reject('decline');
|
|
10756
|
+
await this.reject(reason ?? 'decline');
|
|
10746
10757
|
}
|
|
10747
10758
|
else {
|
|
10748
10759
|
// if reject was undefined, we still have to cancel the call automatically
|
|
@@ -10761,7 +10772,7 @@ class Call {
|
|
|
10761
10772
|
this.subscriber = undefined;
|
|
10762
10773
|
this.publisher?.dispose();
|
|
10763
10774
|
this.publisher = undefined;
|
|
10764
|
-
await this.sfuClient?.leaveAndClose(reason);
|
|
10775
|
+
await this.sfuClient?.leaveAndClose(message ?? reason ?? 'user is leaving the call');
|
|
10765
10776
|
this.sfuClient = undefined;
|
|
10766
10777
|
this.dynascaleManager.setSfuClient(undefined);
|
|
10767
10778
|
this.state.setCallingState(CallingState.LEFT);
|
|
@@ -11468,7 +11479,7 @@ class Call {
|
|
|
11468
11479
|
if (strategy === WebsocketReconnectStrategy.UNSPECIFIED)
|
|
11469
11480
|
return;
|
|
11470
11481
|
if (strategy === WebsocketReconnectStrategy.DISCONNECT) {
|
|
11471
|
-
this.leave({
|
|
11482
|
+
this.leave({ message: 'SFU instructed to disconnect' }).catch((err) => {
|
|
11472
11483
|
this.logger('warn', `Can't leave call after disconnect request`, err);
|
|
11473
11484
|
});
|
|
11474
11485
|
}
|
|
@@ -12098,7 +12109,11 @@ class Call {
|
|
|
12098
12109
|
// e.g. it was already accepted and joined
|
|
12099
12110
|
if (this.state.callingState !== CallingState.RINGING)
|
|
12100
12111
|
return;
|
|
12101
|
-
this.leave({
|
|
12112
|
+
this.leave({
|
|
12113
|
+
reject: true,
|
|
12114
|
+
reason: 'timeout',
|
|
12115
|
+
message: `ringing timeout - ${this.isCreatedByMe ? 'no one accepted' : `user didn't interact with incoming call screen`}`,
|
|
12116
|
+
}).catch((err) => {
|
|
12102
12117
|
this.logger('error', 'Failed to drop call', err);
|
|
12103
12118
|
});
|
|
12104
12119
|
}, timeoutInMs);
|
|
@@ -13471,7 +13486,7 @@ class StreamClient {
|
|
|
13471
13486
|
this.getUserAgent = () => {
|
|
13472
13487
|
if (!this.cachedUserAgent) {
|
|
13473
13488
|
const { clientAppIdentifier = {} } = this.options;
|
|
13474
|
-
const { sdkName = 'js', sdkVersion = "1.20.
|
|
13489
|
+
const { sdkName = 'js', sdkVersion = "1.20.2", ...extras } = clientAppIdentifier;
|
|
13475
13490
|
this.cachedUserAgent = [
|
|
13476
13491
|
`stream-video-${sdkName}-v${sdkVersion}`,
|
|
13477
13492
|
...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
|