@videojs/spf/features/airplay
Source: src/playback/features/airplay.ts
airPlayFeature
Plays to AirPlay receivers (WebKit only; inert elsewhere), unless the user sets disableRemotePlayback. Attaches the
MediaSource through a <source> element, which the native fallback the receiver plays requires.
Requires a writer of context.mediaSource, such as mediaSourceFeature; without one, AirPlay is never offered.
Behaviors
- setupAirPlay
External signals
The feature declares these state keys for code outside the engine to write; no behavior sets them. The SPF Medias write them from their own properties, and code driving an engine directly writes engine.state.<key>.set(value). Each is declared with defineExternalSignals, which is what makes the key part of the engine's state type.
| Key |
Type |
Doc |
disableRemotePlayback |
boolean | undefined |
Author intent for the AirPlay/remote-playback picker, written by the media adapter's disableRemotePlayback IDL property. true is an explicit opt-out: setupAirPlay reads it at attach and sets nothing up, leaving the element's remote playback disabled. Distinct from the underlying media element's own disableRemotePlayback, which stays programmatically managed (ManagedMediaSource / AirPlay). An external signal: the adapter writes it whether or not setupAirPlay is composed. |
Config
Feature default is the value a feature's defaultConfig supplies. A behavior's own fallback for a key left unset is described under Doc.
| Key |
Type |
Feature default |
Read by |
Doc |
attachMediaSource |
((mediaSource: MediaSource, mediaElement: HTMLMediaElement) => AttachMediaSourceResult) |
attachMediaSourceAsSourceElement |
setupMediaSource |
Attach strategy — a composition-supplied implementation. Defaults to attachMediaSource (object URL on the src attribute). Compositions that pair MSE with sibling <source> alternatives wire attachMediaSourceAsSourceElement (e.g. the HLS engine, for setupAirPlay's native fallback source). |
State
| Key |
Type |
Initial |
Declared by |
Doc |
disableRemotePlayback |
boolean | undefined |
— |
external signal, setupAirPlay |
Author intent for the AirPlay/remote-playback picker, written by the media adapter's disableRemotePlayback IDL property. true is an explicit opt-out: setupAirPlay reads it at attach and sets nothing up, leaving the element's remote playback disabled. Distinct from the underlying media element's own disableRemotePlayback, which stays programmatically managed (ManagedMediaSource / AirPlay). An external signal: the adapter writes it whether or not setupAirPlay is composed. |
loadingSuspended |
boolean | undefined |
— |
setupAirPlay |
Intent-level policy input: initiate no new loading work while true. Read here by the loadXSegments dispatchers (park in 'dormant', highest precedence) and by setupMediaSource (a pending MediaSource rebuild waits — attach runs the element's load algorithm). Observed, never declared: no reader lists this key in stateKeys, so the signal exists only in compositions where a feature behavior declares and writes it (e.g. setupAirPlay, while a remote-playback session owns presentation). An absent signal means never suspended. |
presentation |
MaybeResolvedPresentation | undefined |
— |
setupAirPlay |
The presentation being played. A caller writes { url }; resolvePresentation parses the manifest and populates the rest. (documented on resolvePresentation) |
startPosition |
number | undefined |
— |
setupAirPlay |
One-shot start-position command in presentation-timeline seconds. Written by consumers (adapter, recovery snapshot — e.g. setupAirPlay's at a session's settled end); consumed (cleared) by applyStartPosition once the element seeks. |
Context
| Key |
Type |
Declared by |
Doc |
mediaElement |
HTMLMediaElement | undefined |
setupAirPlay |
The media element the engine drives. No behavior writes it: an adapter attaches one with engine.context.mediaElement.set(element) and detaches with set(undefined), as SPF's adapters do. (documented on setupMediaSource) |
mediaSource |
MediaSource | undefined |
setupAirPlay |
The attached MediaSource, published by setupMediaSource — its sole writer — only once it is open, and cleared when the attachment is torn down (source change, sourceclose, destroy). The other MSE behaviors read it. (documented on setupMediaSource) |
Composed by
Other functions and constants
Types