> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fastpix.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fastpix.com/docs/_mcp/server.

# Adjust volume and mute

> Learn how to control volume and mute state in the FastPix Android Player.

Learn how to control volume and mute state in the FastPix Android Player.

## Set volume

Set the player volume on a scale from `0.0` (silent) to `1.0` (maximum). Values are clamped to this range.

```kotlin
player.setVolume(0.75f)           // Set volume to 75%
val vol = player.getVolume()      // Get current volume level
```

## Mute and unmute

```kotlin
player.mute()     // Mute — stores the current volume for later restore
player.unmute()   // Unmute — restores the previous volume (defaults to 1.0)
```

`mute()` stores the current non-zero volume level. `unmute()` restores it, or defaults to `1.0` if no previous volume was saved.

## Listen for volume changes

The SDK monitors system volume while at least one playback listener is attached. It fires callbacks for both programmatic and hardware button volume changes:

```kotlin
override fun onVolumeChanged(volumeLevel: Float) {
    // Device volume changed (0.0..1.0)
}

override fun onMuteStateChanged(isMuted: Boolean) {
    // Mute state changed
}
```

Use these callbacks to keep custom volume sliders and mute icons synchronized with the player's audio state.