4

I have a video application in which I am using Airplay to stream the video. I am using the below code.

    let airView: MPVolumeView = MPVolumeView()
    airView.showsRouteButton = true
    airView.showsVolumeSlider = true
    airView.sizeToFit()
    airView.tintColor = UIColor.black
    airView.autoresizingMask = UIViewAutoresizing.flexibleWidth

    airplayButton = UIBarButtonItem(customView: airView)
    airplayButton.tintColor = UIColor.white
    self.navigationItem.setRightBarButtonItems([airplayButton], animated: true)

Using the code below, I can see the Airplay picker button, I can also see the volume slider however when I am connecting the airplay, the volume button disappears so our clients can not make volume up and down using the phone hardware button.

Is there a way to have either to prevent the disappearance of that button or support hardware volume support while playing Airplay?


Additional info:

When using older AirPlay devices such as an old AppleTV that users AirPlay1 the volume controls should work. However, when the same app is connected to an AirPlay2 device, the volume controls are removed. And in fact the data screen for the MPVolumeSlider is removed. The slider will return when connected back to the Phone or Bluetooth speakers.

Recently Apple deprecated the Router Button on MPVolumeView starting with iOS 13 and this new router view does not include a volume slider. It appears that Apple wants us to use either the rocker, airplay mirroring or the volume controls that the AVRouterView holds. This change becomes very confusing to the user as sometimes the slider is there and sometimes it isn't. Even if the slider is shown disabled with another slider, the user does not understand why they can use the rocker and sliders in the AVRouterView and not on the app itself with AirPlay2. They also don't even understand what AirPlay1 vs AirPlay2. Things such as metadata even work differently.

StarPlayrX
  • 33
  • 3
Saty
  • 2,563
  • 3
  • 37
  • 88
  • I agree it's annoying and confusing. I have two AirPort Express devices and while streaming to one of them the slider is not showing (surprisingly it's the older one) and for the other one the slider is visible. It's just stupid, if there is any workaround I would love to know it, Apple Music shows the volume slider no matter what – Adam Jan 18 '20 at 16:41
  • Any luck with this? – Arshia Aug 10 '21 at 15:47

0 Answers0