<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaDevice",
  "identifier" : "/documentation/MediaDevice/MediaDeviceRoutingManager",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Media Device"
    ],
    "preciseIdentifier" : "s:11MediaDevice0aB14RoutingManagerC"
  },
  "title" : "MediaDeviceRoutingManager"
}
-->

# MediaDeviceRoutingManager

An object used by a [`MediaDeviceExtension`](/documentation/MediaDevice/MediaDeviceExtension) to report device discovery, state changes, and playback events back to the system.

```
@MainActor final class MediaDeviceRoutingManager
```

## Topics

### Instance Methods

[`func activatedDevice(MediaOutputDevice, session: MediaOutputSession)`](/documentation/MediaDevice/MediaDeviceRoutingManager/activatedDevice(_:session:))

Notifies the system that a device has been successfully activated and is ready for use.

[`func discoveryFailed(MediaDeviceError)`](/documentation/MediaDevice/MediaDeviceRoutingManager/discoveryFailed(_:))

Reports a discovery failure to the system, indicating that the extension was unable to search for devices.

[`func failedToActivateDevice(MediaOutputDevice, session: MediaOutputSession, error: MediaDeviceError)`](/documentation/MediaDevice/MediaDeviceRoutingManager/failedToActivateDevice(_:session:error:))

Reports a device activation failure to the system so it can inform the user and clean up the session.

[`func foundDevice(MediaOutputDevice)`](/documentation/MediaDevice/MediaDeviceRoutingManager/foundDevice(_:))

Notifies the system of a new media device, so it can be included in device lists for users to select.

[`func lostDevice(MediaOutputDevice)`](/documentation/MediaDevice/MediaDeviceRoutingManager/lostDevice(_:))

Removes a device from the system’s device lists so users can no longer select it.

[`func receiveData(Data, fromApplication: String, session: MediaOutputSession)`](/documentation/MediaDevice/MediaDeviceRoutingManager/receiveData(_:fromApplication:session:))

Delivers data received from a remote application to the system for processing.

[`func reportQualityMetricsPassed(Bool, forSession: MediaOutputSession)`](/documentation/MediaDevice/MediaDeviceRoutingManager/reportQualityMetricsPassed(_:forSession:))

Reports whether the realtime sample delivery session has met its quality KPIs.

[`func requestPairingCode(for: MediaOutputDevice, session: MediaOutputSession, reason: LocalizedStringResource, authorizationMethod: MediaOutputDevice.AuthorizationMethod)`](/documentation/MediaDevice/MediaDeviceRoutingManager/requestPairingCode(for:session:reason:authorizationMethod:))

Presents a pairing user interface so the user can enter authorization credentials for a device.

[`func sessionFailed(MediaOutputSession, error: MediaDeviceError)`](/documentation/MediaDevice/MediaDeviceRoutingManager/sessionFailed(_:error:))

Reports an unrecoverable session error to the system so it can end the session and inform the user.

[`func started<T>(application: String?, playbackControl: T, session: MediaOutputSession)`](/documentation/MediaDevice/MediaDeviceRoutingManager/started(application:playbackControl:session:))

Notifies the system that a remote application has successfully started on the target device.

[`func updateDevices([MediaOutputDevice])`](/documentation/MediaDevice/MediaDeviceRoutingManager/updateDevices(_:))

Notifies the system that one or more devices have changed state, so their information can be refreshed in device lists.

[`func volumeChanged(for: MediaOutputDevice)`](/documentation/MediaDevice/MediaDeviceRoutingManager/volumeChanged(for:))

Notifies the system that the volume state has changed on a remote device.

### Type Methods

[`static func routingManager(for: any MediaDeviceExtension) -> MediaDeviceRoutingManager`](/documentation/MediaDevice/MediaDeviceRoutingManager/routingManager(for:))

Returns the shared routing manager instance for a media device extension.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)