Why is MPVolumeViewWirelessRouteActiveDidChangeNotification not fired when active route is changed?

In my app, the user begins AirPlay by selecting an AirPlay device from the Route list in MPVolumeView.


This causes the notification MPVolumeViewWirelessRouteActiveDidChangeNotification to be fired.


However, if the user then taps the Route button again, and selects a different AirPlay device, playback routing does change (the video now plays on the new AirPlay target device) but the notifications was NOT fired again, or on subsequent changes to the active route (airplay device).


What's the story? Shouldn't this notification be sent out each time the user changes the active route (via the MPVolumeView route button?).

Replies

Try listening for the AVAudioSessionRouteChangeNotification notification, it will fire anytime an audio route changes (headphones, speaker, airplay, etc.).

According to documentation,

MPVolumeViewWirelessRouteActiveDidChange notification "is posted when the isWirelessRouteActive property changes".

Since you move from one wireless Airplay device to another wireless Airplay device, I presume the property isWirelessRouteActive stays to true, so the notification is not poster.


As @atommclain says, use the AVAudioSessionRouteChangeNotification notification.