AirPlay button on user view

4.3 finally :) I'm looking right now how to add an air play button to user mode. I have an MPMoviePlayer that downloads a movie. I turned off the standard controls and added a blend mode using my custom buttons for play, pause, stop, volume. If anyone knows how to add a button that will play on the air, please share your knowledge? I can’t find which notification to send, what to listen to ... :(

+6
ios objective-c iphone mpmovieplayercontroller airplay
source share
3 answers

EDIT It seems I was mistaken in my previous answer because the device did not launch the released version of iOS 4.3.

There is a way to provide an AirPlay button on the user interface.
Use MPVolumeView and add it to your view hierarchy

 MPVolumeView *myVolumeView = [[MPVolumeView alloc] initWithFrame: overlayView.bounds]; [overlayView addSubview: myVolumeView]; [myVolumeView release]; 

MPVolumeView provides a volume slider and a route button (see image below). But I do not think that only a button can be displayed.

MPVolumeView at the bottom

+15
source share

If you want only the AirPlay button without the volume slider to follow the instructions in the Jilouc answer, then set the following properties in myVolumeView:

 [myVolumeView setShowsVolumeSlider:NO]; [myVolumeView setShowsRouteButton:YES]; 

This will hide the volume slider but retain the route button.

+39
source share

In Documentation, Apple also includes a snippet for this:

 MPVolumeView *volumeView = [ [MPVolumeView alloc] init] ; [volumeView setShowsVolumeSlider:NO]; [volumeView sizeToFit]; [view addSubview:volumeView]; 
+2
source share

All Articles