Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to get availableOutputs like availableInputs in AVAudioSession

I need to list available outputs (like BleutoothLE, HeadPhones, BuiltInReceiver) but i can just access currentRoute's output.

Can anyone access all available outputs, please share your comments ?

Thanks in advance.

like image 683
Erhan Avatar asked Oct 20 '15 13:10

Erhan


1 Answers

You have two options as far as I know:

  • Add a MPVolumeView to your view and, set showsVolumeSlider to 0 and set showsRouteButton to 1. This will put a system provided icon where the user can pick from available outputs.

  • AVAudioSession has a very limited overrideOutputAudioPort method that can route audio to the built in speaker.

    [[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];
    
like image 180
dave234 Avatar answered Sep 23 '22 04:09

dave234