Skip to content

Expose audio engine APIs#62

Open
hiroshihorie wants to merge 15 commits intomasterfrom
hiroshi/expose-audioengine-api
Open

Expose audio engine APIs#62
hiroshihorie wants to merge 15 commits intomasterfrom
hiroshi/expose-audioengine-api

Conversation

@hiroshihorie
Copy link
Copy Markdown
Member

No description provided.

@hiroshihorie hiroshihorie requested a review from davidliu October 6, 2025 10:12
Comment on lines -73 to 87
if (audioProcessingModule != nil) {
if (audioDevice != nil) {
NSLog(@"Both audioProcessingModule and audioDevice are provided, but only one can be used. Ignoring "
@"audioDevice.");
}
if (audioDevice == nil) {
RCTLogInfo(@"Using audio processing module: %@", NSStringFromClass([audioProcessingModule class]));
_peerConnectionFactory =
[[RTCPeerConnectionFactory alloc] initWithAudioDeviceModuleType:RTCAudioDeviceModuleTypeAudioEngine
bypassVoiceProcessing:NO
encoderFactory:encoderFactory
decoderFactory:decoderFactory
audioProcessingModule:audioProcessingModule];
} else {
RCTLogInfo(@"Using audio device: %@", NSStringFromClass([audioDevice class]));
_peerConnectionFactory = [[RTCPeerConnectionFactory alloc] initWithEncoderFactory:encoderFactory
decoderFactory:decoderFactory
audioDevice:audioDevice];
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic updated to prefer to use RTCAudioDeviceModuleTypeAudioEngine unless audioDevice is provided.

Bump the WebRTC-SDK version from 137.7151.09 to 137.7151.11 in the podspec to use the latest compatible release.
* iOS/macOS only.
*/
class AudioDeviceModuleEventEmitter {
private eventEmitter: NativeEventEmitter | null = null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some legacy reasons here, but use EventEmitter instead of NativeEventEmitter. It turns out that the listener registration is async on NativeEventEmitter, which can cause some unexpected behavior.

You'll need to add the valid event names here:

const NATIVE_EVENTS = [

/**
* Subscribe to speech activity events (started/ended)
*/
addSpeechActivityListener(listener: (data: SpeechActivityEventData) => void) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also implement the corresponding remove listener.

/**
* Subscribe to devices updated event (input/output devices changed)
*/
addDevicesUpdatedListener(listener: () => void) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also implement the corresponding remove listener.

s.libraries = 'c', 'sqlite3', 'stdc++'
s.framework = 'AudioToolbox','AVFoundation', 'CoreAudio', 'CoreGraphics', 'CoreVideo', 'GLKit', 'VideoToolbox'
s.dependency 'React-Core'
s.dependency 'WebRTC-SDK', '=137.7151.09'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will probably need to rebase/update this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants