Events
ProperVideoPlayer exposes 17 UnityEvent properties. Configure them in
the Inspector or subscribe in code with AddListener. WebGL events are forwarded from the HTML media
element; the fallback backend uses equivalent VideoPlayer callbacks or documented synthesized
events.
player.OnOpened.AddListener(() => spinner.SetActive(false));
player.OnWaiting.AddListener(() => spinner.SetActive(true));
player.OnPlaybackStarted.AddListener(() => spinner.SetActive(false));
player.OnError.AddListener(message => Debug.LogWarning($"Video error: {message}"));
player.OnRecoveryAttempted.AddListener(stage => Debug.Log($"Video recovery: {stage}"));
Playback and recovery events#
| Event | Invoked when |
OnOpened | The current source has decoded its first frame. |
OnPlaybackStarted | Playback starts or resumes. |
OnEnded | A non-looping source reaches the end. |
OnSeeking | A seek operation starts. |
OnSeeked | A seek operation completes. |
OnError(string) | A media error occurs. The argument contains a readable error message, including HLS- or DASH-specific details for streaming-engine failures. |
OnRecoveryAttempted(string) | The playback watchdog performs a recovery action. The stage identifier is mute_dance, kick, seek_flush, reload, or reload_paused. |
| Event | Invoked when |
OnLoadedMetadata | Duration and intrinsic dimensions are available. This occurs before OnOpened. |
OnDurationChanged | The reported duration changes, including updates from live or adaptive sources. |
OnResized | The intrinsic video dimensions change. Query VideoWidth and VideoHeight in the handler. |
OnCanPlay | Enough data is available to begin playback. |
OnCanPlayThrough | The browser estimates that playback can reach the end without waiting for more data. |
OnWaiting | Playback waits for additional data. This event is available only on WebGL. |
OnStalled | The browser stops receiving media data unexpectedly. This event is available only on WebGL. |
OnPaused | Playback pauses. On WebGL, this includes pauses initiated by the application, browser, operating system, or watchdog. |
OnRateChanged | The playback rate changes. |
OnVolumeChanged | Volume or mute state changes, including temporary autoplay-recovery changes on WebGL. |
| Event | WebGL backend | Non-WebGL VideoPlayer fallback |
OnLoadedMetadata | loadedmetadata | Invoked when preparation completes. |
OnDurationChanged | durationchange | Invoked when preparation completes. |
OnResized | resize | Invoked once when preparation completes. |
OnOpened | loadeddata | Invoked when preparation completes. |
OnCanPlay / OnCanPlayThrough | canplay / canplaythrough | Invoked when preparation completes. |
OnPlaybackStarted | playing | VideoPlayer.started |
OnPaused | pause | Synthesized when the backend pauses active playback. |
OnSeeking / OnSeeked | seeking / seeked | Synthesized on seek / VideoPlayer.seekCompleted. |
OnWaiting | waiting | Not available. |
OnStalled | stalled | Not available. |
OnRateChanged | ratechange | Synthesized by SetPlaybackRate. |
OnVolumeChanged | volumechange | Synthesized by SetVolume and SetMuted. |
OnEnded | ended | VideoPlayer.loopPointReached when looping is disabled. |
OnError | error or a streaming-engine error | VideoPlayer.errorReceived |
OnRecoveryAttempted | Invoked by the component watchdog whenever it performs a recovery action. |