How To Use Airplay In iOS Devices

Airplay, previously known as AirTunes, was used for streaming your music in your network and then listening to it in all over your house/work station/or any place from your devices. Previously as AirTunes, It was used for only streaming of music. Now it is called "AirPlay" and supports wireless streaming of all types of media like audio, video, photos.

Now think, you are watching a video into your iPhone (it may be live or already stored into your app or in iTunes) and you want to play the video in a big screen for making everyone from your family to see it or playing an audio (it may be live or already stored into your app or in iTunes) and you want it to play into your home theatre system. But how will you do that? The answer is "Airplay". For this purpose, apple has developed AirPlay.

It is a great feature provided by iOS 7. From all features of iOS 7 AirPlay is most usable and helpful by users. AirPlay allows user to redirect the audio and video to the high-definition displays and audio systems. AirPlay can be used to redirect audio and video from iTunes or iOS app to apple TV or to an AirPlay enabled sound systems. AirPlay can stream audio and video live from Internet or already stored into iTunes or any iOS based device.

As of now we know that AirPlay is used to redirect audio and video from iOS app or already stored in iTunes or iOS compatible device. But here the most important thing is that "AirPlay is user controlled".

How to use AirPlay in iOS devices?

Necessary conditions for AirPlay:

1) Your device should be one of the following (iOS 5.0 or later)
a. iPhone 4s (or later)
b. iPad 2 (or later)
c. iPad mini
d. iPod Touch (5th Generation)
2) Apple TV (2nd or 3rd Generation) or MAC Mini (2011 mid onwards)
3) Wi-Fi (802.11a/g/n) network

Enable AirPlay
1) Connect your iOS device and your Apple TV on the same Wi-Fi network
2) On your iOS device, double click the home button to see the recent used apps
3) Swipe the recent used apps from left to right until you see the AirPlay icon.
4) Tap AirPlay icon to display all the output devices available for AirPlay.
5) Select the Apple TV and toggle ON/OFF slider to ON.

Now as developer perspective, you should know that whatever content you are providing for AirPlay should be compatible to AirPlay and should also verify that your app or website works correctly for implementing it in your application. As an iOS developer, you can make it very interesting to use AirPlay in many ways. You should provide enough content to the user to feel the experience of AirPlay.

For example:
- User should get a list of output devices in which he/she can redirect the content.
- You should provide audio metadata while playing audio using AirPlay.
- Should always listen and respond to the events occurring while playing the content through AirPlay. For example if user wants to pause the audio or video, it should be able to get the event for pause and when wants to play, should be able to get the play event.

Prepare Your Media and Server for AirPlay:

To play your media over AirPlay, your media should be able to play in iOS based devices such as iPhone, iPod and iPad. For your server to work with AirPlay, it needs to be configured to send audio and video over HTTP.

When preparing media for AirPlay, one should keep in mind following things.
- Encode your audio using mono or stereo AAC or MP3 compression.
- Encode your video using H.264 compression.
o Use baseline profile 3.0, if you want to play your video on iPhone 3G or earlier.
o For playback in iPhone 4 or later, iPod touch, iPad and apple TV use baseline profile 3.1.
o Use main profile 3.1, if you want to play your video on iPad, OS X and Apple TV.
- Use a QuickTime reference movie or an alternate-stream playlist to provide an alternative version of audio/video content with an AC3 surround-sound track and high-definition video to be used when your media is being played through a home theater system.

You can package your media in .mp3, .aac, .m4a, .m4v, .mp4 and .mov files. You can also generate .m3u8 playlists but these are automatically generated by HTTP live streaming which also generates .ts files from the media. The AirPlay enabled sound system that is playing your media may support AC3 surround-sound audio also. You can provide an alternate stream that has an AC3 selection to give your app richer sound when your output device supports it. Same as audio your video output device also may support high definition video, for that provide 1280*720 video stream to support richest display possible.

Configure Your Server:

As we know for AirPlay, your server needs to be configured for sending audio and video over HTTP. The most important step in configuring your server is to set proper MIME type for each supported file type.

If you are using HTTP live streaming to deliver your media, you can increase transmission efficiency by enabling on-the-fly gzip compression of .m3u8 files from your server.

Post a Comment