Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions ios/RCTWebRTC/Utils/AudioDeviceModule/AudioDeviceModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,30 @@ import WebRTC
source.refreshStereoPlayoutState()
}

/// Gates whether the internal `AVAudioEngine` may start/stop for input and output.
///
/// This flag has the highest priority over any API that may start the engine
/// (e.g., enabling the mic, ``startLocalRecording()``, or starting playback).
///
/// - Behavior:
/// - When set to a disabled availability, the engine will stop if running,
/// and it will not start, even if recording or playback is requested.
/// - When set back to enabled, the engine will start as soon as possible
/// if recording and/or playback had been previously requested while disabled
/// (i.e., pending requests are honored once availability allows).
///
/// This is useful when you need to set up connections without touching the audio
/// device yet (e.g., CallKit flows), or to guarantee the engine remains off
/// regardless of subscription/publication requests.
public func setEngineAvailability(_ availability: RTCAudioEngineAvailability) -> Int {
source.setEngineAvailability(availability)
}

/// The current engine availability for input and output.
public var engineAvailability: RTCAudioEngineAvailability {
source.engineAvailability
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

// MARK: - RTCAudioDeviceModuleDelegate

/// Receives speech activity notifications emitted by WebRTC VAD.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ protocol RTCAudioDeviceModuleControlling: AnyObject {
func refreshStereoPlayoutState()
func setMuteMode(_ mode: RTCAudioEngineMuteMode) -> Int
func setRecordingAlwaysPreparedMode(_ alwaysPreparedRecording: Bool) -> Int
func setEngineAvailability(_ availability: RTCAudioEngineAvailability) -> Int
var engineAvailability: RTCAudioEngineAvailability { get }
}

extension RTCAudioEngineAvailability {
/// Engine may activate for both input and output (the WebRTC default).
public static let `default` = RTCAudioEngineAvailability(isInputAvailable: true, isOutputAvailable: true)
/// Engine start/stop is gated off for both input and output (e.g. before CallKit
/// activates the AVAudioSession).
public static let none = RTCAudioEngineAvailability(isInputAvailable: false, isOutputAvailable: false)
}

extension RTCAudioDeviceModule: RTCAudioDeviceModuleControlling {
Expand Down
5 changes: 0 additions & 5 deletions ios/RCTWebRTC/WebRTCModule+RTCAudioDeviceModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,6 @@ - (void)handleADMResult:(NSInteger)result
reject:reject];
}

// TODO: `getEngineAvailability` / `setEngineAvailability` were dropped because the
// Stream WebRTC SDK does not expose `RTCAudioEngineAvailability` / `-setEngineAvailability:`.
// The closest equivalent is `RTCAudioEngineState` via `engineState`, but the
// semantics differ and the JS API isn't consumed anywhere yet.

// TODO: Observer delegate "resolve" methods were skipped because our current
// `AudioDeviceModuleObserver` does not expose async JS-driven resolution hooks;
// the Swift `AudioDeviceModule` wrapper always returns success immediately.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/react-native-webrtc",
"version": "145.0.0",
"version": "145.1.0-alpha.1",
"repository": {
"type": "git",
"url": "git+https://github.com/GetStream/react-native-webrtc.git"
Expand Down
2 changes: 1 addition & 1 deletion stream-react-native-webrtc.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Pod::Spec.new do |s|
s.swift_version = '5.0'
s.dependency 'React-Core'
# WebRTC version from https://github.com/GetStream/stream-video-swift-webrtc releases
s.dependency 'StreamWebRTC', '= 145.10.0'
s.dependency 'StreamWebRTC', '= 145.11.0'
# Swift/Objective-C compatibility #https://blog.cocoapods.org/CocoaPods-1.5.0/
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES'
Expand Down
Loading