MovaLiveReconnect class

Keeps reconnecting a live source: retries with exponential backoff (capped at maxDelay) instead of giving up, so a publisher that restarts or drops for a while is picked up again automatically. With alternatives, every address but the last is retried retriesPerAddress times before failing over; the last one keeps retrying (until maxAttempts, if set).

持续重连直播源:以指数退避(封顶 maxDelay)重试而不是放弃,推流端重启或掉线一阵子 之后能自动接上。有备选地址时,除最后一个外每个地址先重试 retriesPerAddress 次再切换; 最后一个地址持续重试(设了 maxAttempts 则到上限为止)。

Example / 示例:

const MovaRecoveryOpts(
  enabled: true,
  policy: MovaLiveReconnect(maxDelay: Duration(seconds: 10)),
);
Implemented types

Constructors

MovaLiveReconnect({Duration initialDelay = const Duration(seconds: 1), Duration maxDelay = const Duration(seconds: 15), double factor = 2, int retriesPerAddress = 1, int? maxAttempts})
Creates the policy.
const

Properties

factor → double
Backoff growth per failed attempt (values below 1 count as 1).
final
hashCode → int
The hash code for this object.
no setterinherited
initialDelay → Duration
Wait before the first retry; later retries multiply it by factor.
final
maxAttempts → int?
Give up once the last address has failed this many times in a row; null (default) never gives up.
final
maxDelay → Duration
Upper bound of the wait between two attempts.
final
retriesPerAddress → int
How many times a non-last address is retried before failing over.
final
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
onFailure(MovaPlayFail fail) → MovaRecoveryDecision
Answers what to do about fail.
override
toString() → String
A string representation of this object.
inherited

Operators

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