Chromecast
public protocol Chromecast : EventDispatcherProtocol
Chromecast, also known as Google Cast, is a casting device designed by Google.
-
Whether THEOplayer is casting to a chromecast and has control over the current chromecast session.
Declaration
Swift
var casting: Bool { get }
-
The last error thrown by chromecast.
Declaration
Swift
var error: CastError? { get }
-
The name of the chromecast device that THEOplayer is casting to.
Remark
This value is nil if THEOplayer is not controlling the current chromecast session.Declaration
Swift
var receiverName: String? { get }
-
Indicates the state of the casting process.
Declaration
Swift
var state: PlayerCastState? { get }
-
The ChromecastConnectionDelegate to be used when the Chromecast connection changes.
Declaration
Swift
func setConnectionDelegate(_ delegate: ChromecastConnectionDelegate?)
-
Start casting to the chromecast. A dialog will prompt to choose the device.
Declaration
Swift
func start()
-
Stop casting to the chromecast.
Declaration
Swift
func stop()
-
Join an active chromecast session.
Declaration
Swift
func join()
-
Leave an active chromecast session without affecting other devices.
Declaration
Swift
func leave()
-
Adds the given event listener of the given
ChromecastEventType
.Remark
When attaching a listener on the wrong object the application will crash.
Declaration
Swift
func addEventListener<E>(type: EventType<E>, listener: @escaping (E) -> ()) -> EventListener where E : EventProtocol
Parameters
type
ChromecastEventType of the added event listener.
listener
Closure called when event is dispatched.
Return Value
EventListener that can be removed.
-
Removes the given event listener of the given
ChromecastEventType
.Declaration
Swift
func removeEventListener<E>(type: EventType<E>, listener: EventListener) where E : EventProtocol
Parameters
type
ChromecastEventType of the removed event listener.
listener
EventListener object that has been return on addEventListener.