The Ravnur Media Player provides a comprehensive set of methods to control and manipulate media playback within web applications. Customize playback controls, dynamically load media sources, select quality levels, audio tracks, and more. This provides the flexibility and control needed to create interactive media experiences.
player.controller.methodName(). Some methods are available directly on the player instance: player.methodName(). These methods are accessed via player.controller and provide core playback control functionality.
| Method | Parameters | Returns | Description |
|---|---|---|---|
getCurrentTime() | - | number | Retrieves the current playback time in seconds (includes timecode offset). |
setCurrentTime(time, silent?) | time: number, silent?: boolean | void | Sets the playback position to the specified time in seconds. If silent is false, focuses the player. |
isPaused() | - | boolean | Returns true if the media is currently paused. |
isEnded() | - | boolean | Returns true if the media has reached the end or clip endpoint. |
isMuted() | - | boolean | Returns true if the player is currently muted. |
play(silent?) | silent?: boolean | Promise<void> | Initiates media playback. Returns a Promise that resolves when playback begins. If silent is false, focuses the player. |
pause(silent?) | silent?: boolean | void | Pauses the current playback. If silent is false, focuses the player. |
prevFrame() | - | void | Steps backward to the previous frame based on the configured frame rate. |
nextFrame() | - | void | Steps forward to the next frame based on the configured frame rate. |
getDuration() | - | number | null | Retrieves the total duration of the media in seconds (respects clip boundaries). |
setMuted(muted, silent?) | muted: boolean, silent?: boolean | void | Sets the muted state of the player. If silent is false, focuses the player. |
getVolume() | - | number | Retrieves the current volume level (0.0 to 1.0). |
setVolume(volume, silent?) | volume: number, silent?: boolean | void | Sets the volume level (0.0 to 1.0). If silent is false, focuses the player. |
getLevels() | - | any[] | Retrieves all available quality levels for the current media. |
getLevel() | - | any | Retrieves the currently active quality level. |
setLevel(level) | level: any | void | Sets the quality level. Pass the level object from getLevels(). |
isMultiQuality() | - | boolean | Returns true if the media has multiple quality levels available. |
isMultiAudioTracks() | - | boolean | Returns true if the media has multiple audio tracks available. |
getAudioTracks() | - | any[] | Retrieves all available audio tracks. |
getAudioTrack() | - | number | Retrieves the index of the currently active audio track. |
setAudioTrack(index) | index: number | void | Sets the active audio track by index. |
load(sources) | sources: PlayerSource | void | Loads a new media source into the player. |
getBufferedPercent() | - | number | Retrieves the percentage of media that has been buffered (0 to 100). |
getElement() | - | HTMLVideoElement | HTMLAudioElement | Retrieves the underlying HTML media element. |
setPlaybackRate(rate) | rate: number | void | Sets the playback speed. 1.0 is normal speed, 0.5 is half speed, 2.0 is double speed. |
isLive() | - | boolean | Returns true if the current media is a live stream. |
goToLive() | - | void | Jumps to the live edge of a live stream. |
getTimeCode() | - | number | Retrieves the configured timecode offset in seconds. |
focus() | - | void | Focuses the player element for keyboard interaction. |
These methods are accessed directly on the player instance.
| Method | Parameters | Returns | Description |
|---|---|---|---|
setup(playlist, options) | playlist: PlayerSource | PlayerSource[], options?: Partial<PlayerInputOptions> | void | Initializes the player with media source(s) and configuration options. Call this once to set up the player. |
playPart(from?, to?, lazy?) | from?: number, to?: number, lazy?: boolean | void | Plays a specific segment of the media. If lazy is true, does not auto-play. |
refreshCrawlExtension(crawl, visibility?) | crawl: PlayerCrawlOptions, visibility?: boolean | void | Updates or creates the scrolling text crawl with new options. |
changeFullScreenMode() | - | void | Toggles fullscreen mode on/off. |
changeLayout(lang, fontSize, location) | lang: string, fontSize: PlayerCCFontSize, location: PlayerCCLocation | void | Changes the caption display layout settings. |
isShownExtensions() | - | boolean | Returns true if player controls/extensions are currently visible. |
appearExtensions() | - | void | Shows the player controls/extensions immediately. |
disappearExtensions() | - | void | Hides the player controls/extensions immediately. |
destroy() | - | void | Destroys the player instance and cleans up all resources. Call this when removing the player. |