Protocols

The following protocols are available globally.

  • FLCastManager is a singleton responsible for setting up a custom channel for communication with a Cast session.

    Usage

    • Before communicating with a Cast session, the sender application must create a GCKCastContext instance:
    DispatchQueue.main.async {
        let criteria = GCKDiscoveryCriteria(applicationID: castReceiverId)
        let gckOptions = GCKCastOptions(discoveryCriteria: criteria)
        gckOptions.physicalVolumeButtonsWillControlDeviceVolume = true
        GCKCastContext.setSharedInstanceWith(gckOptions)
        GCKCastContext.sharedInstance().useDefaultExpandedMediaControls = true
    }
    
    • After initializing GCKCastContext, call initialize() to add a GCKSessionManagerListener and register the GCKLogger callback for the SDK.

    • To receive FLCastManagerDelegate callbacks, set a confirmed instance of FLCastManagerDelegate using registerListener(_:).

    • To stop receiving callbacks, call unregisterListener().

    • Casting Content:

      • Use a CastPlayer instance to initiate content playback. Before casting, register the Cast device with the Firstlight Platform by calling registerUserData(clientDevice:castDeviceID:authToken:) after the Cast session has started.
      • After successful registration, load media on the receiver using loadMedia(castAsset:metadata:mediaTracks:) from the CastPlayer API.
      • If registration fails, you will be notified with an error when attempting to load media.
    • Cast Session Management:

      • A Cast session includes connecting to a device, launching or joining a receiver application, and initializing a media control channel. Sessions start automatically when the user selects a device and end when disconnected. Reconnection due to network issues is handled by the Cast SDK.
    See more

    Declaration

    Swift

    public protocol FLCastManager
  • Delegate for listening to Cast session events.

    See more

    Declaration

    Swift

    public protocol FLCastManagerDelegate : AnyObject
  • Cast Player, an equivalent to GCKRemoteMediaClient.

    See more

    Declaration

    Swift

    public protocol FLCastPlayer : AdPlayer