Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcast stops playing after a certain time on some channels #5531

Closed
weslinho opened this issue Apr 14, 2021 · 8 comments · Fixed by #5402
Closed

Broadcast stops playing after a certain time on some channels #5531

weslinho opened this issue Apr 14, 2021 · 8 comments · Fixed by #5402

Comments

@weslinho
Copy link

Please describe the problem you are having in as much detail as possible:

Im developing a radio bot, using discords Broadcast system. After a time connected in a call, the bot simply stops playing the broadcast on the call and only resumes if it is reconnected. I already tested if it was enough to change the broadcast or just use the .play(<broadcast>) method again but I wasnt successful. It doesnt happen on all channels at the same time, each time a channel is affected by the problem. No errors are returned.

Further details:

  • discord.js version: 12.5.3
  • Node.js version: 14.16.1
  • Priority this issue should have – please be realistic and elaborate if possible: Perhaps not much because its a problem that as far as I know covers only the broadcast system. Some people said they had the same problem on the support discord but also said they had found no solution.
@SamuelScheit
Copy link

@trywesley Can you attach the debug log by adding these loggers to your bot/client event listener:

client.on("debug", console.log)
client.on("error", console.error)
client.on("warn", console.warn)

@vladh
Copy link

vladh commented Apr 20, 2021

I'm also experiencing this issue. My audio stops playing after approximately 350–450 seconds.

I've added the above logs, and when the audio stops playing, I get this message:

[VOICE (705543688167620708:0)]: [WS] >> {"op":5,"d":{"speaking":0,"delay":0,"ssrc":750412}}

Issues #4007 and #4021 seem related.

I'm playing the audio by passing in a URL to an MP3 file. I'm going to try and save the file locally to see if that helps.

@SamuelScheit
Copy link

@vladh @trywesley Could you both show/send the code you are using to play the File/URL.
Also if you are you using ytdl try setting the highWaterMark option to e.g. 8mb: 1024 * 1024 * 8

@vladh
Copy link

vladh commented Apr 20, 2021

The code I was using is basically just this (simplified):

  const connection = message.member.voice.channel.join();
  const dispatcher = connection.play('https://traffic.megaphone.fm/GLT7484278234.mp3?updated=1614292769#t=0');

I'm not using ytdl.

Right now I've changed it to download the file and just play it off the disk, so:

  const dispatcher = connection.play('./some-file.mp3');

It's been playing for the past 600 seconds, so I think the issue was with the connection to the server serving the MP3 file. Perhaps something causes it to be prematurely terminated. I'll keep you updated.

@vladh
Copy link

vladh commented Apr 20, 2021

Update: I've saved the file locally before playing it, and playback doesn't stop anymore. It's probably a good idea to save the file anyway, so, it's all good.

Most likely, the code that does the HTTP request to get the file only manages to download some initial chunk of it. Maybe it's a Connection: keep-alive thing, or a Range thing…I'm not sure how it's done in the library. Either way, at least we've narrowed the problem down.

@jack3898
Copy link

I must say, I have this same problem with ytdl-core-discord (which may inherit the problem from ytdl-core). Which further makes me think that there is some HTTP related issue. 🤔

@masterjanic
Copy link

I have a similiar problem. I am also playing an url stream with the broadcast dispatcher. (No yt-dl library) After arround 1-3 hours the stream stops playing in some voice channels. If I rejoin the bot to the voice channel, the stream is working perfectly fine again. It is like the channel dispatcher is re-subscribing to the broadcast when rejoining. So the broadcast dispatcher seems to work.

@amishshah
Copy link
Member

Hi there,

We're working on a new implementation of Discord's Voice API that has better playback quality and is more reliable than what we currently support in Discord.js v12 - check it out at https://github.com/discordjs/voice!

The new library solves many of the issues that users are facing, and as part of this, we're dropping built-in support for voice in our next major release. We have a PR (#5402) that adds native support for our new voice library - once this PR is merged, this issue will be closed.

You can still use our new voice library before that PR lands - just take a look at our music bot example to see how to get started upgrading your voice code. By using the boilerplate music player in the example, you can make it even easier to upgrade your code.

Note that the PR above only reduces some of the boilerplate code you'd otherwise have to write - you do not have to wait for the PR to be merged to start using the new voice library.


If you have any questions about this, feel free to:

  • Make an issue if you have found a bug in the new voice library
  • Use GitHub Discussions or join our Discord server (we have a new channel, #djs-new-voice, specifically for this!) to ask general questions about the library, give feedback on the library, and get support with upgrading to it

@amishshah amishshah linked a pull request Jun 9, 2021 that will close this issue
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants