Question

I am currently playing audio through AudioQueues. I would like to allow users to connect to Airplay devices.

If I create an MPVolumeView and use the 'showsRouteButton' to display the route button I can successfully connect.

Is there a way to change the Audio Route to Airplay without using the MPVolumeView? Or a simpler Apple view that is just the route button?

Was it helpful?

Solution

I don't think there is any other way to show the airplay route button (at least in current SDK iOS 5.1).. If you want to show AirPlay options you have to use MPVolumeView..

OTHER TIPS

1 hide MPVolumeView and make it as global var

CGRect frame = CGRectZero;
frame.origin.y = 0;
frame.origin.x = 410; // out of the screen
_volumeView = [[MPVolumeView alloc] initWithFrame:frame];
[_volumeView setShowsVolumeSlider:NO];
[_volumeView setShowsRouteButton:YES];
[self.view addSubview:_volumeView];

2 simulate button tapes

- (IBAction)handleAirPlay:(id)sender {
        for (UIButton *button in _volumeView.subviews)
        {
            if ([button isKindOfClass:[UIButton class]])
            {
                [button sendActionsForControlEvents:UIControlEventTouchUpInside];
            }
        }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top