JWCueTime
@objcMembers
public class JWCueTime : NSObject
This object represents a position in the media where a cue begins or ends.
Cue times can be represented in one of two ways. First, the time can be represented a number of seconds into the media.
Second, it can be expressed as a percentage. The percentage is calculated based on the duration of the content.
-
The number of seconds into the content.
This will only return a valid value if this object was initialized with a number of seconds. If this object was initialized with a percentage, this property will return
Double.nan
.Declaration
Swift
public var seconds: TimeInterval { get }
-
The point at which the cue exists within the video, expressed as a percentage of the duration from 0 - 100.
This will only return a valid value if this object was initialized with a percentage of the duration. If this object was initialized with a number of seconds, this property will return
Double.nan
.Declaration
Swift
public var percentage: Double { get }
-
Initialize with a
TimeInterval
value.Note
This initializer will fail if the value is not a positive number, or a non-real number. Doing so will returnnil
.Declaration
Swift
public init?(seconds: TimeInterval)
Parameters
seconds
Number of seconds from the beginning of the content.
-
Initialize a with a
Double
value representation of a percentage.Note
This initializer will fail if the parameter value is not in range of 0 - 100. If an invalid value is supplied, this initializer will returnnil
.Declaration
Swift
public init?(percentage: Double)
Parameters
percentage
The point at which the cue exists within the media, expressed as a percentage from 0 - 100 relative to the duration of the content.
-
Initialize a with a
String
value representation of a percentage.Note
This initializer can fail if the string is invalid or in an unexpected format. In these cases, it will returnnil
.Declaration
Swift
public init?(percentageString: String)
Parameters
percentageString
The point at which the cue exists within the video, expressed as a percentage from 0 - 100, in the format “{percent}%”.
-
Initializes and returns a JWCueTime with the provided seconds. This is used as a shorthand initializer when type context is provided.
- Use example:
var cue: JWCueTime //... cue = .seconds(20)
Declaration
Swift
public static func seconds(_ seconds: TimeInterval) -> JWCueTime?
Parameters
seconds
Number of seconds from the beginning of the content.
Return Value
a JWCueTime instance with seconds value, nil if value is not valid.
- Use example:
-
Initializes and returns a JWCueTime with the provided percentage in Double. This is used as a shorthand initializer when type context is provided.
- Percentage is a value from 0-100, relative to the duration of the media.
- Use example:
var cue: JWCueTime //... cue = .percentage(25.0)
Declaration
Swift
public static func percentage(_ percentage: Double) -> JWCueTime?
Parameters
percentage
The point at which the cue exists within the media, expressed as a percentage from 0 - 100 relative to the duration of the content.
Return Value
a JWCueTime instance with percentage value. nil if value is not valid.
-
Compares two JWCueTime instances for equality. This is used through the “==” method.
Declaration
Swift
public override func isEqual(_ object: Any?) -> Bool
-
Equality testing.
Declaration
Swift
public static func == (lhs: JWCueTime, rhs: JWCueTime) -> Bool
Parameters
lhs
The lefthand value.
rhs
The righthand value.