I have a music bot and it streams audio from youtube well. Now I want to detect if it is already streaming something. My current code that simply streams is this:
where youtube.stream is just the ytdl-core library.
I know I can keep a flag that is turned true when play starts and add a stream.once('done', () => flag = false), to turn it off, but this doesn't seem to be the most robust solution. The stream object itself should have some property that can tell if it is receiving any audio already.
I have a music bot and it streams audio from youtube well. Now I want to detect if it is already streaming something. My current code that simply streams is this:
where
youtube.stream
is just the ytdl-core library.I know I can keep a
flag
that is turned true when play starts and add astream.once('done', () => flag = false)
, to turn it off, but this doesn't seem to be the most robust solution. The stream object itself should have some property that can tell if it is receiving any audio already.So..... any help would be appreciated 😄