Proper Video Player Documentation

Codecs & Performance

Video decoding is provided by the browser on WebGL and by Unity's platform media backend elsewhere. Select encodings for the browsers and devices supported by your application.

Codec capability#

CanPlayType forwards a MIME type query to the browser and returns No, Maybe, or Probably. Include the container and codec profile in the query when possible:

var av1Support = ProperVideoPlayer.CanPlayType(
    "video/mp4; codecs=\"av01.0.05M.08\"");

// Use a conservative fallback that has been tested on your target platforms.
player.Open(av1Support == MediaCanPlay.Probably ? av1Url : fallbackUrl);

A result of Maybe is not a guarantee that a particular file will decode. Outside WebGL builds, CanPlayType always returns Maybe because the browser capability query is unavailable. Browser support also depends on the operating system, hardware decoder, profile, level, bit depth, and audio codec.

Frame upload behavior#

The WebGL backend avoids uploading the same decoded frame repeatedly:

  • When requestVideoFrameCallback is available, it marks the texture dirty when the browser presents a new frame.
  • Otherwise, decoded-frame counters gate uploads when the browser exposes them.
  • If neither signal is available, the Continuous path uploads on each rendered frame while the video is playing.

On the WebGL graphics path, texture storage is allocated again only when the video dimensions change, followed by one texSubImage2D submission per dirty frame. Pixel-store flipping and premultiplication are disabled; orientation is handled when the texture is sampled. See Textures & Rendering. Unity 6 WebGPU builds use a different transfer API, described in Unity 6 WebGPU.

Diagnostics#

PropertyMeaning
UploadMicrosecondsSmoothed CPU submission time for successful browser texture uploads. It does not measure decode time or GPU completion time. Returns -1 before the first upload and on the fallback backend.
UploadPathThe signal that gates uploads: VideoFrameCallback, FrameCounter, or Continuous. It does not identify the WebGL/WebGPU transfer API.
UploadViaWebGpuWhether the active browser transfer uses copyExternalImageToTexture.
PresentedFramesPresented-frame count, or -1 when the platform exposes no suitable counter.
DecodedFrames / DroppedFramesBrowser decode-quality counters, or -1 when unavailable.
BufferedAheadSeconds buffered after the current playhead. The fallback returns -1 because Unity does not expose download progress.

Performance recommendations#

  • Encode only the resolution and frame rate required by the presentation size.
  • Keep Pause When Disabled enabled and disable players that are not visible or audible.
  • Use a separate texture for each player and prefer auto-managed textures unless a fixed target is required.
  • Measure representative progressive and adaptive sources on every supported browser class, especially mobile devices. See Multiple Players for concurrent playback guidance.