Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • extensionAPI

Index

Properties

player

Object containing controls for player

Methods

addPlaylist

  • addPlaylist(playlist: Omit<Playlist, "playlist_id">): Promise<string>
  • Add playlist to library

    Parameters

    • playlist: Omit<Playlist, "playlist_id">

      details of playlist which is to be added to library

    Returns Promise<string>

    ID of playlist which has been added

addSongs

  • addSongs(...songs: Song[]): Promise<boolean[]>
  • Add songs to library

    Parameters

    • Rest ...songs: Song[]

      1 or more songs that are to be added to library

    Returns Promise<boolean[]>

    array of booleans with same index as song. True means song has been added successfully

addSongsToPlaylist

  • addSongsToPlaylist(playlistID: string, ...songs: Song[]): Promise<void>
  • Add songs to playlist in library. The song must also exist in the library

    Parameters

    • playlistID: string

      ID of playlist in which songs are to be added

    • Rest ...songs: Song[]

      Songs which are to be added in the playlist

    Returns Promise<void>

getContextMenuItems

getCurrentSong

  • getCurrentSong(): Promise<Song>
  • Get the current playing track. Undefined if no track is playing

    Returns Promise<Song>

getPlayerState

  • Get state of music player. Undefined is player is broken and audio can't be loaded

    Returns Promise<PlayerState>

getPreferences

  • getPreferences<T>(key?: string, defaultValue?: unknown): Promise<T>
  • Fetch preferences by key. If no key is provided, all preferences co-relating to current extension will be fetched.

    Type parameters

    • T

    Parameters

    • Optional key: string

      key of preference to fetch. keys within complex objects can be separated by .

    • Optional defaultValue: unknown

      If the provided key is not found, then default value will be returned.

    Returns Promise<T>

getQueue

getSecure

  • getSecure<T>(key: string, defaultValue?: unknown): Promise<T>
  • Get decrypted value of an encrypted preference

    Type parameters

    • T

    Parameters

    • key: string

      key of preference to fetch. keys within complex objects can be separated by .

    • Optional defaultValue: unknown

      If the provided key is not found, then default value will be returned.

    Returns Promise<T>

getSongs

getTime

  • getTime(): Promise<number>
  • Get current time of the player.

    Returns Promise<number>

getVolume

  • getVolume(): Promise<number>
  • Get volume directly from the audio player

    Returns Promise<number>

off

  • off<T>(eventName: T): void

on

openExternalURL

  • openExternalURL(url: string): Promise<void>
  • Open a url in system browser

    Parameters

    • url: string

      string corresponding to URL which is to be opened

    Returns Promise<void>

registerOAuth

  • registerOAuth(path: string): Promise<void>
  • Register a callback for Oauth on given path. This OAuth can be triggered by calling the url moosync://{path} If the path matches, the whole URL is passed to this extension.

    Parameters

    • path: string

      path on which the callback will be triggered

    Returns Promise<void>

removeContextMenuItem

  • removeContextMenuItem(index: number): void
  • Remove an item from context menu

    Parameters

    • index: number

      index of context menu item which is to be removed

    Returns void

removeSong

  • removeSong(song_id: string): Promise<void>
  • Remove song from library

    Parameters

    • song_id: string

      id of song to remove

    Returns Promise<void>

setContextMenuItem

setPreferences

  • setPreferences(key: string, value: unknown): Promise<void>
  • Set preference by key.

    Parameters

    • key: string

      key separated by '.'

    • value: unknown

      value to be stored for corresponding key

    Returns Promise<void>

setSecure

  • setSecure(key: string, value: unknown): Promise<void>
  • Encrypt value and store in preferences

    Parameters

    • key: string

      key separated by '.'

    • value: unknown

      value to be stored for corresponding key

    Returns Promise<void>

Generated using TypeDoc