@stream-io/video-client 1.11.9 → 1.11.11
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 +25 -19
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +25 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +25 -19
- package/dist/index.es.js.map +1 -1
- package/dist/src/types.d.ts +0 -2
- package/package.json +1 -1
- package/src/Call.ts +4 -3
- package/src/devices/InputMediaDeviceManager.ts +0 -1
- package/src/devices/devices.ts +30 -16
- package/src/events/call.ts +5 -3
- package/src/types.ts +0 -2
package/dist/src/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/Call.ts
CHANGED
|
@@ -496,7 +496,7 @@ export class Call {
|
|
|
496
496
|
* Leave the call and stop the media streams that were published by the call.
|
|
497
497
|
*/
|
|
498
498
|
leave = async ({
|
|
499
|
-
reject
|
|
499
|
+
reject,
|
|
500
500
|
reason = 'user is leaving the call',
|
|
501
501
|
}: CallLeaveOptions = {}) => {
|
|
502
502
|
await withoutConcurrency(this.joinLeaveConcurrencyTag, async () => {
|
|
@@ -516,13 +516,14 @@ export class Call {
|
|
|
516
516
|
await waitUntilCallJoined();
|
|
517
517
|
}
|
|
518
518
|
|
|
519
|
-
if (callingState === CallingState.RINGING) {
|
|
519
|
+
if (callingState === CallingState.RINGING && reject !== false) {
|
|
520
520
|
if (reject) {
|
|
521
521
|
await this.reject(reason);
|
|
522
522
|
} else {
|
|
523
|
+
// if reject was undefined, we still have to cancel the call automatically
|
|
524
|
+
// when I am the creator and everyone else left the call
|
|
523
525
|
const hasOtherParticipants = this.state.remoteParticipants.length > 0;
|
|
524
526
|
if (this.isCreatedByMe && !hasOtherParticipants) {
|
|
525
|
-
// I'm the one who started the call, so I should cancel it when there are no other participants.
|
|
526
527
|
await this.reject('cancel');
|
|
527
528
|
}
|
|
528
529
|
}
|
package/src/devices/devices.ts
CHANGED
|
@@ -184,7 +184,7 @@ export const getAudioStream = async (
|
|
|
184
184
|
const constraints: MediaStreamConstraints = {
|
|
185
185
|
audio: {
|
|
186
186
|
...audioDeviceConstraints.audio,
|
|
187
|
-
...
|
|
187
|
+
...trackConstraints,
|
|
188
188
|
},
|
|
189
189
|
};
|
|
190
190
|
|
|
@@ -195,6 +195,20 @@ export const getAudioStream = async (
|
|
|
195
195
|
});
|
|
196
196
|
return await getStream(constraints);
|
|
197
197
|
} catch (error) {
|
|
198
|
+
if (
|
|
199
|
+
error instanceof DOMException &&
|
|
200
|
+
error.name === 'OverconstrainedError' &&
|
|
201
|
+
trackConstraints?.deviceId
|
|
202
|
+
) {
|
|
203
|
+
const { deviceId, ...relaxedContraints } = trackConstraints;
|
|
204
|
+
getLogger(['devices'])(
|
|
205
|
+
'warn',
|
|
206
|
+
'Failed to get audio stream, will try again with relaxed contraints',
|
|
207
|
+
{ error, constraints, relaxedContraints },
|
|
208
|
+
);
|
|
209
|
+
return getAudioStream(relaxedContraints);
|
|
210
|
+
}
|
|
211
|
+
|
|
198
212
|
getLogger(['devices'])('error', 'Failed to get audio stream', {
|
|
199
213
|
error,
|
|
200
214
|
constraints,
|
|
@@ -217,7 +231,7 @@ export const getVideoStream = async (
|
|
|
217
231
|
const constraints: MediaStreamConstraints = {
|
|
218
232
|
video: {
|
|
219
233
|
...videoDeviceConstraints.video,
|
|
220
|
-
...
|
|
234
|
+
...trackConstraints,
|
|
221
235
|
},
|
|
222
236
|
};
|
|
223
237
|
try {
|
|
@@ -227,6 +241,20 @@ export const getVideoStream = async (
|
|
|
227
241
|
});
|
|
228
242
|
return await getStream(constraints);
|
|
229
243
|
} catch (error) {
|
|
244
|
+
if (
|
|
245
|
+
error instanceof DOMException &&
|
|
246
|
+
error.name === 'OverconstrainedError' &&
|
|
247
|
+
trackConstraints?.deviceId
|
|
248
|
+
) {
|
|
249
|
+
const { deviceId, ...relaxedContraints } = trackConstraints;
|
|
250
|
+
getLogger(['devices'])(
|
|
251
|
+
'warn',
|
|
252
|
+
'Failed to get video stream, will try again with relaxed contraints',
|
|
253
|
+
{ error, constraints, relaxedContraints },
|
|
254
|
+
);
|
|
255
|
+
return getVideoStream(relaxedContraints);
|
|
256
|
+
}
|
|
257
|
+
|
|
230
258
|
getLogger(['devices'])('error', 'Failed to get video stream', {
|
|
231
259
|
error,
|
|
232
260
|
constraints,
|
|
@@ -235,20 +263,6 @@ export const getVideoStream = async (
|
|
|
235
263
|
}
|
|
236
264
|
};
|
|
237
265
|
|
|
238
|
-
function normalizeContraints(constraints: MediaTrackConstraints | undefined) {
|
|
239
|
-
if (
|
|
240
|
-
constraints?.deviceId === 'default' ||
|
|
241
|
-
(typeof constraints?.deviceId === 'object' &&
|
|
242
|
-
'exact' in constraints.deviceId &&
|
|
243
|
-
constraints.deviceId.exact === 'default')
|
|
244
|
-
) {
|
|
245
|
-
const { deviceId, ...contraintsWithoutDeviceId } = constraints;
|
|
246
|
-
return contraintsWithoutDeviceId;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return constraints;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
266
|
/**
|
|
253
267
|
* Prompts the user for a permission to share a screen.
|
|
254
268
|
* If the user grants the permission, a screen sharing stream is returned. Throws otherwise.
|
package/src/events/call.ts
CHANGED
|
@@ -79,9 +79,11 @@ export const watchCallEnded = (call: Call) => {
|
|
|
79
79
|
callingState !== CallingState.IDLE &&
|
|
80
80
|
callingState !== CallingState.LEFT
|
|
81
81
|
) {
|
|
82
|
-
call
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
call
|
|
83
|
+
.leave({ reason: 'call.ended event received', reject: false })
|
|
84
|
+
.catch((err) => {
|
|
85
|
+
call.logger('error', 'Failed to leave call after call.ended ', err);
|
|
86
|
+
});
|
|
85
87
|
}
|
|
86
88
|
};
|
|
87
89
|
};
|
package/src/types.ts
CHANGED