@stream-io/video-client 1.20.0 → 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 +14 -0
- package/dist/index.browser.es.js +157 -128
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +157 -128
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +157 -128
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +1 -1
- package/dist/src/devices/BrowserPermission.d.ts +1 -0
- package/dist/src/devices/InputMediaDeviceManagerState.d.ts +7 -2
- 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/devices/BrowserPermission.ts +4 -0
- package/src/devices/InputMediaDeviceManager.ts +135 -123
- package/src/devices/InputMediaDeviceManagerState.ts +12 -2
- package/src/devices/__tests__/mocks.ts +1 -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/stats/SfuStatsReporter.ts +4 -4
- package/src/store/stateStore.ts +1 -1
- package/src/types.ts +8 -2
package/src/events/call.ts
CHANGED
|
@@ -58,12 +58,16 @@ export const watchCallRejected = (call: Call) => {
|
|
|
58
58
|
.every((m) => rejectedBy[m.user_id]);
|
|
59
59
|
if (everyoneElseRejected) {
|
|
60
60
|
call.logger('info', 'everyone rejected, leaving the call');
|
|
61
|
-
await call.leave({
|
|
61
|
+
await call.leave({
|
|
62
|
+
reject: true,
|
|
63
|
+
reason: 'cancel',
|
|
64
|
+
message: 'ring: everyone rejected',
|
|
65
|
+
});
|
|
62
66
|
}
|
|
63
67
|
} else {
|
|
64
68
|
if (rejectedBy[eventCall.created_by.id]) {
|
|
65
69
|
call.logger('info', 'call creator rejected, leaving call');
|
|
66
|
-
await call.leave({
|
|
70
|
+
await call.leave({ message: 'ring: creator rejected' });
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
};
|
|
@@ -80,7 +84,7 @@ export const watchCallEnded = (call: Call) => {
|
|
|
80
84
|
callingState !== CallingState.LEFT
|
|
81
85
|
) {
|
|
82
86
|
call
|
|
83
|
-
.leave({
|
|
87
|
+
.leave({ message: 'call.ended event received', reject: false })
|
|
84
88
|
.catch((err) => {
|
|
85
89
|
call.logger('error', 'Failed to leave call after call.ended ', err);
|
|
86
90
|
});
|
|
@@ -100,7 +104,7 @@ export const watchSfuCallEnded = (call: Call) => {
|
|
|
100
104
|
// update the call state to reflect the call has ended.
|
|
101
105
|
call.state.setEndedAt(new Date());
|
|
102
106
|
const reason = CallEndedReason[e.reason];
|
|
103
|
-
await call.leave({
|
|
107
|
+
await call.leave({ message: `callEnded received: ${reason}` });
|
|
104
108
|
} catch (err) {
|
|
105
109
|
call.logger(
|
|
106
110
|
'error',
|
package/src/events/internal.ts
CHANGED
|
@@ -55,7 +55,7 @@ export const watchLiveEnded = (dispatcher: Dispatcher, call: Call) => {
|
|
|
55
55
|
|
|
56
56
|
call.state.setBackstage(true);
|
|
57
57
|
if (!call.permissionsContext.hasPermission(OwnCapability.JOIN_BACKSTAGE)) {
|
|
58
|
-
call.leave({
|
|
58
|
+
call.leave({ message: 'live ended' }).catch((err) => {
|
|
59
59
|
call.logger('error', 'Failed to leave call after live ended', err);
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -3475,6 +3475,7 @@ export const FrameRecordingSettingsRequestQualityEnum = {
|
|
|
3475
3475
|
_720P: '720p',
|
|
3476
3476
|
_1080P: '1080p',
|
|
3477
3477
|
_1440P: '1440p',
|
|
3478
|
+
_2160P: '2160p',
|
|
3478
3479
|
} as const;
|
|
3479
3480
|
export type FrameRecordingSettingsRequestQualityEnum =
|
|
3480
3481
|
(typeof FrameRecordingSettingsRequestQualityEnum)[keyof typeof FrameRecordingSettingsRequestQualityEnum];
|
|
@@ -5197,11 +5198,13 @@ export const RTMPBroadcastRequestQualityEnum = {
|
|
|
5197
5198
|
_720P: '720p',
|
|
5198
5199
|
_1080P: '1080p',
|
|
5199
5200
|
_1440P: '1440p',
|
|
5201
|
+
_2160P: '2160p',
|
|
5200
5202
|
PORTRAIT_360X640: 'portrait-360x640',
|
|
5201
5203
|
PORTRAIT_480X854: 'portrait-480x854',
|
|
5202
5204
|
PORTRAIT_720X1280: 'portrait-720x1280',
|
|
5203
5205
|
PORTRAIT_1080X1920: 'portrait-1080x1920',
|
|
5204
5206
|
PORTRAIT_1440X2560: 'portrait-1440x2560',
|
|
5207
|
+
PORTRAIT_2160X3840: 'portrait-2160x3840',
|
|
5205
5208
|
} as const;
|
|
5206
5209
|
export type RTMPBroadcastRequestQualityEnum =
|
|
5207
5210
|
(typeof RTMPBroadcastRequestQualityEnum)[keyof typeof RTMPBroadcastRequestQualityEnum];
|
|
@@ -5248,11 +5251,13 @@ export const RTMPSettingsRequestQualityEnum = {
|
|
|
5248
5251
|
_720P: '720p',
|
|
5249
5252
|
_1080P: '1080p',
|
|
5250
5253
|
_1440P: '1440p',
|
|
5254
|
+
_2160P: '2160p',
|
|
5251
5255
|
PORTRAIT_360X640: 'portrait-360x640',
|
|
5252
5256
|
PORTRAIT_480X854: 'portrait-480x854',
|
|
5253
5257
|
PORTRAIT_720X1280: 'portrait-720x1280',
|
|
5254
5258
|
PORTRAIT_1080X1920: 'portrait-1080x1920',
|
|
5255
5259
|
PORTRAIT_1440X2560: 'portrait-1440x2560',
|
|
5260
|
+
PORTRAIT_2160X3840: 'portrait-2160x3840',
|
|
5256
5261
|
} as const;
|
|
5257
5262
|
export type RTMPSettingsRequestQualityEnum =
|
|
5258
5263
|
(typeof RTMPSettingsRequestQualityEnum)[keyof typeof RTMPSettingsRequestQualityEnum];
|
|
@@ -5353,11 +5358,13 @@ export const RecordSettingsRequestQualityEnum = {
|
|
|
5353
5358
|
_720P: '720p',
|
|
5354
5359
|
_1080P: '1080p',
|
|
5355
5360
|
_1440P: '1440p',
|
|
5361
|
+
_2160P: '2160p',
|
|
5356
5362
|
PORTRAIT_360X640: 'portrait-360x640',
|
|
5357
5363
|
PORTRAIT_480X854: 'portrait-480x854',
|
|
5358
5364
|
PORTRAIT_720X1280: 'portrait-720x1280',
|
|
5359
5365
|
PORTRAIT_1080X1920: 'portrait-1080x1920',
|
|
5360
5366
|
PORTRAIT_1440X2560: 'portrait-1440x2560',
|
|
5367
|
+
PORTRAIT_2160X3840: 'portrait-2160x3840',
|
|
5361
5368
|
} as const;
|
|
5362
5369
|
export type RecordSettingsRequestQualityEnum =
|
|
5363
5370
|
(typeof RecordSettingsRequestQualityEnum)[keyof typeof RecordSettingsRequestQualityEnum];
|
|
@@ -83,11 +83,11 @@ export class SfuStatsReporter {
|
|
|
83
83
|
device: CameraManager | MicrophoneManager,
|
|
84
84
|
kind: 'mic' | 'camera',
|
|
85
85
|
) => {
|
|
86
|
-
const {
|
|
86
|
+
const { browserPermissionState$ } = device.state;
|
|
87
87
|
this.unsubscribeDevicePermissionsSubscription?.();
|
|
88
88
|
this.unsubscribeDevicePermissionsSubscription = createSubscription(
|
|
89
|
-
combineLatest([
|
|
90
|
-
([
|
|
89
|
+
combineLatest([browserPermissionState$, this.state.ownCapabilities$]),
|
|
90
|
+
([browserPermissionState, ownCapabilities]) => {
|
|
91
91
|
// cleanup the previous listDevices() subscription in case
|
|
92
92
|
// permissions or capabilities have changed.
|
|
93
93
|
// we will subscribe again if everything is in order.
|
|
@@ -96,7 +96,7 @@ export class SfuStatsReporter {
|
|
|
96
96
|
kind === 'mic'
|
|
97
97
|
? ownCapabilities.includes(OwnCapability.SEND_AUDIO)
|
|
98
98
|
: ownCapabilities.includes(OwnCapability.SEND_VIDEO);
|
|
99
|
-
if (
|
|
99
|
+
if (browserPermissionState !== 'granted' || !hasCapability) {
|
|
100
100
|
this.inputDevices.set(kind, {
|
|
101
101
|
currentDevice: '',
|
|
102
102
|
availableDevices: [],
|
package/src/store/stateStore.ts
CHANGED
|
@@ -29,7 +29,7 @@ export class StreamVideoWriteableStateStore {
|
|
|
29
29
|
|
|
30
30
|
logger('info', `User disconnected, leaving call: ${call.cid}`);
|
|
31
31
|
await call
|
|
32
|
-
.leave({
|
|
32
|
+
.leave({ message: 'client.disconnectUser() called' })
|
|
33
33
|
.catch((err) => {
|
|
34
34
|
logger('error', `Error leaving call: ${call.cid}`, err);
|
|
35
35
|
});
|
package/src/types.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { StreamClient } from './coordinator/connection/client';
|
|
|
12
12
|
import type { Comparator } from './sorting';
|
|
13
13
|
import type { StreamVideoWriteableStateStore } from './store';
|
|
14
14
|
import { AxiosError } from 'axios';
|
|
15
|
+
import { RejectReason } from './coordinator/connection/types';
|
|
15
16
|
|
|
16
17
|
export type StreamReaction = Pick<
|
|
17
18
|
ReactionResponse,
|
|
@@ -225,9 +226,14 @@ export type CallLeaveOptions = {
|
|
|
225
226
|
|
|
226
227
|
/**
|
|
227
228
|
* The reason for leaving the call.
|
|
228
|
-
* This will be sent
|
|
229
|
+
* This will be sent as the `reason` field in the `call.rejected` event.
|
|
229
230
|
*/
|
|
230
|
-
reason?:
|
|
231
|
+
reason?: RejectReason;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* You can provide extra information about why the call is being left and/or rejected, used for logging purposes.
|
|
235
|
+
*/
|
|
236
|
+
message?: string;
|
|
231
237
|
};
|
|
232
238
|
|
|
233
239
|
/**
|