SourceDescription

@objc(THEOplayerSourceDescription)
public class SourceDescription : NSObject, Codable

The SourceDescription object is used to describe a configuration of a source for a THEOplayer instance.

  • Represents the source of the media to be played.

    Declaration

    Swift

    @objc
    public var sources: [TypedSource] { get set }
  • The textTracks property can be used to add an array of side-loaded text tracks to the player.

    Remark

    • All valid tracks will be available for playback as long as the player’s source is not set again.
    • Each text track should be described as a TextTrackDescription.

    Declaration

    Swift

    @objc
    public var textTracks: [TextTrackDescription]? { get set }
  • ads

    The ads property can be used to add an array of AdDescriptions to the player. All valid and supported advertisement files will be cued for playback in the player. Each ad in the array should be described as an AdDescription.

    Declaration

    Swift

    public var ads: [AdDescription]? { get set }
  • The poster property can be used to specify a content poster per source.

    Remark

    The player’s content poster will be updated as soon as a new source with valid poster is set, or when the player’s own poster property is altered.

    Declaration

    Swift

    @objc
    public var poster: URL? { get set }
  • Metadata that can be used to describe content, e.g. when casting to chromecast.

    Declaration

    Swift

    @objc
    public var metadata: MetadataDescription? { get set }
  • Constructs a SourceDescription.

    Declaration

    Swift

    public init(sources: [TypedSource], textTracks: [TextTrackDescription]? = nil, ads: [AdDescription]? = nil, poster: String? = nil, metadata: MetadataDescription? = nil)

    Parameters

    sources

    An array of TypedSource which represent the media to be played.

    textTracks

    An array of side-loaded text tracks represented as a TextTrackDescription, defaults to nil.

    ads

    An array of ads represented as an AdDescription, defaults to nil.

    poster

    The player’s content poster, defaults to nil.

    metadata

    The metadata which can be used to describe the content, defaults to nil.

  • Constructs a SourceDescription.

    Declaration

    Swift

    public init(source: TypedSource, textTracks: [TextTrackDescription]? = nil, ads: [AdDescription]? = nil, poster: String? = nil, metadata: MetadataDescription? = nil)

    Parameters

    source

    An array of TypedSource which represent the media to be played.

    textTracks

    An array of side-loaded text tracks represented as a TextTrackDescription, defaults to nil.

    ads

    An array of ads represented as an AdDescription, defaults to nil.

    poster

    The player’s content poster, defaults to nil.

    metadata

    The metadata which can be used to describe the content, defaults to nil.