Skip to main content

All Questions

Tagged with
1 vote
1 answer
139 views

How do I get my app to show the "Tap to Airplay" banner on launch

I would like my app to show the airplay suggestion like Spotify does. I have enabled background audio in the app's capabilities, I use try audioSession.setCategory(.playback) on app launch, and then I ...
Halpo's user avatar
  • 3,084
5 votes
1 answer
863 views

AVPlayerViewController plays audio through airplay when allowsExternalPlayback is false

I have a main video that plays through AVPlayerViewController that should be played through Airplay to e.g. the AppleTV. This is how I set up the view controller: let player = AVPlayer(url: url) let ...
Tomáš Kohout's user avatar
1 vote
0 answers
1k views

How to prevent iOS app to be suspended in the background during the call?

I am developing an iOS app that plays audio and video files using AVPlayer. The app needs to play media files also when the app is backgrounded. I successfully enabled background play by using Audio, ...
Marko Ilic's user avatar
3 votes
1 answer
2k views

On iOS, how can I force AVRoutePickerView to allow route switching between speaker and the handset?

Right now, when the user presses the AVRoutePickerView, they get a choice of iPhone and other AirPlay targets. And picking iPhone uses the speakerphone to play back audio: I'd like there to be an ...
user496854's user avatar
  • 6,748
2 votes
1 answer
2k views

Detect the AirPlay Device Type iPhone is Connected To

Is there a way to get the AirPlay device type the iPhone is connected to? For instance, is there a way to know that the iPhone is connected to a HomePod, an Apple TV, or AirPods via AirPlay? I would ...
Jacob Cavin's user avatar
  • 2,289
0 votes
1 answer
269 views

React to audio being connected & disconnected to an airplay device

I'm looking for a way to immediately react to the audio output being connected and disconnected to an airplay device. There are UIScreen.didConnectNotification and UIScreen.didDisconnectNotification ...
nontomatic's user avatar
  • 2,023
18 votes
0 answers
2k views

Get Connected AirPlay Device Name

I want to get the name of the AirPlay or Bluetooth device my iPhone is connected to. I have somewhat achieved this with the following code... let currentRoute = AVAudioSession.sharedInstance()....
Jacob Cavin's user avatar
  • 2,289
0 votes
1 answer
386 views

How to send audio output to Apple TV?

I want to add a button to send the audio output to the Applle TV. I use below code but it does not work. Can you help what I am doing wrong? First I change the AVAudioSession category to be ...
ondermerol's user avatar
5 votes
0 answers
278 views

Split audio route in active VoiceChat AVAudioSession to play at AirPlay but record using a device

I'm building a video chat app for iPhone. One of the requirements that it should work fine with AirPlay. Once I'm switching to AirPlay the video goes to the AppleTV but audio stays on the phone. The ...
Mando's user avatar
  • 11.7k
2 votes
0 answers
124 views

How to use PlayAndRecord session with ability to switch output to Speaker

I'm writing and iOS audio/video chat app with several pre-conditions: I'm using PlayAndRecord category to establish a audio/video chat. I have also a button to which allows user to switch to the ...
Mando's user avatar
  • 11.7k
29 votes
4 answers
19k views

List available output audio target AVAudioSession

I need to list the audio outputs available to an iOS application. My question is similar to this one: How to list available audio output route on iOS i tried this code: NSError *setCategoryError = ...
lucianoenrico's user avatar
12 votes
3 answers
3k views

AVAudioSessionCategoryPlayAndRecord makes AirPlay invisible

I am encountering the following problem: AirPlay becomes not available whenever I set play-and-record category to the audio session in my application: [[AVAudioSession sharedInstance] ...
Anastasia's user avatar
  • 3,034
34 votes
4 answers
3k views

AVAudioSessionCategoryPlayAndRecord with Airplay

My app uses the microphone and outputs audio, so I am setting my Audio Session to the Play and Record Category, but this seems to disable Airplay. If I set the category to Play, Airplay works fine ...
thf_dave's user avatar
  • 383