@stream-io/video-client 0.0.7 → 0.0.9
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 -10
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +37 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +37 -10
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +6 -0
- package/dist/src/rtc/publisher.d.ts +6 -0
- package/package.json +1 -1
- package/src/Call.ts +25 -6
- package/src/rtc/publisher.ts +14 -0
- package/src/rtc/signal.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.0.9](https://github.com/GetStream/stream-video-js/compare/client0.0.8...client0.0.9) (2023-06-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* prevent misleading "stop publish" log messages upon call instantiation ([#629](https://github.com/GetStream/stream-video-js/issues/629)) ([af40939](https://github.com/GetStream/stream-video-js/commit/af4093966c408d37fbf59c4c8fafd22756aa8888))
|
|
11
|
+
|
|
12
|
+
### [0.0.8](https://github.com/GetStream/stream-video-js/compare/client0.0.7...client0.0.8) (2023-06-09)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **react-native:** support reconnection flow ([#458](https://github.com/GetStream/stream-video-js/issues/458)) ([89f2dda](https://github.com/GetStream/stream-video-js/commit/89f2ddafd1397d91f8ddea5a3c69dd62ae027313))
|
|
18
|
+
|
|
5
19
|
### [0.0.7](https://github.com/GetStream/stream-video-js/compare/client0.0.6...client0.0.7) (2023-06-08)
|
|
6
20
|
|
|
7
21
|
|
package/dist/index.browser.es.js
CHANGED
|
@@ -5692,6 +5692,19 @@ class Publisher {
|
|
|
5692
5692
|
return this.notifyTrackMuteStateChanged(undefined, transceiver.sender.track, trackType, true);
|
|
5693
5693
|
}
|
|
5694
5694
|
});
|
|
5695
|
+
/**
|
|
5696
|
+
* Returns true if the given track type is currently being published to the SFU.
|
|
5697
|
+
*
|
|
5698
|
+
* @param trackType the track type to check.
|
|
5699
|
+
*/
|
|
5700
|
+
this.isPublishing = (trackType) => {
|
|
5701
|
+
const transceiverForTrackType = this.transceiverRegistry[trackType];
|
|
5702
|
+
if (transceiverForTrackType && transceiverForTrackType.sender) {
|
|
5703
|
+
const sender = transceiverForTrackType.sender;
|
|
5704
|
+
return !!sender.track && sender.track.readyState === 'live';
|
|
5705
|
+
}
|
|
5706
|
+
return false;
|
|
5707
|
+
};
|
|
5695
5708
|
this.notifyTrackMuteStateChanged = (mediaStream, track, trackType, isMuted) => __awaiter(this, void 0, void 0, function* () {
|
|
5696
5709
|
yield this.sfuClient.updateMuteState(trackType, isMuted);
|
|
5697
5710
|
const audioOrVideoOrScreenShareStream = trackTypeToParticipantStreamKey(trackType);
|
|
@@ -5969,13 +5982,13 @@ const createWebSocketSignalChannel = (opts) => {
|
|
|
5969
5982
|
const ws = new WebSocket(endpoint);
|
|
5970
5983
|
ws.binaryType = 'arraybuffer'; // do we need this?
|
|
5971
5984
|
ws.addEventListener('error', (e) => {
|
|
5972
|
-
console.
|
|
5985
|
+
console.log('Signaling WS channel error', e);
|
|
5973
5986
|
});
|
|
5974
5987
|
ws.addEventListener('close', (e) => {
|
|
5975
|
-
console.
|
|
5988
|
+
console.log('Signaling WS channel is closed', e);
|
|
5976
5989
|
});
|
|
5977
5990
|
ws.addEventListener('open', (e) => {
|
|
5978
|
-
console.log('
|
|
5991
|
+
console.log('Signaling WS channel is open', e);
|
|
5979
5992
|
});
|
|
5980
5993
|
if (onMessage) {
|
|
5981
5994
|
ws.addEventListener('message', (e) => {
|
|
@@ -8318,6 +8331,13 @@ const getSdkInfo = () => {
|
|
|
8318
8331
|
* An object representation of a `Call`.
|
|
8319
8332
|
*/
|
|
8320
8333
|
class Call {
|
|
8334
|
+
/**
|
|
8335
|
+
* A promise that exposes the reconnection logic
|
|
8336
|
+
* The use-case is for the react-native platform where online/offline events are not available in the window
|
|
8337
|
+
*/
|
|
8338
|
+
get rejoin() {
|
|
8339
|
+
return this.rejoinPromise;
|
|
8340
|
+
}
|
|
8321
8341
|
/**
|
|
8322
8342
|
* Constructs a new `Call` instance.
|
|
8323
8343
|
*
|
|
@@ -8363,6 +8383,7 @@ class Call {
|
|
|
8363
8383
|
if (callingState === CallingState.LEFT) {
|
|
8364
8384
|
throw new Error('Cannot leave call that has already been left.');
|
|
8365
8385
|
}
|
|
8386
|
+
this.rejoinPromise = undefined;
|
|
8366
8387
|
if (this.ringing) {
|
|
8367
8388
|
// I'm the one who started the call, so I should cancel it.
|
|
8368
8389
|
const hasOtherParticipants = this.state.remoteParticipants.length > 0;
|
|
@@ -8555,7 +8576,7 @@ class Call {
|
|
|
8555
8576
|
yield sleep(retryInterval(this.reconnectAttempts));
|
|
8556
8577
|
yield this.join(data);
|
|
8557
8578
|
console.log(`Rejoin: ${this.reconnectAttempts} successful!`);
|
|
8558
|
-
if (localParticipant) {
|
|
8579
|
+
if (localParticipant && !isReactNative()) {
|
|
8559
8580
|
const { audioStream, videoStream, screenShareStream: screenShare, } = localParticipant;
|
|
8560
8581
|
// restore previous publishing state
|
|
8561
8582
|
if (audioStream)
|
|
@@ -8567,6 +8588,7 @@ class Call {
|
|
|
8567
8588
|
}
|
|
8568
8589
|
console.log(`Rejoin: state restored ${this.reconnectAttempts}`);
|
|
8569
8590
|
});
|
|
8591
|
+
this.rejoinPromise = rejoin;
|
|
8570
8592
|
// reconnect if the connection was closed unexpectedly. example:
|
|
8571
8593
|
// - SFU crash or restart
|
|
8572
8594
|
// - network change
|
|
@@ -8579,6 +8601,9 @@ class Call {
|
|
|
8579
8601
|
// e.g., the user has been blocked by an admin or moderator
|
|
8580
8602
|
if (e.code === KnownCodes.WS_POLICY_VIOLATION)
|
|
8581
8603
|
return;
|
|
8604
|
+
// do nothing for react-native as its handled by SDK
|
|
8605
|
+
if (isReactNative())
|
|
8606
|
+
return;
|
|
8582
8607
|
if (this.reconnectAttempts < this.maxReconnectAttempts) {
|
|
8583
8608
|
rejoin().catch(() => {
|
|
8584
8609
|
console.log(`Rejoin failed for ${this.reconnectAttempts} times. Giving up.`);
|
|
@@ -9279,20 +9304,22 @@ class Call {
|
|
|
9279
9304
|
createSubscription(this.state.ownCapabilities$, (ownCapabilities) => {
|
|
9280
9305
|
// update the permission context.
|
|
9281
9306
|
this.permissionsContext.setPermissions(ownCapabilities);
|
|
9307
|
+
if (!this.publisher)
|
|
9308
|
+
return;
|
|
9282
9309
|
// check if the user still has publishing permissions and stop publishing if not.
|
|
9283
9310
|
const permissionToTrackType = {
|
|
9284
9311
|
[OwnCapability.SEND_AUDIO]: TrackType.AUDIO,
|
|
9285
9312
|
[OwnCapability.SEND_VIDEO]: TrackType.VIDEO,
|
|
9286
9313
|
[OwnCapability.SCREENSHARE]: TrackType.SCREEN_SHARE,
|
|
9287
9314
|
};
|
|
9288
|
-
|
|
9315
|
+
for (const [permission, trackType] of Object.entries(permissionToTrackType)) {
|
|
9289
9316
|
const hasPermission = this.permissionsContext.hasPermission(permission);
|
|
9290
|
-
if (!hasPermission) {
|
|
9291
|
-
this.stopPublish(
|
|
9292
|
-
console.error('Error stopping publish',
|
|
9317
|
+
if (!hasPermission && this.publisher.isPublishing(trackType)) {
|
|
9318
|
+
this.stopPublish(trackType).catch((err) => {
|
|
9319
|
+
console.error('Error stopping publish', trackType, err);
|
|
9293
9320
|
});
|
|
9294
9321
|
}
|
|
9295
|
-
}
|
|
9322
|
+
}
|
|
9296
9323
|
}),
|
|
9297
9324
|
// handles the case when the user is blocked by the call owner.
|
|
9298
9325
|
createSubscription(this.state.metadata$, (metadata) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -10993,7 +11020,7 @@ class StreamClient {
|
|
|
10993
11020
|
}
|
|
10994
11021
|
getUserAgent() {
|
|
10995
11022
|
return (this.userAgent ||
|
|
10996
|
-
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.
|
|
11023
|
+
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.8"}`);
|
|
10997
11024
|
}
|
|
10998
11025
|
setUserAgent(userAgent) {
|
|
10999
11026
|
this.userAgent = userAgent;
|