The audio will suddenly pause when I'm halfway through playing, and it will show
AudioPlayerError: aborted
I have seen bug issues here(GitHub) , but no one has come up with a solution until 2024
use ytdl
const stream = ytdl(this.queue[guildID][0].url)
use play-dl
const play_stream = await play.stream(this.queue[guildID][0].url, {
discordPlayerCompatibility: true,
})
Both of these things will work when I use
const resource = createAudioResource(play_stream.stream, {
inputType: StreamType.WebmOpus
});
Suddenly paused playback on the way but if i try
const outputStream = fs.createWriteStream('audio.mp3');
play_stream.stream.pipe(outputStream);
outputStream.on('finish', () => {
console.log('The audio data has been successfully saved to the file.');
});
The download will be completed quickly, which shows that it is a cache problem.
this looks weird to me
discordPlayerCompatibility is only if you use discord-player (which is it's own library) which is not needed if you use discord.js/voice
i use this instead and it should work
this might also be a problem with your audioplayer if so setting the noSubscriberBehaviour to play (this may help)
(you will need to change it to work with your code)