Skip to content

How to play local files? #1763

Answered by twlite
ninguest asked this question in Q&A
Jul 8, 2023 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Is there a way to play local files with discord-player?

yes absolutely, the procedure is same as usual, you just need to explicitly set searchEngine value to QueryType.FILE. Here is an example:

const { QueryType } = require('discord-player');

// Relative path also works, but absolute path is recommended
// this is a path to your local file which you want to play
const filePath = 'E:/path/to/music.mp3';

await player.play(channel, filePath, {
    // in order to play local files, we need to explicitly tell discord-player to search that path in our file system
    searchEngine: QueryType.FILE // QueryType.FILE tells discord-player to play from our file system,
    // ... (other options if…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ninguest
Comment options

Answer selected by twlite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants