-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
VoiceClient.play() plays too fast in the first 5-10 seconds when streaming from youtube url #9120
Comments
I got the same issue with the bot sometimes. I used |
+1 same problem here I have a client server configuration. The Bot calls the API /youtube/get/myvideoid, then the server starts downloading audio and send it back to the client using Flask send_file. So all i receive from the Bot is a pretranscoded mp3 audio. This is the code:
As you can see the important line is this one: I directly play the generated audio calling my APIS, the resulting URL is something like: Any thoughts? |
Has anyone found a reliable solution to this issue? I'm also having the same problem. |
Summary
If you stream any audio from a youtube url (not sure if the same applies for non-youtube urls), the first 5-10 seconds of audio are sped up by a significant amount. This does not happen when downloading the video and playing it locally using youtube-dl. I have also tried extracting the video url using PyTube to see if youtube-dl was the problem, but the problem still persists with it as well. Also, this does not happen all the time. Sometimes, the audio will play normally. Sometimes it will play quickly. I have replicated this with basic_voice.py.
Reproduction Steps
Minimal Reproducible Code
No response
Expected Results
Audio starts playing at the same speed throughout the entire clip.
Actual Results
Audio starts playing quickly then slows down to the usual pace after around 5-10 seconds of audio.
Intents
message_content
System Information
Checklist
Additional Context
A question pertaining to the same (or a similar) bug was posted to StackOverflow around 1 year ago: https://stackoverflow.com/questions/70545716/discord-py-ffmpeg-song-plays-too-quickly-at-the-beginning
The only "workaround" that is possible is to asyncio.sleep(), as the comment in the post suggests. However, this does not guarantee that this will happen. It merely decreases the chances.
Due to the randomness and how asyncio.sleep() seems to somehow slightly alleviate this, I'm thinking it's some sort of network problem, but I could be wrong.
The text was updated successfully, but these errors were encountered: