Does audioplayer buffering state ever time out?
Apologies in advance, might be a bit long..
Does an
audioplayer
ever time-out if it's in buffering
state for too long?
Also, if not, is there any negative effect if an audioplayer
stays too long in buffering
state? Memory leak or such?
I am working on a discord bot, that takes an opus/ogg stream as input, which comes from another certain older discord music bot that is capable of web streaming (not sure if I am allowed to mention it's name).
The stream is a response from an API call, which needs a stream token.
But my problem was, that the stream closes at certain actions, like stopping the playback manually or changing tracks via certain control buttons of the web UI. In this case, the audioplayer
goes into idle
state and the stream is considered ended, and cannot be resumed, a new token needs to be requested and a new call for a new stream made.
I got around this by watching the audioplayer
state transition and when it goes from playing
to idle
, I make a new API call for a new stream.
I also play this new stream right away to account for if the stream ended between switching tracks, but this way, if the stream was stopped manually, I request a new one, it can still be played but will be basically playing nothing and the audioplayer
stays in buffering
state until the playback is not resumed again via the web UI.
So, question from the beginning: could there be any drawbacks from this?4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by staff😮
what do you mean?
This behaviour is against Discord TOS?
It's a music bot designed in the beginning for another voip platform but got discord support later. it is capable of playing local media as well as streaming media, and it does have it's own discord bot capability, but it's discord portion is quite outdated and not maintained actively. And I got an idea on their support server, that the bot actually has it's own API to obtain a stream of the music it plays and control it, so if one wants, they can feed the stream into another discord bot to make up for the shortcomings of the outdated one.
apparently from YT, but I'm not sure if that part of the code is still working, I only used it for playing my local media.
I'm sorry, if the topic is stretching legal issues, I can remove it, didn't mean harm.
The reason I need the API is because the bot has a nicely done web UI to manage the local media it plays, manage playlist, control the player.. it's so much more convenient then having to control it via commands and interactions.
I know, why don't I listen to a music player app or such then.. 😄
But if we leave the details and just focus on the initial question about the
buffering
state? Or normally it's not a likely scenario for a player to stay in that state for long? I know if I play local media one by one, then it shouldn't, I was just curious about this case.
I'm sorry I was not aware that streaming media from any source via a discord bot is against the TOS. Or we might not be on the same page here. I am NOT trying to stream copyrighted media from YouTube, I am trying to stream my own media from my own computer, played by another application that is able to output web streams, and capture that stream to play via a discord bot I made.
Please clarify if this is also against the TOS, and if it is, I will cease asking more questions and please remove this thread. I really didn't came here for trouble, sorry again.it's not that streaming media from any source via a discord bot is against tos, nor is it really about copyright, though I suppose a claim could be made there
streaming from youtube to discord is against youtube's tos, and by extension discord's tos
I am trying to stream my own media from my own computer, played by another application that is able to output web streams, and capture that stream to play via a discord bot I made.if I'm reading your previous messages correctly, it sounds like "another application" is an entire other bot, which sounds completely unnecessary on top of that bot violating tos since there's plenty of software to do exactly what you're trying to do without going through another bot I'm assuming that when you say "media from my own computer" this may not necessarily refer to media local to your bot, as it could be hosted elsewhere though in case it is local to your bot and this wasn't clear, media local to your bot could just be played directly it's true that playing media from your own computer is not against tos that being said, continuing to use a tos violating service is not something we support imo it's also frankly a bit of a grey area for us to just provide support immediately after someone says "ok I stopped :)" since there's no real way for us to ensure they actually intend to stop
Understood. Apologies for bothering. Please close and delete the thread.