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