-
Is there a way to play local files with discord-player? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I'm not sure how to play local files by adding "search engine value" |
Beta Was this translation helpful? Give feedback.
-
yes absolutely, the procedure is same as usual, you just need to explicitly set 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 you need)
}); Also, if you are not using const { AttachmentExtractor } = require('@discord-player/extractor');
player.extractors.register(AttachmentExtractor, {}); |
Beta Was this translation helpful? Give feedback.
yes absolutely, the procedure is same as usual, you just need to explicitly set
searchEngine
value toQueryType.FILE
. Here is an example: