Adjust volume and mute

Learn how to monitor and respond to volume and mute state changes in the FastPix iOS Player.

The FastPix iOS Player provides delegate callbacks for tracking volume changes and mute state. Use these callbacks to keep your custom UI synchronized with the player’s audio state.

Listen to volume changes

Implement the following delegate method to receive notifications when the player’s volume level changes. The volume value ranges from 0.0 (silent) to 1.0 (maximum).

1func onVolumeChanged(
2 _ player: AVPlayerViewController,
3 volume: Float
4) {
5 // Volume range: 0.0 (silent) to 1.0 (max)
6 print("[Volume] Volume changed to \(volume)")
7}

Listen to mute state changes

Implement this delegate method to detect when the player is muted or unmuted:

1func onMute(
2 _ player: AVPlayerViewController,
3 isMuted: Bool
4) {
5 // true = muted, false = unmuted
6 print("[Volume] Mute state changed: \(isMuted)")
7}

Use these callbacks to update custom volume sliders, mute icons, or other UI elements so they stay in sync with the player’s audio state.