---
title: "init(id:name:type:capabilities:)"
framework: nowplaying
role: symbol
role_heading: Initializer
path: "nowplaying/mediadevice/init(id:name:type:capabilities:)"
---

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

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

## Declaration

```swift
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 doc://com.apple.nowplaying/documentation/NowPlaying/MediaDevice/Capability, such as doc://com.apple.nowplaying/documentation/NowPlaying/MediaDevice/Capability/absoluteVolume(_:onChange:) or doc://com.apple.nowplaying/documentation/NowPlaying/MediaDevice/Capability/relativeVolume(onIncrement:onDecrement:). Pass an empty array if the device exposes no controllable capabilities.

## Discussion

Discussion note: id should be a stable identifier for the device that works across sessions.
