<!--
{
  "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/Capability/absoluteVolume(_:onChange:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Now Playing"
    ],
    "preciseIdentifier" : "s:10NowPlaying11MediaDeviceV10CapabilityV14absoluteVolume_8onChangeAESf_ySfYaYbKctFZ"
  },
  "title" : "absoluteVolume(_:onChange:)"
}
-->

# absoluteVolume(_:onChange:)

Returns a capability that lets the device be set to a specific volume level.

```
static func absoluteVolume(_ currentLevel: Float, onChange: @escaping @Sendable (Float) async throws -> Void) -> MediaDevice.Capability
```

## Parameters

`currentLevel`

The current volume level of the device, in the range `0.0` to `1.0`.
The system uses this to display the device’s current volume in the interface.

`onChange`

An async closure the system calls when the user requests a new volume level.
The closure receives the requested new level in the range `0.0` to `1.0`.

## Discussion

Use this when the device supports setting an absolute volume level
in the range `0.0` to `1.0`, where `0` represents silence and `1.0` represents
the maximum volume level.

---

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)