AirPlay
AirPlay is a proprietary wireless communication protocol stack/suite developed by Apple Inc. that allows streaming between devices of audio, video, device screens, and photos, together with related metadata. Originally implemented only in Apple's software and devices, it was called AirTunes and used for audio only. Apple has since licensed the AirPlay protocol stack as a third-party software component technology to manufacturers that build products compatible with Apple's devices.

History
AirPlay, then AirTunes, was introduced in iOS 4.2 and was compatible with Airport Express. 

Apple announced AirPlay 2 at its annual WWDC conference on June 5, 2017. It was scheduled for release along with iOS 11 in the third quarter of 2017, but was delayed until June 2018. Compared to the original version, AirPlay 2 improves buffering; adds streaming audio to stereo speakers; allows audio to be sent to multiple devices in different rooms; and control by Control Center, the Home app, or Siri, functionality that was only available previously using iTunes under macOS or Windows.

Senders
AirPlay sender devices include computers running iTunes, and iOS devices such as iPhones, iPods, and iPads running iOS 4.2 or greater, and devices can send AirPlay over Wi-Fi or ethernet. OS X Mountain Lion supports display mirroring via AirPlay on systems containing 2nd generation Intel Core processors or later.

In 2016, HTC released the "10", also known as "One M10", an Android phone with Apple AirPlay streaming.

As of iOS 4.3, third-party apps like ApowerMirror, AirServer, and Reflector may send compatible audio and video streams over AirPlay. The iTunes Remote app on iOS can be used to control media playback and select AirPlay streaming receivers for iTunes running on a Mac or PC.

As of macOS 10.14, there is no public API for third-party developers to integrate AirPlay 2 into their macOS apps. However, there are third-party streamers such as Airfoil. In May 2019, a third-party developer released a macOS app that can stream audio using AirPlay 2. The app includes a helper tool called "AirPlay Enabler" that uses code injection to bypass restrictions to the AirPlay 2 private API on macOS.

Receivers
AirPlay receiver devices include Apple TV, HomePod, other third-party speakers and the discontinued AirPort Express, which included a combined analog and optical S/PDIF audio output connector. Compatible devices can receive AirPlay over wi-fi or ethernet. Some open-source projects have reverse-engineered the audio part of the protocol, enabling any computer to be turned into an AirPlay receiver for audio.

However, because not all third-party receivers implement Apple's DRM encryption, some media, such as iTunes Store's own rights-protected music (Apple's own "FairPlay" encryption), YouTube, and Netflix, cannot stream to those devices or software. On Apple TV, starting with firmware 6.0, the DRM scheme is enforced: devices without it cannot be used.

AirPlay wireless technology is integrated into speaker docks, AV receivers, and stereo systems from companies such as Bose, Yamaha, Philips, Marantz, Onkyo, Bowers & Wilkins, Pioneer, Sony, Sonos, McIntosh, Denon, and Bang & Olufsen. Song titles, artists, album names, elapsed and remaining time, and album artwork can appear on AirPlay-enabled speakers with graphical displays. Often these receivers are built to only support the audio component of AirPlay, much like AirTunes.

Bluetooth devices (headsets, speakers) that support the A2DP profile also appear as AirPlay receivers when paired with an iOS device, although Bluetooth is a device-to-device protocol that does not rely on a wireless network access point.

During the January 2019 Consumer Electronics Show (CES) in Las Vegas, television makers Samsung, LG, Vizio, and Sony announced they would be producing sets with built-in AirPlay 2 receiving capability. LG announced that television models that are AirPlay 2-enabled will include the 2019 OLED, NanoCell SM9X, UHD UM7X, and LG NanoCell SM8X models.

In September 2020, Roku added AirPlay 2 support as part of the 9.4 update on select 4K Roku devices. In April 2021, the 10.0 update added support for more Roku TVs and Players.

During WWDC 2021, Apple announced that macOS Monterey would include AirPlay receiver compatibility for compatible Macs.

Protocols
AirPlay and AirTunes work over Wi-Fi. Originally, devices had to be connected to the same Wi-Fi network, but since iOS 8 devices can use Wi-Fi Direct and thus does not require an existing Wi-Fi network.

The AirTunes part of the AirPlay protocol stack uses UDP for streaming audio and is based on the Real Time Streaming Protocol. The streams are transcoded using the Apple Lossless codec with 44100 Hz and 2 channels symmetrically encrypted with AES, requiring the receiver to have access to the appropriate key to decrypt the streams. The stream is buffered for approximately 2 seconds before playback begins, resulting in a small delay before audio is output after starting an AirPlay stream.

The protocol supports metadata packets that determine the final output volume on the receiving end. This makes it possible to always send audio data unprocessed at its original full volume, preventing sound quality deterioration due to reduction in bit depth and thus sound quality which would otherwise occur if changes in volume were made to the source stream before transmitting. It also makes possible the streaming of one source to multiple targets each with its own volume control.
The AirPort Express' streaming media capabilities use Apple's Remote Audio Output Protocol (RAOP), a proprietary variant of RTSP/RTP. Using WDS-bridging, the AirPort Express can allow AirPlay functionality (as well as Internet access, file and print sharing, etc.) across a larger distance in a mixed environment of wired and up to 10 wireless clients.

AirPlay Mirroring  
At WWDC 2011, Steve Jobs, then CEO of Apple Inc., announced AirPlay Mirroring as a feature in iOS 5 where the user can stream the screen from an iPad 2 to a HDTV wirelessly and securely without the need for cables.

AirPlay is a different technology from AirPlay Mirroring, as the former allows specific content formats to be streamed while the latter that allows the whole screen to be broadcast from a variety of iOS devices and iTunes to an Apple TV (2nd Gen or later). The exact composition of the protocols that AirPlay Mirroring uses have not yet fully been discovered, or reverse-engineered. However, an unofficial AirPlay protocol specification is available. Supported hardware (when using OS X Mountain Lion or later) includes any 2011 or later iMac, Mac mini, MacBook Air, MacBook Pro, or the Mac Pro (late 2013 or newer).

Reverse engineering
When the protocol was known as AirTunes, it was reverse-engineered by Jon Lech Johansen in 2008.

On April 8, 2011, James Laird reverse-engineered and released the private key used by the Apple AirPort Express to decrypt incoming audio streams. The release of this key means that third-party software and devices modified to use the key will be able to decrypt and play back or store AirPlay streams. Laird released ShairPort as an example of an audio-only software receiver implementation of AirPlay. Soon more followed and in 2012 the first AirPlay audio and video receiver for PC came with a product called AirServer.

An open-source AirPlay server known as RPiPlay is available for the Raspberry Pi and Desktop Linux operating systems.

See also
 Google Cast
 Chromecast
 WiDi version 3.5 to 6.0 supports Miracast;  discontinued
 Miracast (wireless display technology)
 Universal Plug and Play (UPnP)
 Digital Living Network Alliance (DLNA)

 Wireless HDMI
 Wi-Fi Direct

cables for mobile equipment:
 Mobile High-Definition Link - MHL
 SlimPort (Mobility DisplayPort), also known as MyDP

Notes

External links
 
The Main Wireless HDMI Transmission Protocols and Their Typical Products Comparison of different wireless HDMI transmission protocols at Portablehifi.com

Wi-Fi
ITunes
Computer-related introductions in 2004
Wireless display technologies