@poolse/react-native-calls 0.4.5 → 0.4.6

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.
@@ -76,8 +76,6 @@ final class LiveKitMediaPort: NSObject, MediaPort {
76
76
  private let surfaces = NSHashTable<LiveKitVideoSurface>.weakObjects()
77
77
  private var audioPrepared = false
78
78
  private var audioActive = false
79
- /// The room whose audio engine has been kicked (once per room).
80
- private var audioKicked: ObjectIdentifier?
81
79
  /// Asks CallKit to (re)try activating the audio session — set by
82
80
  /// CallCore. Used when a room is live but activation never arrived.
83
81
  var requestAudioActivation: (() -> Void)?
@@ -121,7 +119,6 @@ final class LiveKitMediaPort: NSObject, MediaPort {
121
119
  audioActive = true
122
120
  if media != self.media && room == nil { self.media = media }
123
121
  reassertAudio(session)
124
- kickAudioIfReady()
125
122
  }
126
123
 
127
124
  /// Connected with a live mic but CallKit never activated the session
@@ -147,48 +144,6 @@ final class LiveKitMediaPort: NSObject, MediaPort {
147
144
  }
148
145
  }
149
146
 
150
- /// Once per call, the first moment the session is active AND the mic is
151
- /// published (in whichever order they happen): make LiveKit's audio
152
- /// engine rebuild around the live mic.
153
- ///
154
- /// On a call answered with the app closed, the process is brand new and
155
- /// LiveKit's engine never started for a mic published right after
156
- /// CallKit made audio available — no capture, no playback, though the
157
- /// session was correct (video, which needs no audio engine, worked). A
158
- /// user-side mute → unmute cured it, because toggling the mic makes the
159
- /// engine re-evaluate and start. This does the same, automatically: an
160
- /// availability cycle first, then a mic off/on. A deliberate mute is
161
- /// left alone. The remote hears at most a sub-second blip at connect.
162
- private func kickAudioIfReady() {
163
- guard audioActive, let r = room, connectedRoom == ObjectIdentifier(r),
164
- audioKicked != ObjectIdentifier(r), !mutedWanted else { return }
165
- guard r.localParticipant.isMicrophoneEnabled() else { return }
166
- audioKicked = ObjectIdentifier(r)
167
- pcTrace("kick: cycling engine availability + mic")
168
- do {
169
- try AudioManager.shared.setEngineAvailability(.none)
170
- try AudioManager.shared.setEngineAvailability(.default)
171
- } catch {
172
- NSLog("[PoolseCalls] engine availability cycle failed: %@", "\(error)")
173
- }
174
- Task { [weak self] in
175
- try? await Task.sleep(nanoseconds: 250_000_000)
176
- let still = await MainActor.run { () -> Bool in
177
- guard let self = self else { return false }
178
- return self.room === r && self.audioActive && !self.mutedWanted
179
- }
180
- guard still else { return }
181
- do {
182
- try await r.localParticipant.setMicrophone(enabled: false)
183
- try await r.localParticipant.setMicrophone(enabled: true)
184
- } catch {
185
- NSLog("[PoolseCalls] mic cycle failed: %@", "\(error)")
186
- }
187
- pcTrace("kick done enabled=\(r.localParticipant.isMicrophoneEnabled()) \(pcSessionDescription())")
188
- await MainActor.run { self?.reassertAudio() }
189
- }
190
- }
191
-
192
147
  /// Put the call's audio back the way the call needs it: play-and-record
193
148
  /// in the voice/video chat mode, LiveKit's engine available, the chosen
194
149
  /// route. Idempotent — only touches what differs — so it is safe to run
@@ -289,7 +244,6 @@ final class LiveKitMediaPort: NSObject, MediaPort {
289
244
  // then make sure the engine is actually carrying the mic.
290
245
  await MainActor.run {
291
246
  self.reassertAudio()
292
- self.kickAudioIfReady()
293
247
  self.ensureAudioActivated(r, attempt: 0)
294
248
  }
295
249
  let camera = await MainActor.run { self.cameraWanted ?? wantsVideo }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poolse/react-native-calls",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Native call core for poolse — Kotlin/Swift calling engine with a thin React Native bridge. Ring, answer and carry audio with the app killed and the phone locked.",
5
5
  "license": "MIT",
6
6
  "type": "module",