iOS: Missing audio routes/sources in MPVolumeView

2019-08-15 10:51发布

I work on an audio app (using audio units).
One of the requirements is to be able to change the audio route from the UI (Earpiece, Speaker, Connected Bluetooth device etc.).
I use the MPVolumeView for this.

Recently I have a bug with the list of routes that are displayed in the action sheet that is opened when tapping the route button in the volume view.
I think that the problem appears only in iOS6, but not sure about that.
The result is random:

  • sometimes it displays only iPhone
  • sometimes it displays iPhone twice instead of iPhone and Speaker (in this case usually the icon near both 'iPHone' buttons is like it is a speaker - TV icon)
  • sometimes it works good
  • the Bluetooth is always displayed good

Some additional info:
The volume view is initiated only in Play&Record audio category.
The volume view is initiated and added to the screen only after the user taps a corresponding button on the screen. This button becomes available only after the category is switched to Play&Record (it is not immediate, so I set a listener to the route transitions and enable the button only after the route is REALLY changed).

Screenshots: enter image description here

enter image description here

If anyone has experienced this problem then please share a solution.

Thank you.

2条回答
叼着烟拽天下
2楼-- · 2019-08-15 11:42

I've seen this in the multitasking tray's route selection UI on my iPhone 4S and 5 running 6.0. I suspect it's an iOS bug.

查看更多
ら.Afraid
3楼-- · 2019-08-15 11:48

I have the same issue. What I've noticed is that it is related to the media currently being played. If it is not compatible with the Airplay / media device, then it does not appear in the list. For example, I want to play audio to a Bluetooth HFP device, which only supports 8Khz Audio. I've seen an app which modifies the audio to match the device, but don't know how they do that programmatically.

查看更多
登录 后发表回答