@stream-io/video-client 1.8.0 → 1.8.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 +63 -15
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +63 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +63 -15
- package/dist/index.es.js.map +1 -1
- package/dist/src/helpers/RNSpeechDetector.d.ts +2 -0
- package/package.json +1 -1
- package/src/devices/InputMediaDeviceManager.ts +8 -1
- package/src/devices/devices.ts +5 -0
- package/src/events/call.ts +2 -3
- package/src/helpers/RNSpeechDetector.ts +25 -0
- package/src/rtc/Publisher.ts +24 -11
package/dist/index.cjs.js
CHANGED
|
@@ -3041,7 +3041,7 @@ const retryable = async (rpc, signal) => {
|
|
|
3041
3041
|
return result;
|
|
3042
3042
|
};
|
|
3043
3043
|
|
|
3044
|
-
const version = "1.8.
|
|
3044
|
+
const version = "1.8.2";
|
|
3045
3045
|
const [major, minor, patch] = version.split('.');
|
|
3046
3046
|
let sdkInfo = {
|
|
3047
3047
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -5258,6 +5258,11 @@ class Publisher {
|
|
|
5258
5258
|
if (previousTrack && previousTrack !== track) {
|
|
5259
5259
|
previousTrack.stop();
|
|
5260
5260
|
previousTrack.removeEventListener('ended', handleTrackEnded);
|
|
5261
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
5262
|
+
if (typeof previousTrack.release === 'function') {
|
|
5263
|
+
// @ts-expect-error
|
|
5264
|
+
track.release();
|
|
5265
|
+
}
|
|
5261
5266
|
track.addEventListener('ended', handleTrackEnded);
|
|
5262
5267
|
}
|
|
5263
5268
|
if (!track.enabled) {
|
|
@@ -5277,14 +5282,19 @@ class Publisher {
|
|
|
5277
5282
|
const transceiver = this.pc
|
|
5278
5283
|
.getTransceivers()
|
|
5279
5284
|
.find((t) => t === this.transceiverRegistry[trackType] && t.sender.track);
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
(stopTrack
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5285
|
+
const track = transceiver?.sender.track;
|
|
5286
|
+
if (track && (stopTrack ? track.readyState === 'live' : track.enabled)) {
|
|
5287
|
+
if (stopTrack) {
|
|
5288
|
+
track.stop();
|
|
5289
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
5290
|
+
if (typeof track.release === 'function') {
|
|
5291
|
+
// @ts-expect-error
|
|
5292
|
+
track.release();
|
|
5293
|
+
}
|
|
5294
|
+
}
|
|
5295
|
+
else {
|
|
5296
|
+
track.enabled = false;
|
|
5297
|
+
}
|
|
5288
5298
|
// We don't need to notify SFU if unpublishing in response to remote soft mute
|
|
5289
5299
|
if (this.state.localParticipant?.publishedTracks.includes(trackType)) {
|
|
5290
5300
|
await this.notifyTrackMuteStateChanged(undefined, trackType, true);
|
|
@@ -5331,7 +5341,13 @@ class Publisher {
|
|
|
5331
5341
|
this.stopPublishing = () => {
|
|
5332
5342
|
this.logger('debug', 'Stopping publishing all tracks');
|
|
5333
5343
|
this.pc.getSenders().forEach((s) => {
|
|
5334
|
-
s.track
|
|
5344
|
+
const track = s.track;
|
|
5345
|
+
track?.stop();
|
|
5346
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
5347
|
+
if (typeof track?.release === 'function') {
|
|
5348
|
+
// @ts-expect-error
|
|
5349
|
+
track.release();
|
|
5350
|
+
}
|
|
5335
5351
|
if (this.pc.signalingState !== 'closed') {
|
|
5336
5352
|
this.pc.removeTrack(s);
|
|
5337
5353
|
}
|
|
@@ -6313,9 +6329,8 @@ const watchCallRejected = (call) => {
|
|
|
6313
6329
|
const watchCallEnded = (call) => {
|
|
6314
6330
|
return function onCallEnded() {
|
|
6315
6331
|
const { callingState } = call.state;
|
|
6316
|
-
if (callingState
|
|
6317
|
-
callingState
|
|
6318
|
-
callingState === exports.CallingState.JOINING) {
|
|
6332
|
+
if (callingState !== exports.CallingState.IDLE &&
|
|
6333
|
+
callingState !== exports.CallingState.LEFT) {
|
|
6319
6334
|
call.leave({ reason: 'call.ended event received' }).catch((err) => {
|
|
6320
6335
|
call.logger('error', 'Failed to leave call after call.ended ', err);
|
|
6321
6336
|
});
|
|
@@ -7961,6 +7976,11 @@ const disposeOfMediaStream = (stream) => {
|
|
|
7961
7976
|
stream.getTracks().forEach((track) => {
|
|
7962
7977
|
track.stop();
|
|
7963
7978
|
stream.removeTrack(track);
|
|
7979
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
7980
|
+
if (typeof track.release === 'function') {
|
|
7981
|
+
// @ts-expect-error
|
|
7982
|
+
track.release();
|
|
7983
|
+
}
|
|
7964
7984
|
});
|
|
7965
7985
|
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the stream
|
|
7966
7986
|
if (typeof stream.release === 'function') {
|
|
@@ -8180,8 +8200,14 @@ class InputMediaDeviceManager {
|
|
|
8180
8200
|
}
|
|
8181
8201
|
stopTracks() {
|
|
8182
8202
|
this.getTracks().forEach((track) => {
|
|
8183
|
-
if (track.readyState === 'live')
|
|
8203
|
+
if (track.readyState === 'live') {
|
|
8184
8204
|
track.stop();
|
|
8205
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
8206
|
+
if (typeof track.release === 'function') {
|
|
8207
|
+
// @ts-expect-error
|
|
8208
|
+
track.release();
|
|
8209
|
+
}
|
|
8210
|
+
}
|
|
8185
8211
|
});
|
|
8186
8212
|
}
|
|
8187
8213
|
muteLocalStream(stopTracks) {
|
|
@@ -8747,9 +8773,11 @@ class RNSpeechDetector {
|
|
|
8747
8773
|
*/
|
|
8748
8774
|
async start() {
|
|
8749
8775
|
try {
|
|
8776
|
+
this.cleanupAudioStream();
|
|
8750
8777
|
const audioStream = await navigator.mediaDevices.getUserMedia({
|
|
8751
8778
|
audio: true,
|
|
8752
8779
|
});
|
|
8780
|
+
this.audioStream = audioStream;
|
|
8753
8781
|
this.pc1.addEventListener('icecandidate', async (e) => {
|
|
8754
8782
|
await this.pc2.addIceCandidate(e.candidate);
|
|
8755
8783
|
});
|
|
@@ -8779,6 +8807,7 @@ class RNSpeechDetector {
|
|
|
8779
8807
|
stop() {
|
|
8780
8808
|
this.pc1.close();
|
|
8781
8809
|
this.pc2.close();
|
|
8810
|
+
this.cleanupAudioStream();
|
|
8782
8811
|
if (this.intervalId) {
|
|
8783
8812
|
clearInterval(this.intervalId);
|
|
8784
8813
|
}
|
|
@@ -8815,6 +8844,25 @@ class RNSpeechDetector {
|
|
|
8815
8844
|
clearInterval(this.intervalId);
|
|
8816
8845
|
};
|
|
8817
8846
|
}
|
|
8847
|
+
cleanupAudioStream() {
|
|
8848
|
+
if (!this.audioStream) {
|
|
8849
|
+
return;
|
|
8850
|
+
}
|
|
8851
|
+
this.audioStream.getTracks().forEach((track) => {
|
|
8852
|
+
track.stop();
|
|
8853
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
8854
|
+
if (typeof track.release === 'function') {
|
|
8855
|
+
// @ts-expect-error
|
|
8856
|
+
track.release();
|
|
8857
|
+
}
|
|
8858
|
+
});
|
|
8859
|
+
if (
|
|
8860
|
+
// @ts-expect-error release() is present in react-native-webrtc
|
|
8861
|
+
typeof this.audioStream.release === 'function') {
|
|
8862
|
+
// @ts-expect-error called to dispose the stream in RN
|
|
8863
|
+
this.audioStream.release();
|
|
8864
|
+
}
|
|
8865
|
+
}
|
|
8818
8866
|
}
|
|
8819
8867
|
|
|
8820
8868
|
class MicrophoneManager extends InputMediaDeviceManager {
|
|
@@ -12475,7 +12523,7 @@ class StreamClient {
|
|
|
12475
12523
|
});
|
|
12476
12524
|
};
|
|
12477
12525
|
this.getUserAgent = () => {
|
|
12478
|
-
const version = "1.8.
|
|
12526
|
+
const version = "1.8.2";
|
|
12479
12527
|
return (this.userAgent ||
|
|
12480
12528
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
12481
12529
|
};
|