Class SpotifyPlayerSpirc

Wrapper for librespot SPIRC player

Hierarchy

  • GenericPlayer
    • SpotifyPlayerSpirc

Constructors

Properties

_isInitialized: boolean = false
_positionHolder: PositionHolder
_volume: number = 0
device_id: string
eventEmitter: EventEmitter = ...
off: (<T>(event, callback) => EventEmitter) = ...

Type declaration

    • <T>(event, callback): EventEmitter
    • Type Parameters

      Parameters

      • event: T
      • callback: ((event) => void)
          • (event): void
          • Parameters

            Returns void

      Returns EventEmitter

on: (<T>(event, callback) => EventEmitter) = ...

Type declaration

    • <T>(event, callback): EventEmitter
    • Type Parameters

      Parameters

      • event: T
      • callback: ((event) => void)
          • (event): void
          • Parameters

            Returns void

      Returns EventEmitter

playerInstance: undefined
tokenHandler: TokenHandler

Accessors

  • get isInitialized(): boolean
  • Returns boolean

Methods

  • Type Parameters

    Parameters

    • event: T
    • callback: ((event) => void)
        • (event): void
        • Parameters

          Returns void

    Returns EventEmitter

  • Adds track to queue

    Parameters

    • trackURI: string

      spotify URI or URL of track to be added to queue. (Eg. spotify:track:4PTG3Z6ehGkBFwjybzWkR8)

    Returns Promise<void>

  • Clear all listeners and close player

    Returns Promise<void>

  • Returns spotify canvas URL for track

    Parameters

    • track: string

      track URI or URL to get canvas for

    Returns Promise<undefined | CanvazResponse>

    Spotify canvas public URL

  • Get current position of player

    Returns number

    current position in milliseconds

  • Returns string

  • Get lyrics for spotify track

    Parameters

    • track: string

      Spotify track URI or URL

    Returns Promise<undefined | LyricsResponse>

  • Returns volume in percentage or uint16

    Parameters

    • raw: boolean = false

      If true, returns volume in uint16. Otherwise percentage

    Returns number

    volume in percentage or uint16

  • Loads a track by Spotify URI or URL

    Parameters

    • trackURI: string

      spotify URI or URL of track to be loaded. (Eg. spotify:track:4PTG3Z6ehGkBFwjybzWkR8)

    • autoplay: boolean = false

      if true, track will start playing immediately after being loaded. (Default: false)

    Returns Promise<void>

  • Returns void

  • Type Parameters

    Parameters

    • event: T
    • callback: ((event) => void)
        • (event): void
        • Parameters

          Returns void

    Returns EventEmitter

  • Set player state to paused

    Returns Promise<void>

  • Set player state to play

    Returns Promise<void>

  • Returns void

  • Type Parameters

    Parameters

    • event: T
    • callback: ((event) => void)
        • (event): void
        • Parameters

          Returns void

    Returns EventEmitter

  • Seek current song to position

    Parameters

    • posMs: number

      position in milliseconds

    Returns Promise<void>

  • Set volume in percentage or uint16

    Parameters

    • volume: number
    • raw: boolean = false

      if true, volume is set in uint16. Otherwise percentage. (Default: false)

    Returns Promise<void>

  • Parameters

    • val: string

    Returns [undefined | string, undefined | string]

Generated using TypeDoc