WebEventTranslator class

Translates ByteArk Player Web JS event names + payloads into the typed ByteArkPlayerNativeEvent the cross-platform Player controller already knows how to dispatch.

Pure Dart with no dart:js_interop dependency so unit tests can exercise every ByteArkPlayerEventTypes constant without a browser. The web backend converts JS payloads to plain Dart maps (via .dartify()) before handing them to this module.

Fullscreen direction. ByteArk Player Web emits a single fullscreenchange event; the entering-vs-exiting distinction lives in the player's instantaneous state. The backend queries the player and passes one of two virtual event names to translate:

  • fullscreenchange:enter — player has just entered fullscreen
  • fullscreenchange:exit — player has just exited fullscreen

Unknown event names return null, which the backend treats as "ignore" rather than as an error. Each ByteArkPlayerEventTypes constant has at least one mapping; the per-mapping web SDK name is a best-effort guess to be verified against the live SDK during the MOB-130 manual browser pass.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

translate({required String webEventName, required String playerId, Map<String, dynamic>? data}) ByteArkPlayerNativeEvent?
Translates a single JS event into a typed ByteArkPlayerNativeEvent. Returns null for unknown event names so the caller can ignore them without special-casing.

Constants

rawSubscribedEventNames → const List<String>
The exact set of raw JS event names the web backend should subscribe to via player.on(...). Excludes the fullscreenchange:* virtual names — the backend subscribes to fullscreenchange once and translates each fire into the appropriate virtual based on player state.