discord-music-player: [BUG] I can't play certain youtube links
Bug Description When I play certain youtube videos, the bot joins the voice channel but doesn’t play any video and instantly leaves the channel.
I think he was leaving because the timeout is 0 by default, by increasing it, I get an error :
TypeError: Cannot read property 'url' of undefined
at Player._playSong (/node_modules/discord-music-player/src/Player.js:541:34)
at StreamDispatcher.<anonymous> (/node_modules/discord-music-player/src/Player.js:563:29)
at StreamDispatcher.emit (events.js:326:22)
at finishMaybe (_stream_writable.js:639:14)
at _stream_writable.js:616:5
at StreamDispatcher._final (/node_modules/discord.js/src/client/voice/dispatcher/StreamDispatcher.js:248:5)
at callFinal (_stream_writable.js:609:10)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Reproduction Steps The links used : https://youtu.be/C_29TAVQrm8 and https://www.youtube.com/watch?v=VOxtCodiqPU The code of the play command :
let isPlaying = client.player.isPlaying(message.guild.id);
// If there's already a song playing
if(isPlaying){
// Add the song to the queue
let song = await client.player.addToQueue(message.guild.id, args.join(' '), {}, message.author.tag);
song = song.song;
message.channel.send(`Song ${song.name} was added to the queue!`);
} else {
// Else, play the song
let song = await client.player.play(message.member.voice.channel, args.join(' '), {}, message.author.tag).then(async song => {
if(song.error) throw(song.error);
song = song.song;
message.channel.send(`Started playing ${song.name}.`);
}).catch(err => {
console.log(err);
});
I don’t know what additional information you need, ask me if you want more.
Versioning:
- OS : Debian GNU/Linux 9.13
- NPM Version v7.5.2
- discord.js v12.5.1
- ytdl-core v4.4.5
- discord-music-player v6.4.1
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (8 by maintainers)
Ok, It’s not an error with your module, it must be some restrictions on certain YT videos, locally or on another machine it works very well, I’ll try to fix it on my machine. I don’t bother you more, thanks !