CastAPI Protocol

public protocol CastAPI

API for casting (Chromecast, AirPlay).

  • Analytics metadata.

    Declaration

    Swift

    var metadata: AnalyticsMetadata? { get set }
  • Generic track list.

    Declaration

    Swift

    var tracks: [Track] { get }
  • Video track list.

    Declaration

    Swift

    var videoTracks: [VideoTrack] { get }
  • Audio track list.

    Declaration

    Swift

    var audioTracks: [AudioTrack] { get }
  • Text track list.

    Declaration

    Swift

    var textTracks: [TextTrack] { get }
  • Returns true if casting is active.

    Declaration

    Swift

    var isCasting: Bool { get }
  • Returns true if is currently connected to a session.

    Declaration

    Swift

    var hasConnectedSession: Bool { get }
  • Button to activate casting.

    Declaration

    Swift

    var button: UIButton? { get }
  • ViewController with Chromecast mini media controls

    Declaration

    Swift

    var miniMediaControlsViewController: UIViewController? { get }
  • ViewController with Chromecast expanded media controls

    Declaration

    Swift

    var expandedMediaControlsViewController: UIViewController? { get }
  • Override authToken passed to

    Declaration

    Swift

    var authToken: String? { get set }
  • Returns true If we start playback automatically after conten is loaded.

    Declaration

    Swift

    var autoplay: Bool? { get set }
  • Initial playback position.

    Declaration

    Swift

    var position: CMTime? { get set }
  • Stream duration.

    Declaration

    Swift

    var duration: Float64 { get }
  • Custom subtitle style.

    Declaration

    Swift

    var subtitlesStyle: SubtitlesStyle? { get set }
  • Media status

    Declaration

    Swift

    var onMediaUpdate: ((CastMediaStatus) -> Void)? { get set }
  • Report current cast state.

    Declaration

    Swift

    var onCastState: ((CastState) -> Void)? { get set }
  • Load configuration.

    Declaration

    Swift

    func load(_ playerConfiguration: PlayerConfiguration)
  • Present expanded media controls ViewController

    Declaration

    Swift

    func presentExpandedMediaControls()
  • Connects and controls existing cast session.

    Declaration

    Swift

    func join()
  • Start playback.

    Declaration

    Swift

    func play()
  • Pause playback.

    Declaration

    Swift

    func pause()
  • Stop playback.

    Declaration

    Swift

    func stop()
  • Ends the current cast session.

    Declaration

    Swift

    func endSession(_ stopCasting: Bool) -> Bool

    Parameters

    stopCasting

    If true, the receiver app stops casting when multiple devices are connected. If false and other devices have an active session, the receiver keeps playing. If only one sender device is connected, the receiver app stops casting the media and ignores this parameter.

    Return Value

    true if the operation to end the session started successfully. false if there is no session currently established or if the operation could not be started.

  • Seek to a given time.

    Declaration

    Swift

    func seek(_ time: CMTime)

    Parameters

    time

    Time to seek.