@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.es.js
CHANGED
|
@@ -3021,7 +3021,7 @@ const retryable = async (rpc, signal) => {
|
|
|
3021
3021
|
return result;
|
|
3022
3022
|
};
|
|
3023
3023
|
|
|
3024
|
-
const version = "1.8.
|
|
3024
|
+
const version = "1.8.2";
|
|
3025
3025
|
const [major, minor, patch] = version.split('.');
|
|
3026
3026
|
let sdkInfo = {
|
|
3027
3027
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -5238,6 +5238,11 @@ class Publisher {
|
|
|
5238
5238
|
if (previousTrack && previousTrack !== track) {
|
|
5239
5239
|
previousTrack.stop();
|
|
5240
5240
|
previousTrack.removeEventListener('ended', handleTrackEnded);
|
|
5241
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
5242
|
+
if (typeof previousTrack.release === 'function') {
|
|
5243
|
+
// @ts-expect-error
|
|
5244
|
+
track.release();
|
|
5245
|
+
}
|
|
5241
5246
|
track.addEventListener('ended', handleTrackEnded);
|
|
5242
5247
|
}
|
|
5243
5248
|
if (!track.enabled) {
|
|
@@ -5257,14 +5262,19 @@ class Publisher {
|
|
|
5257
5262
|
const transceiver = this.pc
|
|
5258
5263
|
.getTransceivers()
|
|
5259
5264
|
.find((t) => t === this.transceiverRegistry[trackType] && t.sender.track);
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
(stopTrack
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5265
|
+
const track = transceiver?.sender.track;
|
|
5266
|
+
if (track && (stopTrack ? track.readyState === 'live' : track.enabled)) {
|
|
5267
|
+
if (stopTrack) {
|
|
5268
|
+
track.stop();
|
|
5269
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
5270
|
+
if (typeof track.release === 'function') {
|
|
5271
|
+
// @ts-expect-error
|
|
5272
|
+
track.release();
|
|
5273
|
+
}
|
|
5274
|
+
}
|
|
5275
|
+
else {
|
|
5276
|
+
track.enabled = false;
|
|
5277
|
+
}
|
|
5268
5278
|
// We don't need to notify SFU if unpublishing in response to remote soft mute
|
|
5269
5279
|
if (this.state.localParticipant?.publishedTracks.includes(trackType)) {
|
|
5270
5280
|
await this.notifyTrackMuteStateChanged(undefined, trackType, true);
|
|
@@ -5311,7 +5321,13 @@ class Publisher {
|
|
|
5311
5321
|
this.stopPublishing = () => {
|
|
5312
5322
|
this.logger('debug', 'Stopping publishing all tracks');
|
|
5313
5323
|
this.pc.getSenders().forEach((s) => {
|
|
5314
|
-
s.track
|
|
5324
|
+
const track = s.track;
|
|
5325
|
+
track?.stop();
|
|
5326
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
5327
|
+
if (typeof track?.release === 'function') {
|
|
5328
|
+
// @ts-expect-error
|
|
5329
|
+
track.release();
|
|
5330
|
+
}
|
|
5315
5331
|
if (this.pc.signalingState !== 'closed') {
|
|
5316
5332
|
this.pc.removeTrack(s);
|
|
5317
5333
|
}
|
|
@@ -6293,9 +6309,8 @@ const watchCallRejected = (call) => {
|
|
|
6293
6309
|
const watchCallEnded = (call) => {
|
|
6294
6310
|
return function onCallEnded() {
|
|
6295
6311
|
const { callingState } = call.state;
|
|
6296
|
-
if (callingState
|
|
6297
|
-
callingState
|
|
6298
|
-
callingState === CallingState.JOINING) {
|
|
6312
|
+
if (callingState !== CallingState.IDLE &&
|
|
6313
|
+
callingState !== CallingState.LEFT) {
|
|
6299
6314
|
call.leave({ reason: 'call.ended event received' }).catch((err) => {
|
|
6300
6315
|
call.logger('error', 'Failed to leave call after call.ended ', err);
|
|
6301
6316
|
});
|
|
@@ -7941,6 +7956,11 @@ const disposeOfMediaStream = (stream) => {
|
|
|
7941
7956
|
stream.getTracks().forEach((track) => {
|
|
7942
7957
|
track.stop();
|
|
7943
7958
|
stream.removeTrack(track);
|
|
7959
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
7960
|
+
if (typeof track.release === 'function') {
|
|
7961
|
+
// @ts-expect-error
|
|
7962
|
+
track.release();
|
|
7963
|
+
}
|
|
7944
7964
|
});
|
|
7945
7965
|
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the stream
|
|
7946
7966
|
if (typeof stream.release === 'function') {
|
|
@@ -8160,8 +8180,14 @@ class InputMediaDeviceManager {
|
|
|
8160
8180
|
}
|
|
8161
8181
|
stopTracks() {
|
|
8162
8182
|
this.getTracks().forEach((track) => {
|
|
8163
|
-
if (track.readyState === 'live')
|
|
8183
|
+
if (track.readyState === 'live') {
|
|
8164
8184
|
track.stop();
|
|
8185
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
8186
|
+
if (typeof track.release === 'function') {
|
|
8187
|
+
// @ts-expect-error
|
|
8188
|
+
track.release();
|
|
8189
|
+
}
|
|
8190
|
+
}
|
|
8165
8191
|
});
|
|
8166
8192
|
}
|
|
8167
8193
|
muteLocalStream(stopTracks) {
|
|
@@ -8727,9 +8753,11 @@ class RNSpeechDetector {
|
|
|
8727
8753
|
*/
|
|
8728
8754
|
async start() {
|
|
8729
8755
|
try {
|
|
8756
|
+
this.cleanupAudioStream();
|
|
8730
8757
|
const audioStream = await navigator.mediaDevices.getUserMedia({
|
|
8731
8758
|
audio: true,
|
|
8732
8759
|
});
|
|
8760
|
+
this.audioStream = audioStream;
|
|
8733
8761
|
this.pc1.addEventListener('icecandidate', async (e) => {
|
|
8734
8762
|
await this.pc2.addIceCandidate(e.candidate);
|
|
8735
8763
|
});
|
|
@@ -8759,6 +8787,7 @@ class RNSpeechDetector {
|
|
|
8759
8787
|
stop() {
|
|
8760
8788
|
this.pc1.close();
|
|
8761
8789
|
this.pc2.close();
|
|
8790
|
+
this.cleanupAudioStream();
|
|
8762
8791
|
if (this.intervalId) {
|
|
8763
8792
|
clearInterval(this.intervalId);
|
|
8764
8793
|
}
|
|
@@ -8795,6 +8824,25 @@ class RNSpeechDetector {
|
|
|
8795
8824
|
clearInterval(this.intervalId);
|
|
8796
8825
|
};
|
|
8797
8826
|
}
|
|
8827
|
+
cleanupAudioStream() {
|
|
8828
|
+
if (!this.audioStream) {
|
|
8829
|
+
return;
|
|
8830
|
+
}
|
|
8831
|
+
this.audioStream.getTracks().forEach((track) => {
|
|
8832
|
+
track.stop();
|
|
8833
|
+
// @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
|
|
8834
|
+
if (typeof track.release === 'function') {
|
|
8835
|
+
// @ts-expect-error
|
|
8836
|
+
track.release();
|
|
8837
|
+
}
|
|
8838
|
+
});
|
|
8839
|
+
if (
|
|
8840
|
+
// @ts-expect-error release() is present in react-native-webrtc
|
|
8841
|
+
typeof this.audioStream.release === 'function') {
|
|
8842
|
+
// @ts-expect-error called to dispose the stream in RN
|
|
8843
|
+
this.audioStream.release();
|
|
8844
|
+
}
|
|
8845
|
+
}
|
|
8798
8846
|
}
|
|
8799
8847
|
|
|
8800
8848
|
class MicrophoneManager extends InputMediaDeviceManager {
|
|
@@ -12455,7 +12503,7 @@ class StreamClient {
|
|
|
12455
12503
|
});
|
|
12456
12504
|
};
|
|
12457
12505
|
this.getUserAgent = () => {
|
|
12458
|
-
const version = "1.8.
|
|
12506
|
+
const version = "1.8.2";
|
|
12459
12507
|
return (this.userAgent ||
|
|
12460
12508
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
12461
12509
|
};
|