VideoCore

Interact with the built-in players (Denshi, Online Streaming) in Seanime.

VideoCore is the built-in video player used by the Denshi desktop app and the online streaming web player.

Permissions

{
  //...
  "plugin": {
    "permissions": {
      "scopes": ["playback"]
    }
  }
}

Code methods

addEventListener

addEventListener(eventId, callback)

Registers a listener for playback events.

Parameters:

  • eventId: String - The identifier of the event to listen for (e.g., "video-paused", "video-seeked", "video-loaded").

  • callback: Function - The function to execute when the event triggers. Receives the event object.

Example:

removeEventListener

removeEventListener(eventId)

Removes a previously registered event listener.

Parameters:

  • eventId: String - The identifier of the event to remove.

Example:

playEpisodeFromPlaylist

playEpisodeFromPlaylist(which)

Instructs the media player to play a specific episode from the current playlist.

The playlist can be a custom playlist or the list of episodes for the current media being played.

Parameters:

  • which: "previous" | "next" | string (The AniDB Episode ID)

Example:

pause

pause()

Pauses the current playback.

Example:

resume

resume()

Resumes playback if it is currently paused.

Example:

seek

seek(seconds)

Seeks the video by a relative amount of seconds.

Parameters:

  • seconds: Number - The number of seconds to seek forward (positive) or backward (negative).

Example:

seekTo

seekTo(seconds)

Seeks to a specific timestamp in the video.

Parameters:

  • seconds: Number - The absolute timestamp to seek to.

Example:

terminate

terminate()

Stops playback and terminates the media player instance.

Example:

setFullscreen

setFullscreen(fullscreen)

Toggles or sets the fullscreen state of the player.

Parameters:

  • fullscreen: Boolean - true to enter fullscreen, false to exit.

Example:

setPip

setPip(enabled)

Toggles or sets the Picture-in-Picture (PiP) state of the player.

Parameters:

  • enabled: Boolean - true to enable PiP, false to disable.

Example:

showMessage

showMessage(message, duration)

Displays a temporary OSD message on the media player.

Parameters:

  • message: String - The text to display.

  • duration: Number - Duration in milliseconds, default is 2000.

Example:

getTextTracks

getTextTracks()

Asynchronously retrieves the list of available subtitle/caption tracks.

Example:

setSubtitleTrack

setSubtitleTrack(trackNumber)

Selects a specific subtitle track.

Parameters:

  • trackNumber: Number - The ID/index of the subtitle track to select.

Example:

setMediaCaptionTrack

setMediaCaptionTrack(trackIndex)

Selects a specific media caption track.

Parameters:

  • trackIndex: Number - The index of the caption track to select.

Example:

addExternalSubtitleTrack

addExternalSubtitleTrack(track)

Adds an external subtitle file as a track and selects it.

If "Convert Soft Subs to ASS" is enabled, the track will be converted to ASS, else it will be converted to WebVTT.

Parameters:

  • track: Object - A VideoSubtitleTrack object

Example:

setAudioTrack

setAudioTrack(trackNumber)

Selects a specific audio track.

Parameters:

  • trackNumber: Number - The ID/index of the audio track to select.

Example:

getPlaybackStatus

getPlaybackStatus()

Synchronously retrieves the current status of the playback

Example:

getPlaybackState

getPlaybackState()

Synchronously retrieves the comprehensive state object of the player.

Example:

getCurrentMedia

getCurrentMedia()

Synchronously retrieves information about the media currently being played.

Example:

getPlaylist

getPlaylist()

Asynchronously retrieves the current playlist.

Example:

pullStatus

pullStatus()

Asynchronously forces a status update from the player and returns the result.

Example:

getCurrentPlaybackInfo

getCurrentPlaybackInfo()

Synchronously retrieves the current playback information

Example:

getCurrentClientId

getCurrentClientId()

Synchronously retrieves the unique identifier of the connected client/player.

Returns: String

Example:

getCurrentPlayerType

getCurrentPlayerType()

Synchronously retrieves the type of player currently active (e.g., "native", "web").

Returns: String

Example:

getCurrentPlaybackType

getCurrentPlaybackType()

Synchronously retrieves the type of playback being performed (e.g., "torrent", "debrid", "file", "onlinestream").

Returns: String

Example:

State Request Methods

The following methods are used to request specific state updates from the media player. These functions trigger an event listener response with the requested data.

sendGetFullscreen

sendGetFullscreen() Requests the current fullscreen state.

sendGetPip

sendGetPip() Requests the current Picture-in-Picture state.

sendGetAnime4K

sendGetAnime4K() Requests the current Anime4K configuration/state.

sendGetSubtitleTrack

sendGetSubtitleTrack() Requests the currently selected subtitle track.

sendGetAudioTrack

sendGetAudioTrack() Requests the currently selected audio track.

sendGetMediaCaptionTrack

sendGetMediaCaptionTrack() Requests the currently selected media caption track.

sendGetPlaybackState

sendGetPlaybackState() Requests the full playback state.

Last updated