2

SOLVED With iOS 10.2 AirPlay button has reappeared and it still works. Apple poltergeist!

In iOS 9 I used this code to detect Airplay devices. With deployment target 10.00 it doesn't appear. In Control Center I can find my airplay devices, but in my app the uiview doesn't show anything. In my capabilities I have checked under "background mode", Audio, AirPlay and picture in picture. Maybe I forget some new setting of this blessed sandbox? Thanks for your patience

@property (weak, nonatomic) IBOutlet UIView *airplay;

MPVolumeView *myVolumeView = [[MPVolumeView alloc] initWithFrame: airplay.bounds];
[myVolumeView setShowsVolumeSlider:NO];
[myVolumeView setShowsRouteButton:YES];
myVolumeView.transform = CGAffineTransformMakeScale(0.3,0.3);
[myVolumeView setRouteButtonImage:[UIImage imageNamed:@"myIconAirPlay"] forState:UIControlStateNormal];
[airplay addSubview: myVolumeView];
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Joannes
  • 2,569
  • 3
  • 17
  • 39

1 Answers1

0

From apple doc :

If there is an Apple TV or other AirPlay-enabled device in range, the route button allows the user to choose it. If there is only one audio output route available, the route button is not displayed. https://developer.apple.com/reference/mediaplayer/mpvolumeview

Have you checked if var areWirelessRoutesAvailable: Bool { get } returns true or false on the MPVolumeView ?

I thinks it's the reason why your button is no longer appearing, It wouldn't be new if iOS10 update broke some Airplay devices until they have been updated too.

Dean
  • 1,512
  • 13
  • 28
  • It is only for audio output. In Spotify, for example, I can show, in app, AirPlay audio devices. How can I get the same? – Joannes Oct 14 '16 at 07:50