Discord Player
Faq

Troubleshooting Common Issues

Troubleshooting common issues and errors

Cannot find mediaplex or opusscript or @discordjs/opus or node-opus

To resolve this issue, you need to install the opus encoder. Use one of the following commands based on your preference:

npm i mediaplex
# or
npm i @discordjs/opus
# or
npm i opusscript
# or
npm i node-opus

FFmpeg/Avconv not found

Ensure that you have either FFmpeg or Avconv available on your system.

Installing FFmpeg or Avconv

We do not recommend using static binaries like ffmpeg-static as they are not always up-to-date or stable and may cause issues.

You have several options to get FFmpeg:

  • Download it from the official FFmpeg website: www.ffmpeg.org/download.html
  • Use the Node Module (ffmpeg-static): npmjs.com/package/ffmpeg-static (Note: Using static binaries like ffmpeg-static is not recommended)
  • You can dockerize your bot with a Node environment (Example : 18.16.0-bullseye) that can have ffmpeg installed. Check Showcase for sample implementations.
  • Alternatively, if you prefer using Avconv instead of FFmpeg, install it on your system or place the Avconv executable at the root of your project.

Audio player stops immediately without errors

This issue is most likely caused by the usage of static binaries like ffmpeg-static. We do not recommend using static binaries as they are not always up-to-date or stable and may cause issues. To fix this issue, make sure to install FFmpeg or Avconv on your system.

Audio player stops after about 30 seconds to 1 minute without errors

This issue is most likely caused by outdated version of discord-voip. Make sure you are using the latest version of discord-voip and discord-player.

"Something" is not working

If you encounter issues and something isn't functioning correctly, try attaching a debug listener to player.events to check for any unusual behavior:

index.js
const { useMainPlayer } = require('discord-player');
 
client.once('ready', () => {
  const player = useMainPlayer();
 
  // generate dependencies report
  console.log(player.scanDeps()); 
  // ^------ This is similar to discord-voip's `generateDependenciesReport()` function, but with additional informations related to discord-player.
 
  // log metadata query, search execution, etc.
  player.on('debug', console.log); 
  // ^------ This shows how your search query is interpreted, if the query was cached, which extractor resolved the query or which extractor failed to resolve, etc.
 
  // log debug logs of the queue, such as voice connection logs, player execution, streaming process etc.
  player.events.on('debug', (queue, message) => console.log(`[DEBUG ${queue.guild.id}] ${message}`)); 
  // ^------ This shows how queue handles the track. It logs informations like the status of audio player, streaming process, configurations used, if streaming failed or not, etc.
});

If you receive errors such as "something is not a constructor" or "version.split is not a function" or similar, follow these steps:

  • If you are using npm, remove node_modules, package-lock.json, or any lockfiles you have. Then, run npm cache clean --force, or use a similar command for your package manager, and finally run npm install (or the install command of your package manager).
  • If the above step does not resolve the issue, consider using another package manager like yarn, pnpm, or bun.

If you are still unable to resolve the problem, don't hesitate to seek assistance from our official support server.

On this page