Skip to navigation

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:

// 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:

// 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:

// 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:

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

// 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:

let levels = playerViewController.getResolutionLevels()

Get the current quality level

let current = playerViewController.getCurrentResolutionLevel()

Switch to a specific quality level

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:

playerViewController.resetToAuto()

Load quality levels dynamically

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

playerViewController.qualityManager?.loadQualityLevels()

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

Handle quality change callbacks

Implement the quality delegate to receive updates:

// 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)")
}