BlazeMomentsPlaybackConfiguration - iOS
The moments player's playback behavior can be customized using the BlazeMomentsPlaybackConfiguration on the global BlazeSDK.setDefaultMomentsPlaybackConfiguration method, or for specific widgets utilizing the momentsPlaybackConfiguration property.
The playback configuration controls aspects like loop behavior, which determines how moments repeat and advance to the next moment. This is separate from visual styling (handled by BlazeMomentsPlayerStyle).
Presets
BlazeMomentsPlaybackConfiguration.base()
Returns a BlazeMomentsPlaybackConfiguration instance with default playback settings. This can be used to customize playback behavior without affecting the player's visual style.
// Get the base configuration and customize it
var playbackConfig = BlazeMomentsPlaybackConfiguration.base()
playbackConfig.loopBehavior = .loopAndAdvance(numberOfPlays: 3)
// Use the customized configuration globally
Blaze.shared.setDefaultMomentsPlaybackConfiguration(playbackConfig)
// Or use it for a specific Moments widget
let widgetView = BlazeMomentsWidgetView()
widgetView.momentsPlaybackConfiguration = playbackConfigConfiguration Properties
loopBehavior
Controls how moments loop and advance to the next moment in the sequence.
- Default:
.infiniteLoop - Type:
BlazeMomentsLoopBehavior
The loopBehavior property accepts one of two values:
.infiniteLoop
.infiniteLoopThe moment will loop infinitely until the user manually navigates to the next moment. This is the default behavior.
var config = BlazeMomentsPlaybackConfiguration.base()
config.loopBehavior = .infiniteLoop
Blaze.shared.setDefaultMomentsPlaybackConfiguration(config).loopAndAdvance(numberOfPlays: Int)
.loopAndAdvance(numberOfPlays: Int)The moment will loop a specified number of times, then automatically advance to the next moment in the sequence.
- Parameter:
numberOfPlays- The number of times the moment should play before advancing. Must be at least 1. Values less than 1 will be automatically adjusted to 1.
Example: If numberOfPlays is set to 3, the moment will play 3 times before automatically transitioning to the next moment in the sequence.
var config = BlazeMomentsPlaybackConfiguration.base()
config.loopBehavior = .loopAndAdvance(numberOfPlays: 3)
Blaze.shared.setDefaultMomentsPlaybackConfiguration(config)Note: When using .loopAndAdvance(numberOfPlays:), the numberOfPlays value must be at least 1. Values less than 1 will be automatically adjusted to 1 during initialization.
bufferingSpinnerDelay
The delay in seconds before the buffering spinner becomes visible during playback.
If the player finishes buffering before this threshold elapses, the spinner is never shown.
- Default:
1.0seconds - Type:
TimeInterval - Min:
0(spinner appears immediately on buffering)
var config = BlazeMomentsPlaybackConfiguration.base()
config.bufferingSpinnerDelay = 0.5
Blaze.shared.setDefaultMomentsPlaybackConfiguration(config)Updated 11 days ago
