Search code examples
iosswiftairplay

AirPlay icon differs with iOS versions


I am integrating AirPlay into my app. We currently support iOS 11-13. On iOS 13 I see the expected AirPlay icon (landscape oriented rectangle with an arrow pointed to the inside) when I connect to an AppleTV. When I use an iOS 12 device and connect to the same AppleTV I see what looks like the audio icon (arrow with an array of circles coming out of the point).

My AirPlay icon code looks like

let button = AVRoutePickerView(frame: frame)
button.delegate = self
button.tintColor = .white
button.activeTintColor = .white

if #available(iOS 13.0, *) {
  button.prioritizesVideoDevices = true
}

addSubview(button)

and I have added the following entry to our plist file:

AirPlay optimization policy : String : Long Form Video

And lastly I am setting .playback & .moviePlayback on the AVAudioSession.sharedInstance() application service.

class AudioSessionService : NSObject, ApplicationService {

  static func configureAudioSession() {
    do {
      try AVAudioSession.sharedInstance().setCategory(.playback, mode: .moviePlayback)
    } catch {}
  }

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    AudioSessionService.configureAudioSession()

    return true
  }

}

I can't find anything in Apple's docs about this. Any suggestions?


Solution

  • Apple regularly updates its designs, and this is what seems to have happened between iOS 12 & iOS 13 for Airplay. I couldn't find sources specifically on this matter, but since your code is pretty standard, and you rely on AVRoutePicker, you're doing nothing wrong :)