GuidesAPI ReferenceRelease Notes
HomeLog InHome
Guides

BlazeCaptionsStyle

BlazeCaptionsStyle controls how closed captions look inside the Experiences player: caption font and the position of the captions box.

The same type is shared by Moments, Stories, and Videos through the captions property on:

Use this type for how captions look on screen. To show or hide the CC button, set the buttons style on the player instead.

Properties

font

var font: UIFont?

Font used for captions text.

  • Pass a custom UIFont to set the caption typeface. The SDK embeds that font in the captions web view with @font-face, and uses the font's point size as the base caption size (then scales it for the viewer's accessibility text-size setting).
  • Pass nil to keep the caption renderer's default font family and apply only the default size.

positioning

var positioning: BlazeCaptionsPositioning

Position of the captions box in the player. See BlazeCaptionsPositioning below.

Use BlazeCaptionsPositioning.base() for the renderer's default look (leading / top). When positioning stays at .base(), the SDK leaves the native caption layout unchanged.

Default values

BlazeCaptionsStyle has no public initializer. Each player preset already includes a captions style. Start from a preset player style and override only what you need.

The captions style starts from these defaults:

PropertyDefault value
font.systemFont(ofSize: 15)
positioning.base() (horizontal: .start, vertical: .top)

Usage

Moments player

var momentsPlayerStyle = BlazeMomentsPlayerStyle.base()

momentsPlayerStyle.captions.font = UIFont(name: "Helvetica Neue", size: 16)

momentsPlayerStyle.captions.positioning.xPosition = .center
momentsPlayerStyle.captions.positioning.yPosition = .bottom

Stories player

var storyPlayerStyle = BlazeStoryPlayerStyle.base()
storyPlayerStyle.captions.positioning.yPosition = .bottom

Videos player

var videosPlayerStyle = BlazeVideosPlayerStyle.base()
videosPlayerStyle.captions.font = UIFont.systemFont(ofSize: 18, weight: .medium)

videosPlayerStyle.captions.positioning.xPosition = .custom(offsetPercent: 10)
videosPlayerStyle.captions.positioning.yPosition = .custom(offsetPercent: 80)

BlazeCaptionsPositioning

Horizontal and vertical position of the captions box in the player. Configure each axis independently (for example, horizontal center with a custom vertical offset).

Properties

PropertyTypeDescription
xPositionBlazeCaptionsXPositionHorizontal position of the captions box.
yPositionBlazeCaptionsYPositionVertical position of the captions box.

base()

static func base() -> BlazeCaptionsPositioning

Default captions positioning (xPosition = .start, yPosition = .top), matching the renderer's native look.

BlazeCaptionsXPosition

Horizontal position of the captions box.

ValueDescription
startAlign to the leading edge of the player. Default look.
centerCenter the captions box and its text horizontally.
custom(offsetPercent: Int)Offset from the leading edge as a percent of player width. Values are coerced into 0...100.

BlazeCaptionsYPosition

Vertical position of the captions box.

ValueDescription
topAlign to the top edge of the player. Default look.
centerCenter the captions box vertically.
bottomAlign to the bottom edge of the player.
custom(offsetPercent: Int)Offset from the top edge as a percent of player height. Values are coerced into 0...100.

Did this page help you?