So i get this error message when i start playing music with my discord bot. I'm in v12 of discordjs and I don't know why i'm getting this error and I also don't know how to fix it. Can someone help me ? Thanks
PS : (On the closed issues that are similar, i can't manage to find any answer to my question so I post this issue here)
Edit : I have v2.0.1 of ytdl-core
make sure you're on latest with npm ls ytdl-core
I did npm i ytdl-core@latest a earlier and it downloaded the 2.0.1
This is the latest version right ? Because even with that version it does the error
Can someone help me please, I still have this issue
the latest version does not contain that warning, so there's something else going on.
look in your package.json and package-lock.json for ytdl-core and see what version it is.
I checked and it's written ^2.0.1
i have the same issue
If you are using ytdl-core-discord like the discordjs guide recommends doing, that package uses an older version of ytdl-core which throws this error.
I indeed use ytdl-core-discord, which version should i take of ytdl-core then ?
I have 1.1.0 of ytdl-core-discord
ytdl-core-discord currently does not have a later version available to fix this. A temporary fix I've found is just taking the ytdl-core-discord index.js file, saving it locally into your project and instead of requiring ytdl-core-discord just requiring that file instead. Your project would also need to have the latest of version of prism-media as a dependency if you go that route.
To make it work properly one last thing you will need to do is modifying the filter function in your new file to not check for the audio sample rate, as the newer version of ytdl-core sometimes doesn't return it. This fixed it for me.
Once ytdl-core-discord is updated you can remove this new file and add the newest version of ytdl-core-discord back as a dependency.
I fixed this problem + another one (This video is unavailable) uninstalling ytdl-core-discord and updating prism-media.
Most helpful comment
i have the same issue