Aperture UI
Content development

Video

The WDVideo module and the standard video element in Aperture UI. Playback, decoder/audio integration, and the package build requirements.

Check the SDK version and video build

The 26.08.0.1 Windows package leaves out the video stack. Its engine's CMake excludes the whole video module (WDVideo) from that build, and <video> decoding compiles only where APUI_HAS_VIDEO is defined. With the standard download, a <video> element does not play. Playback requires an engine built with the WDVideo sources and APUI_HAS_VIDEO; installing codec DLLs or updating page markup cannot enable an omitted decoder stack. See Requirements.

In the standard build, a <video> that has a source logs a warning that video support is not available in the PartialCore build, and nothing plays. The element still takes part in layout like any replaced element.

This page describes what a full build does, so that you can plan content for it. In a full build, video playback is compiled into the HTML engine through the in-tree WDVideo module. Video is painted as replaced content, and a video element alone does not allocate a compositing layer.

What a Full Build Adds

A full build reads the video file, decodes it on a decoder thread, and hands each new frame to your render context's UploadVideoSurface to become a texture. The page paints that texture like any other replaced content.

Registering a Decoder

On Windows a full build installs its own decoder, built on Media Foundation, when your host registers none. Register your own IAPCVideoDecoder to replace it, for example to use a console's hardware decoder. The engine source contains a Windows decoder only, so on any other platform a title registers its own. IAPCAudioOutput receives the audio of <video> elements. Both are registered on the platform object with SetVideoDecoder and SetAudioOutput during startup, before you load a view that contains a <video>. See Your own C++ host.

<audio> has no playback of its own. Play sound from your game.

Basic Usage

<video src="cinematics/intro.mp4" autoplay loop muted></video>

The source comes from src or from a <source> child, and a relative path resolves against the document. The autoplay, loop and muted attributes are read when the player is created.

The poster attribute is not drawn. The engine loads a poster image only when script sets video.poster, and nothing paints it. To show a still before the first frame, place your own image behind or beside the element.

The native controls are not drawn either: the user-agent stylesheet styles the media-control pseudo-elements, but no code creates them. Build your own controls with buttons that call the methods below.

Controlling Playback from JavaScript

const video = document.querySelector('video');

video.play();
video.pause();
video.currentTime = 5.0;       // seek to 5 seconds
video.playbackRate = 1.5;      // 1.5x speed
video.volume = 0.5;            // 0.0-1.0
video.muted = true;

video.addEventListener('timeupdate', () => console.log(video.currentTime));

A video element has play(), pause(), load(), canPlayType(), currentTime, duration, ended, paused, loop, muted, volume, playbackRate, readyState, networkState, videoWidth, videoHeight and getVideoPlaybackQuality().

timeupdate is currently the only HTMLMediaElement event the engine dispatches. The rest of the standard event surface (play, pause, seeking, seeked, playing, waiting, canplay, canplaythrough, ended, error, volumechange, ratechange, durationchange, loadedmetadata, loadeddata, progress, stalled, suspend, emptied, abort) is not fired. Read currentTime, paused and ended instead of waiting for those events.

Supported Codecs

The demuxers decide what plays. The container is parsed first, and only the codecs below reach the decoder.

CodecContainerSupport
H.264MP4Yes
VP8WebMYes
VP9WebMYes
H.265 / HEVCMP4No. The MP4 demuxer does not parse HEVC track boxes.
AV1MP4No. The MP4 demuxer does not parse AV1 track boxes.

Audio is AAC in MP4, and Vorbis or Opus in WebM. On Windows, the decoder goes through Media Foundation and could decode HEVC and AV1 if the demuxers fed it those codecs, but they do not, so those files do not play. Check license restrictions for the codecs you ship on your target platforms.

Performance Notes

  • Each <video> element has its own player and decoder session. Limit how many play at once.
  • A decoded frame is uploaded to a texture whenever it changes, for every playing video.
  • Hardware decode is far cheaper for the CPU than software decode. Encode source content with a codec that the target decodes in hardware.
  • For UI loops (background animation behind a menu), a Lottie animation or a CSS animation is usually a better choice than a small <video>: fewer dependencies, less memory.

Use Cases

  • Pre-rendered cinematics. Full-screen <video> with autoplay, plus your own skip and pause buttons.
  • Background ambience on menus. A looping muted clip behind the main menu.
  • Tutorial clips. Inline how-to videos in tooltips.
  • Replays. Player-recorded content surfaced through the UI.

Loading from Your Asset Pipeline

The video file path resolves through the same IAPCFileSystem used for HTML, CSS and images, so a title that serves assets from an archive can play video from it. The player works on files: package MP4 or WebM assets with the title. The engine has no HLS or DASH streaming code.

On this page