JWCaptionPositionBuilder
@objcMembers
public class JWCaptionPositionBuilder : NSObject, JWBuilder
The builder for creating a JWCaptionPosition
and verifying its properties.
-
Declaration
Swift
public typealias Output = JWCaptionPosition
-
Declaration
Swift
public func build() throws -> JWCaptionPosition
-
Specifies the width of caption box as a percentage in the range [0…100]. This is a percentage based on the width of the video player. If unspecified, the caption box will automatically resize to fit the caption text.
Note
If you specify a value outside of the range [0…100],build()
will throw an error.Declaration
Swift
@discardableResult public func width(percentage: Int) -> JWCaptionPositionBuilder
Parameters
percentage
The desired width of the caption box specified as a percentage in the range [0…100].
Return Value
The builder, so setters can be chained.
-
Specifies the alignment of the caption text within the caption box. If unspecified, the default value is
.center
.Declaration
Swift
@discardableResult public func alignment(_ alignment: JWCaptionAlignment) -> JWCaptionPositionBuilder
Parameters
alignment
The desired text alignment of the caption within its caption box.
Return Value
The builder, so setters can be chained.
-
Specifies the horizontal position of caption box as a percentage in the range [0…100]. This is a percentage based on the width of the video player. If unspecified, the default value is
50
.Note
If you specify a value outside of the range [0…100],build()
will throw an error.Note
This value is not observed ifwidth
has not been specified.Declaration
Swift
@discardableResult public func horizontalPosition(percentage: Int) -> JWCaptionPositionBuilder
Parameters
percentage
The desired position of the caption box specified as a percentage in the range [0…100].
Return Value
The builder, so setters can be chained.
-
Specifies the vertical position of caption box as a percentage in the range [0…100]. This is a percentage based on the height of the video player.
Note
Do not call this method if you are also callingverticalPosition(lineIndex:)
, orbuild()
will throw an error.Note
If you specify a value outside of the range [0…100],build()
will throw an error.Declaration
Swift
@discardableResult public func verticalPosition(percentage: Int) -> JWCaptionPositionBuilder
Parameters
percentage
The desired position of the caption box specified as a percentage in the range [0…100].
Return Value
The builder, so setters can be chained.
-
Specifies the vertical position of caption box as a line index.
If this is expressed as a negative number it counts the lines starting at the bottom edge of the video player. If it is a positive number it counts the lines starting from the top edge of the player. The height of a line is dependent on the font being used for the caption.
Note
Do not call this method if you are also callingverticalPosition(percentage:)
, orbuild()
will throw an error.Declaration
Swift
@discardableResult public func verticalPosition(lineIndex: Int) -> JWCaptionPositionBuilder
Parameters
lineIndex
The desired position of the caption box specified as a line index.
Return Value
The builder, so setters can be chained.