A REST client to communicate with the companion servers REST API

Implements

Constructors

Accessors

Methods

  • Immediately starts playing the specified video or playlist.

    Important: Either videoId or playlistId or both have to be set. You can also set an url instead. Url is prioritized over videoId and playlistId

    Caution: YouTube Music's UI will display a blank / broken player if both videoId and playlistId are provided but the video is not in the playlist or the playlist does not exist (anymore).

    Parameters

    • data: ChangeVideoInput

      The data to change the video

    Returns Promise<void>

    Throws

    ErrorOutput If something went wrong

  • Play a song from the queue

    Parameters

    • data: number

      The index of the song to play

    Returns Promise<void>

    Throws

    ErrorOutput If something went wrong

  • The authentication token that is required to access the API. You should save this token safely. This method will also set the token in the settings itself.

    Parameters

    • code: string

      The code you got from the requestCode method

    Returns Promise<RequestOutput>

    Throws

    ErrorOutput If something went wrong

    Deprecated

    Please use getAuthToken instead. This method will be removed in the next major version due to the confusing name and the side effect of automatically setting the token in the settings.

  • Seek to a specific time

    Parameters

    • data: number

      The time to seek to

    Returns Promise<void>

    Throws

    ErrorOutput If something went wrong

  • Set the authentication token, so it can be used for further requests.

    We recommend to use the setAuthToken method in the CompanionConnector class instead of this method because it sets the token for both clients and reconnects the socket client if the token changed.

    Parameters

    • token: string

      The token to set

    Returns void

  • Set the volume

    Parameters

    • data: number

      The volume to set the player to

    Returns Promise<void>

    Throws

    ErrorOutput If something went wrong