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
| Signature | Description |
|---|---|
| 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(): void | Pauses playback at the current time. |
| togglePlay(): Promise<void> promise | Plays the video if paused, pauses it if playing. |
| stop(): void | Pauses playback and resets the current time to 0. |
Seeking
| Signature | Description |
|---|---|
| seek(timeInSeconds: number): void | Seeks to an absolute position in seconds. Clamped to `[0, duration]`. |
| seekForward(seconds?: number): void | Skips forward by the given number of seconds (default 10). Clamped to the video duration. |
| seekBackward(seconds?: number): void | Skips backward by the given number of seconds (default 10). Clamped to 0. |
Volume
| Signature | Description |
|---|---|
| mute(): void | Mutes the audio without changing the saved volume level. |
| unmute(): void | Unmutes the audio and restores the previous volume level. |
| toggleMute(): void | Toggles between muted and unmuted. |
| setVolume(level: number): void | Sets the volume level. Accepts a number in the range `[0, 1]`. |
Fullscreen
| Signature | Description |
|---|---|
| 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
| Signature | Description |
|---|---|
| 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
| Signature | Description |
|---|---|
| setPlaybackRate(rate: number): void | Sets the playback speed multiplier. Common values: 0.5, 1, 1.25, 1.5, 2. |
Events
| Signature | Description |
|---|---|
| on(event: PlayerAPIEvent, handler: (payload?: unknown) => void): () => void | Subscribes a handler to a player event. Returns an unsubscribe function. |
| off(event: PlayerAPIEvent, handler: (payload?: unknown) => void): void | Removes a previously registered handler for a player event. |
| once(event: PlayerAPIEvent, handler: (payload?: unknown) => void): () => void | Subscribes a handler that fires at most once. Returns an unsubscribe function. |
State
| Signature | Description |
|---|---|
| getState(): PlayerState | Returns a snapshot of the current player state. See the State shape page for the full payload definition. |
Lifecycle
| Signature | Description |
|---|---|
| destroy(): void | Tears down the player and releases all resources. After calling this method the API is no longer usable. |