Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AudioSession switches to the Speaker after connection to the room #391

Open
artemkrachulov opened this issue May 31, 2024 · 2 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@artemkrachulov
Copy link

We're building an application where iOS Voip is combined with LiveKit. We have all configured modes, categories, and options for the AudioSession depending on the type of the call: video or audio. The issue comes when the user connects to the room:

When a new call is reported and CXProvider activates an audio session, AudioSession audio routes are configured correctly:
Audio - Receiver
Video - Speaker
After connection to the room audio switches to the Speaker, but should stay Receiver as initially.

Do we have a default audio and mic configuration, where we can join the room with the required options? Example: Build-in Audio / Microphone On / Video off for video calls and Speaker Audio / Microphone On / Video on for video calls?

SDK Version
2.0.8

iOS/macOS Version
Version 14.5 (23F79)

@artemkrachulov artemkrachulov added the bug Something isn't working label May 31, 2024
@artemkrachulov
Copy link
Author

artemkrachulov commented May 31, 2024

As a temporary solution, I have followed configuration after connection to the room:

Task {
    let _ = try await roomContext.connect(url, token.token)

    try await roomContext.setMicrophone(enabled: true)

    if self.isVideo {
        try await roomContext.setCamera(enabled: true)
    } else {
        // Switch audio back to Receiver
        AudioManager.shared.isSpeakerOutputPreferred = false
    }
}

But still, maybe we can avoid this unnecessary jumping from Receiver-Speaker-Receiver.

@davidzhao
Copy link
Member

to avoid speaker, you'd need to customize the audiosession and ensure the mode is set to voiceChat. We default to videoChat, which means it'll be output to the speaker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants