> 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.

# Set playback resolution

> Learn how to control video playback resolution and adaptive bitrate streaming in the FastPix iOS Player.

Learn how to control video playback resolution and adaptive bitrate streaming in the FastPix iOS Player.

The FastPix iOS Player gives you flexibility to customize video playback resolution. You can set minimum, maximum, or specific resolution values, and let users choose their preferred quality level. The SDK also supports adaptive bitrate streaming (ABR) for automatic quality adjustments based on network conditions.

## Set a minimum resolution

Ensure the player only streams video at or above a specified resolution:

```swift
// Set minimum resolution
playerViewController.prepare(
    playbackID: playbackID,
    playbackOptions: PlaybackOptions(minResolution: .atLeast270p)
)

// With a playback token
playerViewController.prepare(
    playbackID: playbackID,
    playbackOptions: PlaybackOptions(
        minResolution: .atLeast270p,
        playbackToken: playbackToken
    )
)
```

## Set a maximum resolution

Ensure the player only streams video up to a specified resolution:

```swift
// Set maximum resolution
playerViewController.prepare(
    playbackID: playbackID,
    playbackOptions: PlaybackOptions(maxResolution: .upTo1080p)
)

// With a playback token
playerViewController.prepare(
    playbackID: playbackID,
    playbackOptions: PlaybackOptions(
        maxResolution: .upTo1080p,
        playbackToken: playbackToken
    )
)
```

## Set a specific resolution

Lock playback to a single resolution:

```swift
// Set a fixed resolution
playerViewController.prepare(
    playbackID: playbackID,
    playbackOptions: PlaybackOptions(resolution: .set480p)
)

// With a playback token
playerViewController.prepare(
    playbackID: playbackID,
    playbackOptions: PlaybackOptions(
        resolution: .set480p,
        playbackToken: playbackToken
    )
)
```

## Set a resolution range

Define both a minimum and maximum resolution to stream video within a specific range:

```swift
// Set a resolution range
playerViewController.prepare(
    playbackID: playbackID,
    playbackOptions: PlaybackOptions(
        minResolution: .atLeast270p,
        maxResolution: .upTo1080p
    )
)

// With a playback token
playerViewController.prepare(
    playbackID: playbackID,
    playbackOptions: PlaybackOptions(
        minResolution: .atLeast270p,
        maxResolution: .upTo1080p,
        playbackToken: playbackToken
    )
)
```

## Use adaptive bitrate streaming (ABR)

ABR automatically adjusts video quality based on network conditions, reducing buffering and improving playback stability. The SDK also supports manual resolution switching, letting users select specific quality levels during playback.

### Set up the quality manager

```swift
// Assign the delegate and initialize the quality manager
playerViewController.qualityDelegate = self
playerViewController.setupQualityManager(delegate: self)
```

### Get available quality levels

Each `QualityLevel` includes a label (for example, "Auto", "240p", "720p"), bitrate, resolution, and an `isAuto` flag:

```swift
let levels = playerViewController.getResolutionLevels()
```

### Get the current quality level

```swift
let current = playerViewController.getCurrentResolutionLevel()
```

### Switch to a specific quality level

```swift
playerViewController.setResolutionLevel(level)
```

> **Note:** Playback continues from the same position. The player might buffer briefly during the switch.

### Reset to auto mode

Switch back to ABR so the player adjusts quality automatically:

```swift
playerViewController.resetToAuto()
```

### Load quality levels dynamically

Quality levels become available only after playback starts. Trigger loading manually when the player is ready:

```swift
playerViewController.qualityManager?.loadQualityLevels()
```

Trigger this when `player.timeControlStatus == .playing` for accurate detection.

### Handle quality change callbacks

Implement the quality delegate to receive updates:

```swift
// Called when quality levels are fetched and ready
func onQualityLevelsUpdated(levels: [QualityLevel]) {
    print("Quality levels available: \(levels.count)")
}

// Called when the resolution changes (user or ABR)
func onQualityLevelChanged(selectedLevel level: QualityLevel) {
    print("Switched to: \(level.label)")
}

// Called when a quality switch is in progress
func onQualitySwitching(isSwitching: Bool) {
    print("Switching in progress...")
}

// Called when quality switching fails
func onQualityLevelFailed(error: QualityLevelError) {
    print("Quality switch failed: \(error)")
}
```