Implementation guides

Since mDNS is not a standard component of all operating systems and it needs to be installed as a system service to work properly, here are some guides for implementing the discovery service of AirPlay server.

macOS & iOS

For macOS and iOS, there is no need to install any dependencies to publish services through mDNS, because Apple implemented Bonjour service in both macOS and iOS and exposed APIs for leveraging the capacity. For detailed information please refer to NSNetService

⚠️ NSNetService is deprecated now and will be removed from macOS 12, the alternative API can be found in Network Framework

Windows

For Windows system, Bonjour SDK for Windows is required at both compiling stage and runtime.

Android

Android system also has a pre-installed mDNS component, so we can implement the discover service without extra dependencies. There are two choices to implement the discovery service.

  1. Framework APIs Network Service Discovery

  2. Native APIs with libdnssd. There is no header files declaring the APIs to access the build-in mDNS components so we need to add the header file in the source repo. Please look into the header file dns_sd.h.

Linux

To implement discovery service on Linux system is a bit more complicated, because usually the dns-sd components is not installed. Avahi is recommended.