← The API

Phaser AE

API docs

v3.0.0-2206 exports in 26 modulesreleased October 19, 2026

ContentsCommands

Need to get started? Install the Phaser AE CLI →

The player

Commands

Standing commands a host wires once: pause, mute, fullscreen, screenshot, recording

engine/kernel/src/commands.ts

Types

Commands

interface Commands

From @phaser-ae/kernel

Standing commands: the controls a page around the game wires to its buttons (pause, mute, fullscreen, screenshot). They always exist, whatever was composed, and one no pack has claimed silently does nothing, so a host wires its buttons once for every game. Each command has at most one claimer: a second claim throws at compose. The kernel claims pause, resume and fullscreen itself.

  • screenshot(opts?: { scale?: number }): Promise<Blob | null> — Capture what the game shows as an image Blob, through the backend that claimed it; scale asks for a multiple of the logical size. Resolves null when no backend claimed it.
  • startRecording(opts?: { bitrate?: number }): void — Start recording video; bitrate in bits per second, the claimer's default when omitted. No-op when unclaimed.
  • stopRecording(): Promise<Blob | null> — Stop recording and resolve the video Blob; null when nothing was recording or nothing claimed it.
  • pause(): void — Hold the game: the host's pause button. The kernel claims it onto clock.pause(). Before the game is ready (game.ready) a pause or resume is remembered, the latest winning, and applied at that moment: pausing while it loads means the game starts paused.
  • resume(): void — Resume after pause. Remembered like pause before the game is ready.
  • mute(bus?: 'master' | 'music' | 'sfx'): void — Silence a bus; default master. Claimed by the audio pack; no-op without one. Applies at once, even before the game is ready.
  • unmute(bus?: 'master' | 'music' | 'sfx'): void — Undo mute on a bus; default master.
  • fullscreen(on?: boolean): Promise<void> — Toggle fullscreen, or set it with on. The kernel claims it: the Fullscreen API on the canvas's parent, or on iOS (which has none) the canvas raised to a fixed full-viewport layer. Needs a user gesture; no-op headless.
  • readonly isFullscreen: boolean — True while the document has a fullscreen element or the iOS fallback is up; always false headless.
  • loseDevice(): void — Destroy the GPU device ON PURPOSE so the real loss-and-rebuild path runs (boot.contextLost → boot.contextRestored). A dev tool; claimed by the backend, no-op headless.
  • claim<K extends keyof Commands>(name: K, impl: Commands[K]): void — Pack side: fulfil a command, at attach. Throws if another pack has claimed it, naming both.