ProperVideoPlayer Component
ProperVideoPlayer provides one API for the native HTML <video> backend
on WebGL and Unity's VideoPlayer backend on other platforms.
Add the component through Component → Video → Proper Video Player (WebGL) or with
AddComponent<ProperVideoPlayer>(). Unity allows one instance on each GameObject. Create a separate
GameObject and texture for every additional player; see Multiple Players.
Inspector reference#
Source#
| Field | Description |
|---|---|
| Source Url | An absolute media URL, or a path relative to StreamingAssets when Source Is Streaming Assets Path is enabled. |
| Source Is Streaming Assets Path | Resolves Source Url relative to Application.streamingAssetsPath when the configured source is opened. |
| Play On Start | Opens and plays a non-empty configured source from Start(). |
Playback#
| Field | Description |
|---|---|
| Loop | Repeats the source after it reaches the end. |
| Muted | Starts playback without audio. Keep this enabled for autoplay and restore audio from a user interaction. See Autoplay & CORS. |
| Playback Rate | The initial playback speed, from 0.25× to 4×. |
| Pause When Disabled | Pauses decoding and frame uploads while the component is disabled. If playback had been requested, it resumes when the component is enabled. Enabled by default. |
Output#
| Field | Description |
|---|---|
| Target Texture | An optional RenderTexture. Leave it unassigned to let the component create and manage a texture for the video. |
| Output Image | An optional RawImage that receives the current video texture. The component configures its uvRect for the active backend. |
| Aspect Ratio | Controls how the non-WebGL fallback fits video into a user-supplied RenderTexture. The WebGL backend does not use this setting. |
See Textures & Rendering for custom RenderTextures and material binding.
Self-Healing Watchdog#
These fields configure stall detection and recovery. See Playback Watchdog for the recovery stages and defaults.
Debug#
Verbose Logging adds source-open, state, and watchdog diagnostic messages with the
[ProperVideo] prefix.
Events#
The Events foldout contains the component's UnityEvents. See Events for event timing and platform availability.
Open a source#
player.Open(url); // Open and request playback
player.Open(url, playWhenReady: false); // Prepare the first source without starting it
player.Open(url, true, VideoSourceType.Hls); // Specify a type when the URL has no extension
player.OpenConfiguredSource(); // Open and play the Inspector source
Calling Open again supersedes an open that is still in progress. CurrentUrl contains
the value passed to the most recent call. CurrentSource contains the source resolved by the active
backend and can differ after redirects.
Playback intent persists while a player is reused. To prepare a replacement without starting it, call
Pause() before Open(url, playWhenReady: false).
Control playback#
player.Play();
player.Pause();
player.Stop(); // Pause and seek to the beginning
player.Seek(12.5); // Precise seek
player.FastSeek(12.5); // Prefer speed when the browser supports fast seeking
player.SetPlaybackRate(1.5f);
player.SetVolume(0.6f); // Range: 0 to 1; independent of mute
player.SetMuted(false);
player.SetLooping(true);
player.SetPreservesPitch(true); // Browser backend only
Use properties such as IsPlaying, CurrentTime, Duration, and
BufferedAhead to drive playback UI. The API Reference lists the full public
surface and the values that are unavailable on the fallback backend.
Poll CurrentTime for ordinary progress UI. Use LastPresentedTime when application
logic must follow the timestamp of the frame currently visible.