how to play youtube audio on a voice channel ?

i recently updated my project to the last version and now ytdl doesn't works. I made some research on google about it, but everything i test doesn't works. Is it still possible or we can't do that anymore ? Thinks for help
9 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Hugo4774
Hugo4774OP3y ago
14.3.0 16.17.0
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Hugo4774
Hugo4774OP3y ago
ToS ? so i can still play a local song ?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Hugo4774
Hugo4774OP3y ago
i got it with this :
let stream = ytdl("myurl", {
filter: "audioonly",
quality: 'highestaudio',
seek: 0
});
const player = createAudioPlayer();
const resource = createAudioResource(stream);

const connection = joinVoiceChannel({
channelId: vc.id,
guildId: vc.guild.id,
adapterCreator: vc.guild.voiceAdapterCreator,
})
player.play(resource);
connection.subscribe(player);
let stream = ytdl("myurl", {
filter: "audioonly",
quality: 'highestaudio',
seek: 0
});
const player = createAudioPlayer();
const resource = createAudioResource(stream);

const connection = joinVoiceChannel({
channelId: vc.id,
guildId: vc.guild.id,
adapterCreator: vc.guild.voiceAdapterCreator,
})
player.play(resource);
connection.subscribe(player);
thinks
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Hugo4774
Hugo4774OP3y ago
^^
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server