Set playback resolution

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:

1// Set minimum resolution
2playerViewController.prepare(
3 playbackID: playbackID,
4 playbackOptions: PlaybackOptions(minResolution: .atLeast270p)
5)
6
7// With a playback token
8playerViewController.prepare(
9 playbackID: playbackID,
10 playbackOptions: PlaybackOptions(
11 minResolution: .atLeast270p,
12 playbackToken: playbackToken
13 )
14)

Set a maximum resolution

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

1// Set maximum resolution
2playerViewController.prepare(
3 playbackID: playbackID,
4 playbackOptions: PlaybackOptions(maxResolution: .upTo1080p)
5)
6
7// With a playback token
8playerViewController.prepare(
9 playbackID: playbackID,
10 playbackOptions: PlaybackOptions(
11 maxResolution: .upTo1080p,
12 playbackToken: playbackToken
13 )
14)

Set a specific resolution

Lock playback to a single resolution:

1// Set a fixed resolution
2playerViewController.prepare(
3 playbackID: playbackID,
4 playbackOptions: PlaybackOptions(resolution: .set480p)
5)
6
7// With a playback token
8playerViewController.prepare(
9 playbackID: playbackID,
10 playbackOptions: PlaybackOptions(
11 resolution: .set480p,
12 playbackToken: playbackToken
13 )
14)

Set a resolution range

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

1// Set a resolution range
2playerViewController.prepare(
3 playbackID: playbackID,
4 playbackOptions: PlaybackOptions(
5 minResolution: .atLeast270p,
6 maxResolution: .upTo1080p
7 )
8)
9
10// With a playback token
11playerViewController.prepare(
12 playbackID: playbackID,
13 playbackOptions: PlaybackOptions(
14 minResolution: .atLeast270p,
15 maxResolution: .upTo1080p,
16 playbackToken: playbackToken
17 )
18)

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

1// Assign the delegate and initialize the quality manager
2playerViewController.qualityDelegate = self
3playerViewController.setupQualityManager(delegate: self)

Get available quality levels

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

1let levels = playerViewController.getResolutionLevels()

Get the current quality level

1let current = playerViewController.getCurrentResolutionLevel()

Switch to a specific quality level

1playerViewController.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:

1playerViewController.resetToAuto()

Load quality levels dynamically

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

1playerViewController.qualityManager?.loadQualityLevels()

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

Handle quality change callbacks

Implement the quality delegate to receive updates:

1// Called when quality levels are fetched and ready
2func onQualityLevelsUpdated(levels: [QualityLevel]) {
3 print("Quality levels available: \(levels.count)")
4}
5
6// Called when the resolution changes (user or ABR)
7func onQualityLevelChanged(selectedLevel level: QualityLevel) {
8 print("Switched to: \(level.label)")
9}
10
11// Called when a quality switch is in progress
12func onQualitySwitching(isSwitching: Bool) {
13 print("Switching in progress...")
14}
15
16// Called when quality switching fails
17func onQualityLevelFailed(error: QualityLevelError) {
18 print("Quality switch failed: \(error)")
19}