discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.25k stars 3.95k forks source link

AudioPlayerError: Aborted #8817

Open Greensky-gs opened 1 year ago

Greensky-gs commented 1 year ago

Which package is this bug report for?

voice

Issue description

This error happen randomly on audio files at random times from videos. I use ytdl-core to get the audio file from a youtube video

  1. Get the audio file
  2. Make it an audio resource
  3. Play it on an AudioPlayer
  4. Set an error listener on the player
  5. Waiting for the error to randomly happen.

I was looking for more informations about this error, because I got it very frequently, and if there is a way to fix it on the package/in the code

Code sample

const rs = createAudioResource(ytdl('video url'), { filter: 'audioonly' }), {
      inlineVolume: true
});

let connection: VoiceConnection = queue?.connection;

if (!queue) {
         connection = joinVoiceChannel({
         channelId: channel.id,
         guildId: interaction.guild.id,
         adapterCreator: interaction.guild.voiceAdapterCreator,
         selfDeaf: true
      });
 }

connection.subscribe(player);
player.play(rs);

Package version

@discordjs/voice@0.13.0

Node.js version

node: 16.17.1 Typescript: 4.8.4

Operating system

windows 11

Priority this issue should have

Low (slightly annoying)

Which partials do you have configured?

Channel

Which gateway intents are you subscribing to?

Guilds, GuildVoiceStates, GuildMessages

I have tested this issue on a development release

No response

AliceTheSnowpix commented 1 year ago

ytdl-core requires node version 14 to work properly but discord.js requires node version 16+ to work properly, if you want to have music work without this error happening switch to the Play-dl node module,