Docs
ReferenceMethods

Methods

Every method exposed by the Moviie Player API.

The tables below cover every public method on window.Moviie. Methods are grouped by purpose; refer to the Player API guides for usage patterns.

Playback

SignatureDescription
play(): Promise<void>
promise
Starts or resumes playback. Resolves once the play request has been accepted; rejects if blocked by the browser autoplay policy.
pause(): voidPauses playback at the current time.
togglePlay(): Promise<void>
promise
Plays the video if paused, pauses it if playing.
stop(): voidPauses playback and resets the current time to 0.

Seeking

SignatureDescription
seek(timeInSeconds: number): voidSeeks to an absolute position in seconds. Clamped to `[0, duration]`.
seekForward(seconds?: number): voidSkips forward by the given number of seconds (default 10). Clamped to the video duration.
seekBackward(seconds?: number): voidSkips backward by the given number of seconds (default 10). Clamped to 0.

Volume

SignatureDescription
mute(): voidMutes the audio without changing the saved volume level.
unmute(): voidUnmutes the audio and restores the previous volume level.
toggleMute(): voidToggles between muted and unmuted.
setVolume(level: number): voidSets the volume level. Accepts a number in the range `[0, 1]`.

Fullscreen

SignatureDescription
enterFullscreen(): Promise<void>
promise
Requests fullscreen mode. Must be called from a user gesture handler (e.g. click).
exitFullscreen(): Promise<void>
promise
Exits fullscreen mode.
toggleFullscreen(): Promise<void>
promise
Enters fullscreen if not in fullscreen, otherwise exits.

Picture-in-Picture

SignatureDescription
enterPip(): Promise<void>
promise
Requests Picture-in-Picture mode. Requires a user gesture in some browsers.
exitPip(): Promise<void>
promise
Exits Picture-in-Picture mode.
togglePip(): Promise<void>
promise
Enters Picture-in-Picture if not active, otherwise exits.

Playback rate

SignatureDescription
setPlaybackRate(rate: number): voidSets the playback speed multiplier. Common values: 0.5, 1, 1.25, 1.5, 2.

Events

SignatureDescription
on(event: PlayerAPIEvent, handler: (payload?: unknown) => void): () => voidSubscribes a handler to a player event. Returns an unsubscribe function.
off(event: PlayerAPIEvent, handler: (payload?: unknown) => void): voidRemoves a previously registered handler for a player event.
once(event: PlayerAPIEvent, handler: (payload?: unknown) => void): () => voidSubscribes a handler that fires at most once. Returns an unsubscribe function.

State

SignatureDescription
getState(): PlayerStateReturns a snapshot of the current player state. See the State shape page for the full payload definition.

Lifecycle

SignatureDescription
destroy(): voidTears down the player and releases all resources. After calling this method the API is no longer usable.

On this page