@livedigital/client 2.32.1 → 2.32.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@livedigital/client",
3
3
  "author": "vlprojects",
4
4
  "license": "MIT",
5
- "version": "2.32.1",
5
+ "version": "2.32.2",
6
6
  "private": false,
7
7
  "bugs": {
8
8
  "url": "https://github.com/vlprojects/livedigital-sdk/issues"
@@ -117,8 +117,14 @@ class Media {
117
117
  return Array.from(this.tracks.values());
118
118
  }
119
119
 
120
- clearTracks(): void {
121
- this.tracks.clear();
120
+ async clearTracks(): Promise<void> {
121
+ try {
122
+ this.getAllTracks().map((track) => track.stopMediaStreamTrack());
123
+ } catch (error) {
124
+ this.#logger.warn('clearTracks()', { error });
125
+ } finally {
126
+ this.tracks.clear();
127
+ }
122
128
  }
123
129
 
124
130
  static getScreenVideoTrackParams(options?: CreateScreenVideoTrackOptions): CreateVideoTrackParams {
@@ -165,6 +165,10 @@ class BaseTrack {
165
165
  });
166
166
  }
167
167
 
168
+ stopMediaStreamTrack(): void {
169
+ this.mediaStreamTrack.stop();
170
+ }
171
+
168
172
  private async checkProducerState(): Promise<void> {
169
173
  try {
170
174
  if (this.#closed || this.kind === 'audio') {
@@ -108,14 +108,14 @@ class System {
108
108
  try {
109
109
  await this.requestMediaDevicesAccess();
110
110
  } catch (errorVideoAndAudio) {
111
- if (errorVideoAndAudio.message !== DeviceErrors.NotFoundError) {
111
+ if (![DeviceErrors.NotFoundError, DeviceErrors.NotAllowedError].includes(errorVideoAndAudio.message)) {
112
112
  throw errorVideoAndAudio;
113
113
  }
114
114
 
115
115
  try {
116
116
  await this.requestMediaDevicesAccess({ audio: true });
117
117
  } catch (errorAudioOnly) {
118
- if (errorAudioOnly.message !== DeviceErrors.NotFoundError) {
118
+ if (![DeviceErrors.NotFoundError, DeviceErrors.NotAllowedError].includes(errorAudioOnly.message)) {
119
119
  throw errorAudioOnly;
120
120
  }
121
121