Skip to content

Phone's receiver is forced as output when in PiP mode #910

@alvarezGarciaMarcos

Description

@alvarezGarciaMarcos

Hello everyone,

First of all, sorry if I don't tag the issue correctly. I don't know if it is a bug in the SDK so I rather ask here with a blank issue prior to report it as a real bug because maybe is a misconfiguration from my side.

The problem that I am facing is the following:
When I am in a videocall (let's say that we are only two people in the call), the phone's speaker is the output of the currentRoute of the audioSession. When I enter into PiP mode, the phone changes the output to be the receiver instead (which is a weird behavior from the user's perspective). I've hooked myself into the AVAudioSession.routeChangeNotification to see what happens, and the reason that I see in that case is categoryChange. Now, as the SDK is handling the AVAudioSession, I cannot change this behavior.

As I've seen in the documentation, I should use a AudioSessionPolicy along with the CallSettings to control this behavior. Currently, I am testing with this configuration:

let callSettings = CallSettings(audioOn: true, videoOn: true, speakerOn: true, audioOutputOn: true)
let call = client.call(callType: .default, callId: callID, callSettings: callSettings)
let policy = DefaultAudioSessionPolicy()

Task {
    await call.updateAudioSessionPolicy(policy)
    try await call.join(create: false)
    self.callViewController.viewModel.setActiveCall(call)
}

Now, am I doing something wrong? Is there any configuration missing to force the built-in speaker of the phone to be the output while in PiP? Or is there a way to handle the AVAudioSession all by myself instead of relying on the SDK for that?

Note: This behavior (defaulting to built-in receiver) also happens when I connect a bluetoothHFP device and disconnect it.

If this issue does not belong here, I would gladly move this to wherever it belongs.
Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions