> For the complete documentation index, see [llms.txt](https://vulkava.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vulkava.js.org/docs/player.md).

# Player

Represents a Player instance

| Methods                             |
| ----------------------------------- |
| [connect](#connect)                 |
| [disconnect](#disconnect)           |
| [destroy](#destroy)                 |
| [moveNode](#movenode)               |
| [pause](#pause)                     |
| [ping](#ping)                       |
| [play](#play)                       |
| [seek](#seek)                       |
| [setSelfDeaf](#setselfdeaf)         |
| [setSelfMute](#setselfmute)         |
| [setTrackLoop](#settrackloop)       |
| [setQueueLoop](#setqueueloop)       |
| [setVoiceChannel](#setvoicechannel) |
| [shuffleQueue](#shufflequeue)       |
| [skip](#skip)                       |

### Constructor

#### new Player(options)

| Property |     Description    |                                           Type |
| -------- | :----------------: | ---------------------------------------------: |
| options  | The Player options | [PlayerOptions](/docs/vulkava.md#createplayer) |

### Properties

<table><thead><tr><th width="179.7636684303351">Name</th><th width="358.8178614519443" align="center">Description</th><th align="right">Type</th></tr></thead><tbody><tr><td>node</td><td align="center">The lavalink node that this player is connected to</td><td align="right"><a href="/docs/node.md">Node</a></td></tr><tr><td>filters</td><td align="center">The filters instance of this player</td><td align="right"><a href="/docs/filters.md">Filters</a></td></tr><tr><td>guildId</td><td align="center">The guild id of this player</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></td></tr><tr><td>voiceChannelId</td><td align="center">The voice channel id of this player</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></td></tr><tr><td>textChannelId</td><td align="center">The text channel id of this player</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>?</td></tr><tr><td>selfMute</td><td align="center">Whether or not this player is muted</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>?</td></tr><tr><td>selfDeaf</td><td align="center">Whether or not this player is deafened</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>?</td></tr><tr><td>current</td><td align="center">The current track of this player</td><td align="right"><a href="/docs/track.md">Track</a>?</td></tr><tr><td>queue</td><td align="center">The queue of this player</td><td align="right"><a href="https://app.gitbook.com/s/pAK5xpA69xJdb8gb28og/~/changes/NVghI3ljcCnhMB1FLvwc/abstract-classes/abstractqueue">AbstractQueue</a></td></tr><tr><td>trackRepeat</td><td align="center">Whether to repeat the current track</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></td></tr><tr><td>queueRepeat</td><td align="center">Whether to repeat the queue</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></td></tr><tr><td>playing</td><td align="center">Whether this player is playing or not</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></td></tr><tr><td>paused</td><td align="center">Whether this player is paused or not</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></td></tr><tr><td>state</td><td align="center">The state of player's connection</td><td align="right"><a href="/enums/connectionstate.md">State</a></td></tr><tr><td>voiceState</td><td align="center">The player voicestate</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></td></tr><tr><td>position</td><td align="center">The player position</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></td></tr><tr><td>exactPosition</td><td align="center">The exact player position</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></td></tr><tr><td>queueDuration</td><td align="center">The queue duration, in milliseconds (DEPRECATED, use queue.duration)</td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></td></tr><tr><td>volume</td><td align="center">The player volume [0, 500] </td><td align="right"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></td></tr><tr><td>recorder</td><td align="center">Gets the player recorder object</td><td align="right"><a href="https://app.gitbook.com/s/pAK5xpA69xJdb8gb28og/~/changes/eagIPIYyxPxxczxU6xpH/docs/recorder">Recorder</a></td></tr></tbody></table>

### Methods

#### connect()

Connects the bot to the voice channel

#### disconnect()

Disconnects the bot from the voice channel

#### destroy()

Destroys the player and disconnects the bot from the voice channel

#### moveNode()

Moves the player to another lavalink node

| Parameter |                                                                   Description |
| --------- | ----------------------------------------------------------------------------: |
| node      | <p><a href="/docs/node.md">Node</a><br>The target node to move the player</p> |

#### pause()

Pauses or resumes the player

| Parameter |                                                                                                                                                 Description |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------: |
| state     | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a><br>Whether to pause the player or not</p> |

#### ping()

Gets the latency between discord voice gateway & lavalink node.

| Returns                                                                                                                                                                                                |       Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------: |
| [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)> | The latency value |

#### play()

Plays a track

| Parameter         |                                                                                                                                                                                                      Description |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| options           |                                                                                                     [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) (optional) |
| options.startTime |                                               <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a> (optional)<br>Track start time in milliseconds</p> |
| options.endTime   |                                                 <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a> (optional)<br>Track end time in milliseconds</p> |
| options.noReplace | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a> (optional)<br>Whether to ignore the play operation if a track is already playing or paused</p> |

#### seek()

Seek to a specific position in the track

| Parameter |                                                                                                                                                  Description |
| --------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------: |
| position  | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a><br>The position to seek, in milliseconds</p> |

#### setSelfDeaf()

Sets the bot's deaf state

| Parameter |                                                                                                                                          Description |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------: |
| state     | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a><br>Whether to self deaf or not</p> |

#### setSelfMute()

Sets the bot's mute state

| Parameter |                                                                                                                                          Description |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------: |
| state     | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a><br>Whether to self mute or not</p> |

#### setTrackLoop()

Toggles the track repeating

| Parameter |                                                                                                                                                         Description |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| state     | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a><br>Whether to repeat the current track or not</p> |

#### setQueueLoop()

Toggles the queue repeating

| Parameter |                                                                                                                                                 Description |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------: |
| state     | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a><br>Whether to repeat the queue or not</p> |

#### setVoiceChannel()

Sets the player voice channel

| Parameter      |                                                                                                                                     Description |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------: |
| voiceChannelId | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a><br>The new voice channel id</p> |

#### shuffleQueue() (DEPRECATED) Use player.queue.shuffle()

Shuffles the queue

#### skip()

| Parameter |                                                                                                                                                                Description |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| amount    | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a> (optional)<br>The amount of tracks to skip (default=1)</p> |
