@stream-io/video-client 1.18.0 → 1.18.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 +16 -0
- package/dist/index.browser.es.js +24 -6
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +24 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +24 -6
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/Call.ts +21 -3
- package/src/rtc/Publisher.ts +9 -1
package/package.json
CHANGED
package/src/Call.ts
CHANGED
|
@@ -842,8 +842,14 @@ export class Call {
|
|
|
842
842
|
this.credentials = joinResponse.credentials;
|
|
843
843
|
statsOptions = joinResponse.stats_options;
|
|
844
844
|
} catch (error) {
|
|
845
|
-
//
|
|
846
|
-
|
|
845
|
+
// prevent triggering reconnect flow if the state is OFFLINE
|
|
846
|
+
const avoidRestoreState =
|
|
847
|
+
this.state.callingState === CallingState.OFFLINE;
|
|
848
|
+
|
|
849
|
+
if (!avoidRestoreState) {
|
|
850
|
+
// restore the previous call state if the join-flow fails
|
|
851
|
+
this.state.setCallingState(callingState);
|
|
852
|
+
}
|
|
847
853
|
throw error;
|
|
848
854
|
}
|
|
849
855
|
}
|
|
@@ -1197,7 +1203,10 @@ export class Call {
|
|
|
1197
1203
|
this.ringingSubject.next(true);
|
|
1198
1204
|
}
|
|
1199
1205
|
|
|
1200
|
-
|
|
1206
|
+
const isReconnecting =
|
|
1207
|
+
this.reconnectStrategy !== WebsocketReconnectStrategy.UNSPECIFIED;
|
|
1208
|
+
|
|
1209
|
+
if (!isReconnecting && this.ringing && !this.isCreatedByMe) {
|
|
1201
1210
|
// signals other users that I have accepted the incoming call.
|
|
1202
1211
|
await this.accept();
|
|
1203
1212
|
}
|
|
@@ -1298,6 +1307,15 @@ export class Call {
|
|
|
1298
1307
|
}
|
|
1299
1308
|
break; // do-while loop, reconnection worked, exit the loop
|
|
1300
1309
|
} catch (error) {
|
|
1310
|
+
if (this.state.callingState === CallingState.OFFLINE) {
|
|
1311
|
+
this.logger(
|
|
1312
|
+
'trace',
|
|
1313
|
+
`[Reconnect] Can't reconnect while offline, stopping reconnection attempts`,
|
|
1314
|
+
);
|
|
1315
|
+
break;
|
|
1316
|
+
// we don't need to handle the error if the call is offline
|
|
1317
|
+
// network change event will trigger the reconnection
|
|
1318
|
+
}
|
|
1301
1319
|
if (error instanceof ErrorFromResponse && error.unrecoverable) {
|
|
1302
1320
|
this.logger(
|
|
1303
1321
|
'warn',
|
package/src/rtc/Publisher.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { isSvcCodec } from './codecs';
|
|
|
19
19
|
import { isAudioTrackType } from './helpers/tracks';
|
|
20
20
|
import { extractMid } from './helpers/sdp';
|
|
21
21
|
import { withCancellation } from '../helpers/concurrency';
|
|
22
|
+
import { isReactNative } from '../helpers/platforms';
|
|
22
23
|
|
|
23
24
|
export type PublisherConstructorOpts = BasePeerConnectionOpts & {
|
|
24
25
|
publishOptions: PublishOption[];
|
|
@@ -110,7 +111,9 @@ export class Publisher extends BasePeerConnection {
|
|
|
110
111
|
} else {
|
|
111
112
|
const previousTrack = transceiver.sender.track;
|
|
112
113
|
await transceiver.sender.replaceTrack(trackToPublish);
|
|
113
|
-
|
|
114
|
+
if (!isReactNative()) {
|
|
115
|
+
this.stopTrack(previousTrack);
|
|
116
|
+
}
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
119
|
};
|
|
@@ -224,6 +227,11 @@ export class Publisher extends BasePeerConnection {
|
|
|
224
227
|
}
|
|
225
228
|
for (const track of this.clonedTracks) {
|
|
226
229
|
this.stopTrack(track);
|
|
230
|
+
// @ts-expect-error release() is present in react-native-webrtc
|
|
231
|
+
if (track && typeof track.release === 'function') {
|
|
232
|
+
// @ts-expect-error
|
|
233
|
+
track.release();
|
|
234
|
+
}
|
|
227
235
|
}
|
|
228
236
|
};
|
|
229
237
|
|