@stream-io/video-client 1.41.1 → 1.41.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "1.41.1",
3
+ "version": "1.41.2",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.es.js",
6
6
  "browser": "dist/index.browser.es.js",
@@ -91,11 +91,7 @@ export class SpeakerManager {
91
91
  * @returns an Observable that will be updated if a device is connected or disconnected
92
92
  */
93
93
  listDevices() {
94
- if (isReactNative()) {
95
- throw new Error(
96
- 'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/reactnative/core/camera-and-microphone/#speaker-management for more details',
97
- );
98
- }
94
+ assertUnsupportedInReactNative();
99
95
  return getAudioOutputDevices(this.call.tracer);
100
96
  }
101
97
 
@@ -107,11 +103,7 @@ export class SpeakerManager {
107
103
  * @param deviceId empty string means the system default
108
104
  */
109
105
  select(deviceId: string) {
110
- if (isReactNative()) {
111
- throw new Error(
112
- 'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/reactnative/core/camera-and-microphone/#speaker-management for more details',
113
- );
114
- }
106
+ assertUnsupportedInReactNative();
115
107
  this.state.setDevice(deviceId);
116
108
  }
117
109
 
@@ -133,11 +125,7 @@ export class SpeakerManager {
133
125
  * Note: This method is not supported in React Native
134
126
  */
135
127
  setVolume(volume: number) {
136
- if (isReactNative()) {
137
- throw new Error(
138
- 'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/reactnative/core/camera-and-microphone/#speaker-management for more details',
139
- );
140
- }
128
+ assertUnsupportedInReactNative();
141
129
  if (volume && (volume < 0 || volume > 1)) {
142
130
  throw new Error('Volume must be between 0 and 1');
143
131
  }
@@ -165,3 +153,11 @@ export class SpeakerManager {
165
153
  });
166
154
  }
167
155
  }
156
+
157
+ const assertUnsupportedInReactNative = () => {
158
+ if (isReactNative()) {
159
+ throw new Error(
160
+ 'Unsupported in React Native. See: https://getstream.io/video/docs/react-native/guides/camera-and-microphone/#speaker-management',
161
+ );
162
+ }
163
+ };