@stream-io/video-react-native-sdk 1.22.1-alpha.1 → 1.22.1-alpha.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.
@@ -429,15 +429,15 @@ class StreamVideoReactNativeModule(reactContext: ReactApplicationContext) :
429
429
  busyToneJob?.cancel()
430
430
  busyToneJob = null
431
431
 
432
- busyToneAudioTrack?.let { track ->
432
+ busyToneAudioTrack?.apply {
433
433
  try {
434
- if (track.playState == AudioTrack.PLAYSTATE_PLAYING) {
435
- track.stop()
434
+ if (playState == AudioTrack.PLAYSTATE_PLAYING) {
435
+ stop()
436
436
  }
437
437
  } catch (e: Exception) {
438
438
  Log.e(NAME, "Error stopping AudioTrack: ${e.message}")
439
439
  } finally {
440
- track.release()
440
+ release()
441
441
  }
442
442
  }
443
443
  busyToneAudioTrack = null
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = void 0;
7
- const version = exports.version = '1.22.1-alpha.1';
7
+ const version = exports.version = '1.22.1-alpha.2';
8
8
  //# sourceMappingURL=version.js.map
@@ -1,2 +1,2 @@
1
- export const version = '1.22.1-alpha.1';
1
+ export const version = '1.22.1-alpha.2';
2
2
  //# sourceMappingURL=version.js.map
@@ -1,2 +1,2 @@
1
- export declare const version = "1.22.1-alpha.1";
1
+ export declare const version = "1.22.1-alpha.2";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -118,13 +118,23 @@ class StreamInCallManager: RCTEventEmitter {
118
118
 
119
119
  if (defaultAudioDevice == .speaker) {
120
120
  // defaultToSpeaker will route to speaker if nothing else is connected
121
- intendedOptions = [.allowBluetooth, .defaultToSpeaker]
121
+ intendedOptions = [.allowBluetoothHFP, .defaultToSpeaker]
122
122
  } else {
123
123
  // having no defaultToSpeaker makes sure audio goes to earpiece if nothing is connected
124
- intendedOptions = [.allowBluetooth]
124
+ intendedOptions = [.allowBluetoothHFP]
125
125
  }
126
126
  }
127
127
 
128
+ // STEP 1: Configure iOS native audio session FIRST (this does the pre-warming so that webrtc worker thread isnt stalled on audio unit initialisation)
129
+ let nativeSession = AVAudioSession.sharedInstance()
130
+ do {
131
+ try nativeSession.setCategory(intendedCategory, mode: intendedMode, options: intendedOptions)
132
+ try nativeSession.setActive(true)
133
+ log("configureAudioSession: Native AVAudioSession configured successfully")
134
+ } catch {
135
+ log("configureAudioSession: Failed to configure native session: \(error.localizedDescription)")
136
+ }
137
+
128
138
  // START: set the config that webrtc must use when it takes control
129
139
  let rtcConfig = RTCAudioSessionConfiguration.webRTC()
130
140
  rtcConfig.category = intendedCategory.rawValue
@@ -133,6 +143,7 @@ class StreamInCallManager: RCTEventEmitter {
133
143
  RTCAudioSessionConfiguration.setWebRTC(rtcConfig)
134
144
  // END
135
145
 
146
+
136
147
  // START: compare current audio session with intended, and update if different
137
148
  let session = RTCAudioSession.sharedInstance()
138
149
  let currentCategory = session.category
@@ -180,12 +191,14 @@ class StreamInCallManager: RCTEventEmitter {
180
191
 
181
192
  @objc(setForceSpeakerphoneOn:)
182
193
  func setForceSpeakerphoneOn(enable: Bool) {
183
- let session = AVAudioSession.sharedInstance()
184
- do {
185
- try session.overrideOutputAudioPort(enable ? .speaker : .none)
186
- try session.setActive(true)
187
- } catch {
188
- log("Error setting speakerphone: \(error)")
194
+ audioSessionQueue.async {
195
+ let session = AVAudioSession.sharedInstance()
196
+ do {
197
+ try session.overrideOutputAudioPort(enable ? .speaker : .none)
198
+ try session.setActive(true)
199
+ } catch {
200
+ self.log("Error setting speakerphone: \(error)")
201
+ }
189
202
  }
190
203
  }
191
204
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-native-sdk",
3
- "version": "1.22.1-alpha.1",
3
+ "version": "1.22.1-alpha.2",
4
4
  "description": "Stream Video SDK for React Native",
5
5
  "author": "https://getstream.io",
6
6
  "homepage": "https://getstream.io/video/docs/react-native/",
@@ -45,8 +45,8 @@
45
45
  "!**/.*"
46
46
  ],
47
47
  "dependencies": {
48
- "@stream-io/video-client": "1.34.0",
49
- "@stream-io/video-react-bindings": "1.10.0",
48
+ "@stream-io/video-client": "1.34.1",
49
+ "@stream-io/video-react-bindings": "1.10.1",
50
50
  "intl-pluralrules": "2.0.1",
51
51
  "lodash.merge": "^4.6.2",
52
52
  "react-native-url-polyfill": "^3.0.0",
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.22.1-alpha.1';
1
+ export const version = '1.22.1-alpha.2';