JWCaptionStyleBuilder
@objcMembers
public class JWCaptionStyleBuilder : NSObject, JWBuilder
The builder for JWCaptionStyle.
-
Declaration
Swift
public typealias Output = JWCaptionStyle
-
Builds a
JWCaptionStyle
structure describing how captions should look if accessibility settings are not defined by the user.Throws
throws An error if the style is not setup properly.Declaration
Swift
public func build() throws -> JWCaptionStyle
-
Sets the font style and font size.
Declaration
Swift
@discardableResult public func font(_ font: UIFont) -> JWCaptionStyleBuilder
Parameters
font
The font to be set on captions.
Return Value
The builder, so setters can be chained.
-
Sets the size of the font.
Declaration
Swift
@discardableResult public func fontSize(_ fontSize: CGFloat) -> JWCaptionStyleBuilder
Parameters
fontSize
The size for the captions.
Return Value
The builder, so setters can be chained.
-
Sets the font color of the captions.
Declaration
Swift
@discardableResult public func fontColor(_ fontColor: UIColor) -> JWCaptionStyleBuilder
Parameters
fontColor
The color for the captions, including its opacity.
Return Value
The builder, so setters can be chained.
-
Sets the background color and the opacity of the overall window the captions reside in
Declaration
Swift
@discardableResult public func backgroundColor(_ backgroundColor: UIColor) -> JWCaptionStyleBuilder
Parameters
backgroundColor
The color to set on the background of the captions.
Return Value
The builder, so setters can be chained.
-
Sets the opacity for the captions’ overlay window.
Values outside this range will be clamped to within this range.
Declaration
Swift
@discardableResult public func backgroundOpacity(_ backgroundOpacity: CGFloat) -> JWCaptionStyleBuilder
Parameters
backgroundOpacity
The transparency for the captions’ overlay window. Possible values are between 0.0 (transparent) and 1.0 (opaque).
Return Value
The builder, so setters can be chained.
-
Sets the opacity for the captions text.
Warning
Low values may make the captions unreadable.Values outside this range will be clamped to within this range.
Declaration
Swift
@discardableResult public func textOpacity(_ textOpacity: CGFloat) -> JWCaptionStyleBuilder
Parameters
textOpacity
The transparency for the captions text. Possible values are between 0.0 (transparent) and 1.0 (opaque).
Return Value
The builder, so setters can be chained.
-
Sets the edge style emphasis around text. The available options are: none, dropshadow, raised, depressed, and uniform.
Declaration
Swift
@discardableResult public func edgeStyle(_ edgeStyle: JWCaptionEdgeStyle) -> JWCaptionStyleBuilder
Parameters
edgeStyle
The style to apply to the captions.
Return Value
The builder, so setters can be chained.
-
Sets the video override strategy. The available options are:
videoOverrideOnly
, andalways
.Declaration
Swift
@discardableResult public func overrideStrategy(_ strategy: JWCaptionStyleOverrideStrategy) -> JWCaptionStyleBuilder
Parameters
strategy
The strategy to use when applying style changes to side-loaded captions.
Return Value
The builder, so setters can be chained.
-
Sets the highlight color and highlight opacity of the text.
Declaration
Swift
@discardableResult public func highlightColor(_ highlightColor: UIColor) -> JWCaptionStyleBuilder
Parameters
highlightColor
The color to be set on the highlight of the text.
Return Value
The builder, so setters can be chained.
-
Sets the default position of side-loaded captions displayed in the player.
This position is used if no position is specified by the caption itself, and this is only used with side-loaded captions. Because SRT captions contain no positional data, SRT captions will always be displayed using what is described by this property. For WebVTT captions, if no positional data is specified within the caption, the default position of the caption will be equal to what is described by this property.
Declaration
Swift
@discardableResult public func position(_ position: JWCaptionPosition) -> JWCaptionStyleBuilder
Parameters
position
The desired default position of the rendered captions.
Return Value
The builder, so setters can be chained.
-
This property controls whether side-loaded captions will be enlarged for larger player sizes.
If
true
, the side-loaded captions will be enlarged for large player sizes such as when the player is full screen. Iffalse
, the captions will retain their default assigned size, whether that is from the defined style by the developer or from the user’s accessibility settings.Note
This only affects the rendering of side-loaded captions.Declaration
Swift
@discardableResult public func allowScaling(_ allowed: Bool) -> JWCaptionStyleBuilder
Parameters
allowed
If
true
, the captions will scale. Iffalse
, the captions will not scale. The default value istrue
.Return Value
The builder, so setters can be chained.