Protocols
The following protocols are available globally.
-
FLCastManageris 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
GCKCastContextinstance:
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, callinitialize()to add aGCKSessionManagerListenerand register the GCKLogger callback for the SDK.To receive
FLCastManagerDelegatecallbacks, set a confirmed instance ofFLCastManagerDelegateusingregisterListener(_:).To stop receiving callbacks, call
unregisterListener().Casting Content:
- Use a
CastPlayerinstance to initiate content playback. Before casting, register the Cast device with the Firstlight Platform by callingregisterUserData(clientDevice:castDeviceID:authToken:)after the Cast session has started. - After successful registration, load media on the receiver using
loadMedia(castAsset:metadata:mediaTracks:)from theCastPlayerAPI. - If registration fails, you will be notified with an error when attempting to load media.
- Use a
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.
Declaration
Swift
public protocol FLCastManager - Before communicating with a Cast session, the sender application must create a
-
Delegate for listening to Cast session events.
See moreDeclaration
Swift
public protocol FLCastManagerDelegate : AnyObject -
Cast Player, an equivalent to GCKRemoteMediaClient.
See moreDeclaration
Swift
public protocol FLCastPlayer : AdPlayer
Protocols Reference