IMediaPlayerMethods

interface
Component Props

Imperative methods returned by useMediaPlayer. Media-agnostic subset — every method maps 1:1 to the standard HTMLMediaElement API. Video-specific commands (toggleFullscreen, togglePip) live in IVideoPlayerMethods.

TypeScript

Definition

The TypeScript interface definition as found in the origam source. Click the copy icon to copy the snippet.

typescript

API

Properties

Every property declared by this interface, with its type, optionality and default.

play
required
() => Promise<void>
Resolve once el.play() has settled (or the call has been swallowed into state.error).
pause
required
() => void
Pause playback. Returns synchronously.
toggle
required
() => Promise<void>
Toggle between play and pause based on the current playing state.
seek
required
(seconds: number) => void
Seek to seconds, clamped to [0, duration].
setVolume
required
(value: number) => void
Set the volume, clamped to [0, 1]. Un-mutes when raising the volume from zero.
toggleMute
required
() => void
Flip the muted flag on the element.
load
required
() => void
Force a reload of the underlying media element.
skipBackward
required
(seconds: number) => void
Jump backward by seconds, clamped to [0, duration].
skipForward
required
(seconds: number) => void
Jump forward by seconds, clamped to [0, duration].
setPlaybackRate
required
(rate: number) => void
Set the playback rate, clamped to [0.25, 4].
requestRemotePlayback
required
() => Promise<void>
Open the native cast / AirPlay device picker. No-op when the Remote Playback API is unavailable.
stopRemotePlayback
required
() => Promise<void>
Force-disconnect any active Remote Playback session. No-op when no session is active or the API is unavailable.

Ecosystem

Used by

Components and composables that extend or consume this interface.

Usage

Examples

Ready-to-paste code snippets using this interface.

Calling methods from useMediaPlayer

typescript