@stream-io/video-client 0.4.3 → 0.4.5
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 +37 -44
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +37 -44
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +37 -44
- package/dist/index.es.js.map +1 -1
- package/dist/src/devices/CameraManager.d.ts +18 -2
- package/package.json +2 -2
- package/src/Call.ts +9 -11
- package/src/devices/CameraManager.ts +32 -8
- package/src/devices/__tests__/CameraManager.test.ts +17 -0
- package/src/helpers/DynascaleManager.ts +9 -0
- package/src/rtc/flows/join.ts +0 -33
package/dist/index.cjs.js
CHANGED
|
@@ -9160,19 +9160,6 @@ const doJoin = async (httpClient, type, id, data) => {
|
|
|
9160
9160
|
...data,
|
|
9161
9161
|
location,
|
|
9162
9162
|
};
|
|
9163
|
-
// FIXME OL: remove this once cascading is enabled by default
|
|
9164
|
-
const cascadingModeParams = getCascadingModeParams();
|
|
9165
|
-
if (cascadingModeParams) {
|
|
9166
|
-
// FIXME OL: remove after SFU migration is done
|
|
9167
|
-
if (data?.migrating_from && cascadingModeParams['next_sfu_id']) {
|
|
9168
|
-
cascadingModeParams['sfu_id'] = cascadingModeParams['next_sfu_id'];
|
|
9169
|
-
}
|
|
9170
|
-
return httpClient.doAxiosRequest('post', `/call/${type}/${id}/join`, request, {
|
|
9171
|
-
params: {
|
|
9172
|
-
...cascadingModeParams,
|
|
9173
|
-
},
|
|
9174
|
-
});
|
|
9175
|
-
}
|
|
9176
9163
|
return httpClient.post(`/call/${type}/${id}/join`, request);
|
|
9177
9164
|
};
|
|
9178
9165
|
const toRtcConfiguration = (config) => {
|
|
@@ -9187,20 +9174,6 @@ const toRtcConfiguration = (config) => {
|
|
|
9187
9174
|
};
|
|
9188
9175
|
return rtcConfig;
|
|
9189
9176
|
};
|
|
9190
|
-
const getCascadingModeParams = () => {
|
|
9191
|
-
if (typeof window === 'undefined')
|
|
9192
|
-
return null;
|
|
9193
|
-
const params = new URLSearchParams(window.location?.search);
|
|
9194
|
-
const cascadingEnabled = params.get('cascading') !== null;
|
|
9195
|
-
if (cascadingEnabled) {
|
|
9196
|
-
const rawParams = {};
|
|
9197
|
-
params.forEach((value, key) => {
|
|
9198
|
-
rawParams[key] = value;
|
|
9199
|
-
});
|
|
9200
|
-
return rawParams;
|
|
9201
|
-
}
|
|
9202
|
-
return null;
|
|
9203
|
-
};
|
|
9204
9177
|
/**
|
|
9205
9178
|
* Reconciles the local state of the source participant into the target participant.
|
|
9206
9179
|
*
|
|
@@ -9811,6 +9784,14 @@ class DynascaleManager {
|
|
|
9811
9784
|
audioElement.play().catch((e) => {
|
|
9812
9785
|
this.logger('warn', `Failed to play stream`, e);
|
|
9813
9786
|
});
|
|
9787
|
+
// audio output device shall be set after the audio element is played
|
|
9788
|
+
// otherwise, the browser will not pick it up, and will always
|
|
9789
|
+
// play audio through the system's default device
|
|
9790
|
+
const { selectedDevice } = this.call.speaker.state;
|
|
9791
|
+
if (selectedDevice && 'setSinkId' in audioElement) {
|
|
9792
|
+
// @ts-expect-error setSinkId is not yet in the lib
|
|
9793
|
+
audioElement.setSinkId(selectedDevice);
|
|
9794
|
+
}
|
|
9814
9795
|
}
|
|
9815
9796
|
});
|
|
9816
9797
|
});
|
|
@@ -10625,8 +10606,9 @@ class CameraManager extends InputMediaDeviceManager {
|
|
|
10625
10606
|
};
|
|
10626
10607
|
}
|
|
10627
10608
|
/**
|
|
10628
|
-
* Select the camera
|
|
10629
|
-
*
|
|
10609
|
+
* Select the camera direction.
|
|
10610
|
+
*
|
|
10611
|
+
* @param direction the direction of the camera to select.
|
|
10630
10612
|
*/
|
|
10631
10613
|
async selectDirection(direction) {
|
|
10632
10614
|
this.state.setDirection(direction);
|
|
@@ -10656,6 +10638,7 @@ class CameraManager extends InputMediaDeviceManager {
|
|
|
10656
10638
|
}
|
|
10657
10639
|
catch (error) {
|
|
10658
10640
|
// couldn't enable device, target resolution will be applied the next time user attempts to start the device
|
|
10641
|
+
this.logger('warn', 'could not apply target resolution', error);
|
|
10659
10642
|
}
|
|
10660
10643
|
}
|
|
10661
10644
|
if (this.state.status === 'enabled') {
|
|
@@ -10663,11 +10646,21 @@ class CameraManager extends InputMediaDeviceManager {
|
|
|
10663
10646
|
.mediaStream.getVideoTracks()[0]
|
|
10664
10647
|
?.getSettings();
|
|
10665
10648
|
if (width !== this.targetResolution.width ||
|
|
10666
|
-
height !== this.targetResolution.height)
|
|
10649
|
+
height !== this.targetResolution.height) {
|
|
10667
10650
|
await this.applySettingsToStream();
|
|
10668
|
-
|
|
10651
|
+
this.logger('debug', `${width}x${height} target resolution applied to media stream`);
|
|
10652
|
+
}
|
|
10669
10653
|
}
|
|
10670
10654
|
}
|
|
10655
|
+
/**
|
|
10656
|
+
* Sets the preferred codec for encoding the video.
|
|
10657
|
+
*
|
|
10658
|
+
* @internal internal use only, not part of the public API.
|
|
10659
|
+
* @param codec the codec to use for encoding the video.
|
|
10660
|
+
*/
|
|
10661
|
+
setPreferredCodec(codec) {
|
|
10662
|
+
this.preferredCodec = codec;
|
|
10663
|
+
}
|
|
10671
10664
|
getDevices() {
|
|
10672
10665
|
return getVideoDevices();
|
|
10673
10666
|
}
|
|
@@ -10683,7 +10676,9 @@ class CameraManager extends InputMediaDeviceManager {
|
|
|
10683
10676
|
return getVideoStream(constraints);
|
|
10684
10677
|
}
|
|
10685
10678
|
publishStream(stream) {
|
|
10686
|
-
return this.call.publishVideoStream(stream
|
|
10679
|
+
return this.call.publishVideoStream(stream, {
|
|
10680
|
+
preferredCodec: this.preferredCodec,
|
|
10681
|
+
});
|
|
10687
10682
|
}
|
|
10688
10683
|
stopPublishStream(stopTracks) {
|
|
10689
10684
|
return this.call.stopPublish(TrackType.VIDEO, stopTracks);
|
|
@@ -11266,13 +11261,6 @@ class Call {
|
|
|
11266
11261
|
this.state.setCallingState(callingState);
|
|
11267
11262
|
throw error;
|
|
11268
11263
|
}
|
|
11269
|
-
// FIXME OL: remove once cascading is implemented
|
|
11270
|
-
if (typeof window !== 'undefined' && window.location?.search) {
|
|
11271
|
-
const params = new URLSearchParams(window.location.search);
|
|
11272
|
-
sfuServer.url = params.get('sfuUrl') || sfuServer.url;
|
|
11273
|
-
sfuServer.ws_endpoint = params.get('sfuWsUrl') || sfuServer.ws_endpoint;
|
|
11274
|
-
sfuServer.edge_name = params.get('sfuUrl') || sfuServer.edge_name;
|
|
11275
|
-
}
|
|
11276
11264
|
const previousSfuClient = this.sfuClient;
|
|
11277
11265
|
const sfuClient = (this.sfuClient = new StreamSfuClient({
|
|
11278
11266
|
dispatcher: this.dispatcher,
|
|
@@ -11339,8 +11327,11 @@ class Call {
|
|
|
11339
11327
|
// restore previous publishing state
|
|
11340
11328
|
if (audioStream)
|
|
11341
11329
|
await this.publishAudioStream(audioStream);
|
|
11342
|
-
if (videoStream)
|
|
11343
|
-
await this.publishVideoStream(videoStream
|
|
11330
|
+
if (videoStream) {
|
|
11331
|
+
await this.publishVideoStream(videoStream, {
|
|
11332
|
+
preferredCodec: this.camera.preferredCodec,
|
|
11333
|
+
});
|
|
11334
|
+
}
|
|
11344
11335
|
if (screenShare)
|
|
11345
11336
|
await this.publishScreenShareStream(screenShare);
|
|
11346
11337
|
}
|
|
@@ -12366,9 +12357,11 @@ class Call {
|
|
|
12366
12357
|
if (this.camera.state.status === 'enabled' &&
|
|
12367
12358
|
this.camera.state.mediaStream &&
|
|
12368
12359
|
!this.publisher?.isPublishing(TrackType.VIDEO)) {
|
|
12369
|
-
await this.publishVideoStream(this.camera.state.mediaStream
|
|
12360
|
+
await this.publishVideoStream(this.camera.state.mediaStream, {
|
|
12361
|
+
preferredCodec: this.camera.preferredCodec,
|
|
12362
|
+
});
|
|
12370
12363
|
}
|
|
12371
|
-
// Start camera if backend config
|
|
12364
|
+
// Start camera if backend config specifies, and there is no local setting
|
|
12372
12365
|
if (this.camera.state.status === undefined &&
|
|
12373
12366
|
this.state.settings?.video.camera_default_on) {
|
|
12374
12367
|
await this.camera.enable();
|
|
@@ -13984,7 +13977,7 @@ class StreamClient {
|
|
|
13984
13977
|
});
|
|
13985
13978
|
};
|
|
13986
13979
|
this.getUserAgent = () => {
|
|
13987
|
-
const version = "0.4.
|
|
13980
|
+
const version = "0.4.5" ;
|
|
13988
13981
|
return (this.userAgent ||
|
|
13989
13982
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
13990
13983
|
};
|