AutoplayPolicyMapper class
Maps the Dart-side ByteArkPlayerConfig.autoPlay boolean onto the
autoplay option understood by ByteArk Player Web.
The Dart API exposes a single bool? autoPlay field, matching what the
Android and iOS SDKs accept. ByteArk Player Web supports a richer set of
values (true strict, 'any' with muted fallback, 'viewable', 'focus',
false). To preserve cross-platform parity at the API level while still
giving Flutter Web the best practical behaviour, this mapper translates:
Dart autoPlay |
Web autoplay |
|---|---|
null (unset) |
'any' |
true |
'any' |
false |
false |
Why true → 'any'. Web true (strict) gets silently rejected by every
major browser's audible-autoplay policy until the user interacts; the
video then stays paused with no error. The SDK's 'any' mode performs an
internal three-step fallback (try unmuted → fall back to muted → wait for
user gesture) so the video starts in the most-audible mode the browser
allows. That's the closest behavioural match to mobile, where autoplay is
not browser-gated at all.
The richer SDK modes ('viewable', 'focus') are deliberately not
reachable from this 1.x API and are slated for a 2.0 ByteArkPlayerAutoPlay
enum. See the CONTEXT.md flagged ambiguity for autoPlay.
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
-
mapAutoPlay(
bool? autoPlay) → Object -
Returns the value that should be assigned to the SDK's
autoplayoption for the given Dart-sideautoPlaysetting.