AirPlay discovery in Apple devices
Intro to AirPlay
AirPlay is Apple’s technology for streaming photos, video, or audio—and for mirroring from Apple devices to Apple TV. Mirrored content could be content that’s on the device, or live streams of what’s happening on the device screen. To use AirPlay, devices don’t need to be on the same network, or on any network at all.
A device can discover Apple TV using any of three methods:
Bluetooth IP address advertisement
Devices prefer peer-to-peer discovery but will typically establish a connection using the method that’s the most responsive or the one most recently used.
To learn more about Bonjour, see Bonjour overview.
Apple TV also broadcasts its AirPlay capabilities using a Bluetooth Low Energy (BTLE) advertisement that contains the IP address of the Apple TV (Apple TV HD uses Bluetooth version 4 and Apple TV 4K uses Bluetooth version 5). Apple devices within close proximity of the Apple TV, generally within the same room, hear those advertisements and attempt to establish an AirPlay session over the existing network. This method doesn’t use Bonjour, nor does it require that both devices be on the same network. As long as the devices are within Bluetooth range to hear the advertisement and there are no firewalls restricting access from the source device to the Apple TV, this method should work. To find the model number of an Apple TV, see the Apple Support article Identifying Apple TV models.
iPhone, iPad, Mac, and Apple TV devices have the ability to do peer-to-peer discovery. This is used for more than just AirPlay. AirDrop, Continuity, and other device-to-device technologies take advantage of the same technology.
When looking for other devices, an Apple device broadcasts a very small Bluetooth advertisement indicating that it’s looking for peer-to-peer services. When any peer-to-peer-capable device hears this BTLE packet, it creates or joins a peer-to-peer network directly between the devices. The devices concurrently switch between this temporary network and the infrastructure network(s) they were on before in order to deliver both the AirPlay video stream and provide existing internet service. The temporary network typically operates on Wi-Fi channel 149+1, but depending on the hardware involved, may also include channel 6, or channel 149,80. The devices follow the same frequency use rules on the temporary network as they do with any other Wi-Fi connection to avoid disrupting any existing infrastructure networks that might already be using those channels.
Important: Some countries and regions may set their own regulations for channel 149. For more information, check the 5 GHz section of the List of WLAN channels wikipedia webpage. Where use of channel 149 isn’t allowed, the temporary peer-to-peer network will operate on Wi-Fi channel 44, and in most of Europe, on Wi-Fi channel 42.
It’s also important to note that neither device must be associated with an existing infrastructure network for peer-to-peer discovery to work, though it’s encouraged for software updates and internet-provided content. Peer-to-peer Airplay requires the following hardware:
Apple TV HD with tvOS 9.0 or later, or Apple TV 4K with tvOS 11.0 or later
iPhone, iPad, and Mac computers from late 2012 or later running the latest version of the operating system
Apple TV also contains a setting that allows you to choose—or manage with a mobile device management (MDM) payload—how users connect:
Everyone can use AirPlay: Users connect only over peer-to-peer to Apple TV.
Anyone on the same network can use AirPlay: Users on the same Wi-Fi network can AirPlay to Apple TV.
Off: AirPlay is disabled, and users won’t be able to AirPlay toApple TV.