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.
API
Properties
Every property declared by this interface, with its type, optionality and default.
- playrequired() => Promise<void>
- Resolve once el.play() has settled (or the call has been swallowed into state.error).
- pauserequired() => void
- Pause playback. Returns synchronously.
- togglerequired() => Promise<void>
- Toggle between play and pause based on the current playing state.
- seekrequired(seconds: number) => void
- Seek to seconds, clamped to [0, duration].
- setVolumerequired(value: number) => void
- Set the volume, clamped to [0, 1]. Un-mutes when raising the volume from zero.
- toggleMuterequired() => void
- Flip the muted flag on the element.
- loadrequired() => void
- Force a reload of the underlying media element.
- skipBackwardrequired(seconds: number) => void
- Jump backward by seconds, clamped to [0, duration].
- skipForwardrequired(seconds: number) => void
- Jump forward by seconds, clamped to [0, duration].
- setPlaybackRaterequired(rate: number) => void
- Set the playback rate, clamped to [0.25, 4].
- requestRemotePlaybackrequired() => Promise<void>
- Open the native cast / AirPlay device picker. No-op when the Remote Playback API is unavailable.
- stopRemotePlaybackrequired() => 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