prepareView method

  1. @override
void prepareView(
  1. ByteArkPlayerConfig config
)
override

Called once by the Player widget in its initState before the embedded platform view is mounted. Implementations use this hook to perform widget-lifecycle-time setup that needs config (e.g. on Flutter Web, registering the per-playerId HtmlElementView factory). Mobile implementations no-op because PlatformView creation is handled by the native side.

Implementation

@override
void prepareView(ByteArkPlayerConfig config) {
  _warnAboutSecureSurfaceIfSet(config);
  _seekTime = config.seekTime ?? 30;
  _shakaEnabledAtMount = WebSourcesMapper.requiresShakaPlugin(
    config.playerItem?.sources ?? const [],
  );
  registerByteArkPlayerView(
    playerId: playerId,
    config: config,
    backend: this,
  );
}