discordjs / voice

Implementation of the Discord Voice API for discord.js and other JS/TS libraries
Apache License 2.0
328 stars 112 forks source link

refactor(Examples): use ytdl-core instead of youtube-dl-exec #177

Closed ksw2000 closed 2 years ago

ksw2000 commented 2 years ago

Please describe the changes this PR makes and why it should be merged:

  1. Do not dependent on youtube-dl-exec anymore.
  2. Update other dependencies.

This PR can make beginner easier to get started

Status and versioning classification:

amishshah commented 2 years ago

We purposefully use youtube-dl since ytdl-core is not reliable enough in our opinion. In the last few years, we have received many issues relating to ytdl-core specifically with Discord bots. I'm sure it's a great library for actually downloading, but when it comes to generating a continuous stream, it seems to suffer from abort/reconnect issues.

This example did originally start out with ytdl-core, but I also kept coming across the same issues we've been seeing on the discord.js issue tracker for months. I'm aware that there's a "fix" of just increasing the highWaterMark, but that's not really a fix, that just means you're downloading as much of the video into memory as you can rather than streaming it. As a result of this, I switched the example to youtube-dl which doesn't suffer from these issues.

If ytdl-core does eventually fix these issues I'd be more than happy to switch back to it, but until these issues are fixed I do not want to recommend it for use with Discord bots due to the sheer number of issues we've received over it.