PlayerFacade¶
PlayerFacade connects the media element, engines, ports, and plugins. Its configuration must be explicit so runtime errors remain auditable.
Attach the Runtime¶
facade.attach(videoEl, plugins, config, ports, [createShakaEngineFactory()]);
await facade.load(config);
| Parameter | Default | Explanation | Avoid |
|---|---|---|---|
videoEl |
None | HTMLVideoElement controlled by the facade. |
Calling load before attach. |
plugins |
[] |
Plugins initialized with PlayerContext. |
Believing an installed package acts without being passed to attach. |
config |
None | Initial configuration and source of truth at startup. | Mutating silently without calling load again. |
ports.http |
Global fetch |
Remote config and external providers. | Enabling remote config without a functional HTTP port. |
ports.storage |
Memory | Local progress, remote config cache, plugins. | Expecting browser persistence with the memory port. |
ports.telemetry |
Noop | QoE events, errors, and measurements. | Sending media or license secrets into logs. |
engines |
Native + provided engines | Engine selection by source and capabilities. | Removing the native fallback for simple files. |
Loading Cycle¶
- Apply
remoteConfigwhen enabled. - Normalize playlist or series.
- Merge DRM and profile on the active source.
- Select the compatible engine.
- Load the media.
- Publish state, events, metadata, tracks, and diagnostics.