Proper Video Player Documentation

Playback Watchdog

The optional watchdog monitors requested playback and applies staged recovery actions when the backend remains paused or stops advancing.

Detection#

The watchdog runs at checkIntervalSeconds intervals while a source is open and playback has been requested. It monitors two conditions:

  • Unexpected pause: the backend reports that it is paused even though the caller has not called Pause().
  • Playback stall: the presented-frame count does not change between checks. If the backend exposes no frame counter, the watchdog falls back to CurrentTime and can therefore detect only stalls in which the playhead also stops.

Default recovery sequence#

ConditionStage IDAction
Paused at a health checkCall Play() again.
Paused for 2 checks while unmuted on WebGLmute_danceMute, call Play(), then restore the configured mute state after playback starts.
Paused for 9 checks, then every 30 additional checksreload_pausedReload the current source.
No frame progress for 3 checkskickCall Pause(), then Play().
No frame progress for 6 checksseek_flushSeek to the current time, then call Play().
No frame progress for 9 checks, then every 30 additional checksreloadReload the current source.

Each named stage invokes OnRecoveryAttempted. The initial repeated Play() call has no stage event.

void OnEnable()
{
    player.OnRecoveryAttempted.AddListener(ReportRecovery);
}

void OnDisable()
{
    player.OnRecoveryAttempted.RemoveListener(ReportRecovery);
}

void ReportRecovery(string stage)
{
    Debug.Log($"Video recovery attempted: {stage}");
}

When monitoring is suspended#

The watchdog resets its counters while a source is opening, after an explicit Pause(), and during the seek grace period. It also stops acting after a non-looping source ends. Disabling the component stops its update loop; with Pause When Disabled enabled, the backend is paused until the component is enabled again.

Configuration#

The Self-Healing Watchdog Inspector section serializes these WatchdogSettings fields. Thresholds are counts of health checks, so their approximate elapsed time changes with checkIntervalSeconds.

FieldDefaultDescription
enabledOnEnables watchdog monitoring and recovery.
checkIntervalSeconds1Unscaled seconds between health checks.
muteDanceAtPausedChecks2Paused checks before the WebGL muted-play recovery.
kickAtStalledChecks3Stalled checks before a pause/play recovery.
seekFlushAtStalledChecks6Stalled checks before seeking to the current time.
reloadAtStalledChecks9Paused or stalled checks before reloading the source.
reloadRetryEveryChecks30Additional checks between reload attempts after the first reload.