Weirdest bug i've encountered, probably need a discordjs/voice contributor help here.

Hello, i made a discord player for playing music and tts messages. the youtube way: get stream from ytdl with filter audioonly, and inserting to queue the AudioResource using createAudioResource(stream). then to play (in short) i basically do connection.connect(player), and player.play(resource). the tts way: im generating a tts mp3 file by query using google tts api, im getting the url from the api and then i fetch it using axios.get and requesting it to be responseType: 'stream'. then i define a write stream assigning my audio file path, using pipeline to insert my data into the path and creating a mp3 file. then i make an AudioResource of it using createAudioResource('-audiofilepath-') and pushing it into queue. then its the same play function as the music one only its targeting the tts queue (which works fine). my problem is for some reason when i run a music command and (after a while after its back to idle) a tts command the player just buffers it for an infinite amount of time while i can play the other way around and use tts and then music without a problem. i can also play music and then music as well with no problem. only when its tts and after it music (after idle) it just buffers endlessly. any help would do, open to ideas and would really love if we could go over this on voice chat as we could run through it. thanks in advance!
4 Replies
d.js toolkit
d.js toolkit13mo 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.
Aviv
Aviv13mo ago
"@discordjs/voice": "^0.16.0", "discord.js": "^14.11.0", "google-tts-api": "^2.0.2", "libsodium-wrappers": "^0.7.11", "sodium": "^3.0.2", "tweetnacl": "^1.0.3", "yt-search": "^2.10.4", "ytdl-core": "^4.11.4"
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
Aviv
Aviv13mo ago
Thanks for the response, I've actually solved it yesterday and the solution happened to be just like your solution. I noticed im giving the resource creator the path instead of the stream. That really fixed it. I guess internally the player has some resource states and once he got a good resource it won't go back to the path one or something similar. Thanks for the advice though I'll get to it right away