Table of Contents

Class AirPlayServiceInfo

Namespace
AppleTvControlLibrary.Discovery.AirPlay
Assembly
AppleTvControlLibrary.Discovery.dll

AirPlay specific constants and parsing helpers for mDNS discovery.

public static class AirPlayServiceInfo
Inheritance
AirPlayServiceInfo
Inherited Members

Fields

SERVICE_TYPE

The AirPlay mDNS service type.

public const string SERVICE_TYPE = "_airplay._tcp.local"

Field Value

string

Methods

GetPairingRequirement(IReadOnlyDictionary<string, string>)

Derives the pairing requirement for an AirPlay service from its "acl", "model", and "sf"/"flags"/"act" TXT records.

public static AirPlayPairingRequirement GetPairingRequirement(IReadOnlyDictionary<string, string> properties)

Parameters

properties IReadOnlyDictionary<string, string>

The service's decoded TXT record properties.

Returns

AirPlayPairingRequirement

The derived pairing requirement.

GetUniqueId(IReadOnlyDictionary<string, string>)

Returns the stable unique identifier for an AirPlay service, from the "deviceid" TXT record, or null if not present.

public static string? GetUniqueId(IReadOnlyDictionary<string, string> properties)

Parameters

properties IReadOnlyDictionary<string, string>

The service's decoded TXT record properties.

Returns

string

The unique identifier, or null.

IsAppleTv(IReadOnlyDictionary<string, string>)

Determines whether a discovered AirPlay service's "model" TXT record identifies it as an Apple TV, as opposed to another AirPlay-capable device (e.g. a receiver or speaker).

public static bool IsAppleTv(IReadOnlyDictionary<string, string> properties)

Parameters

properties IReadOnlyDictionary<string, string>

The service's decoded TXT record properties.

Returns

bool

true if the "model" property matches the Apple TV identifier pattern.

RemoveNameCollisionSuffix(string)

Removes a trailing mDNS instance-name disambiguation suffix (e.g. " (2)") from a service name, for display and storage purposes. The suffix is added by the network's mDNS responder when the same name is advertised by more than one device (e.g. an Apple TV and an unrelated AirPlay device both named "Office") and carries no protocol meaning.

public static string RemoveNameCollisionSuffix(string name)

Parameters

name string

The raw mDNS service instance name.

Returns

string

The name with any trailing " (n)" suffix removed.

ToDiscoveryResult(Service)

Converts a parsed mDNS Service into an AirPlayDiscoveryResult.

public static AirPlayDiscoveryResult ToDiscoveryResult(Service service)

Parameters

service Service

The parsed mDNS service.

Returns

AirPlayDiscoveryResult

The AirPlay-specific discovery result.