<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iOSAppExtension: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NowPlaying",
  "identifier" : "/documentation/NowPlaying/MediaDevice/init(id:name:type:capabilities:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Now Playing"
    ],
    "preciseIdentifier" : "s:10NowPlaying11MediaDeviceV2id4name4type12capabilitiesACSS_SSAC0D4TypeOSayAC10CapabilityVGtcfc"
  },
  "title" : "init(id:name:type:capabilities:)"
}
-->

# init(id:name:type:capabilities:)

Creates a media device with the specified identifier, name, type, and capabilities.

```
init(id: String, name: String, type: MediaDevice.DeviceType, capabilities: [MediaDevice.Capability])
```

## Parameters

`id`

A stable, unique identifier for the device.

`name`

The human-readable name the system displays for the device.

`type`

The kind of device that plays media.

`capabilities`

The capabilities the device supports.
Each value in the array describes one operation the device supports, built from a
[`MediaDevice.Capability`](/documentation/NowPlaying/MediaDevice/Capability), such as [`absoluteVolume(_:onChange:)`](/documentation/NowPlaying/MediaDevice/Capability/absoluteVolume(_:onChange:)) or
[`relativeVolume(onIncrement:onDecrement:)`](/documentation/NowPlaying/MediaDevice/Capability/relativeVolume(onIncrement:onDecrement:)). Pass an empty array if the
device exposes no controllable capabilities.

## Discussion> Note: `id` should be a stable identifier for the device that works across sessions.

---

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)