Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPVolumeView AirPlay button not showing up

Using MPVolumeView I wanted to create an AirPlay output button for the app's audio.

MPVolumeView *volumeView = [ [MPVolumeView alloc] initWithFrame:CGRectMake(20, 20, 220, 20)];
    [volumeView setShowsVolumeSlider:NO];
    [volumeView setShowsRouteButton:YES];
    [volumeView sizeToFit];
    [self.view addSubview:volumeView];
    [volumeView release];

Errors / issues none but it doesn't show up, any ideas?
Thanks!

like image 561
Peter V Avatar asked Dec 20 '22 06:12

Peter V


1 Answers

It may be that you're placing your VolumeView against a white background. The Airplay route button is white before it's used (i.e.: when it's not routing via AirPlay), so if you put the control against a white background, you won't see it but it'll respond to taps. Change the background to something like red, as above, and it shows.

like image 154
Woodster Avatar answered Dec 24 '22 11:12

Woodster