-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix audio streaming output issues in 4.0 #6343
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/5be7b1fd77670086e48a546d3259cfafe665c3a6/gradio-4.1.2-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@5be7b1fd77670086e48a546d3259cfafe665c3a6#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
Will take a look! But could we add some tests to prevent regressions in the future? I think an e2e playwright test is warranted here |
Ah nice, I had noticed this issue in the Spaces deploy before |
The output streaming isn't quite working for me. I get the behavior that some other users have described, which is that the audio file doesn't play until the full audio has been streamed. I've tried a few different things:
This is the 60 second audio file I'm trying: https://www2.cs.uic.edu/~i101/SoundFiles/CantinaBand60.wav |
Synced with @aliabid94, I was testing wrong. LGTM once we can fix the static checks and potentially add tests |
Don't love the fallback UI, but we should get this in so that streaming works again. Perhaps @hannahblair you could take a look at the UI in a separate PR? |
Adding playwright tests to this is going to be quite tricky because streaming is handled by the browser, not any javascript, so I'm not sure what we can specifically test is being done correctly in streaming. As far as the JS is aware, the HTML is set to a single source the same way a non-streaming audio file is. |
@hannahblair if you have ideas to make the streaming audio player prettier than just using the default player, might be something you can take a look at! |
Sounds good, let's merge this in for now |
Thanks so much for handling this @aliabid94! Let me have a think about how I can address the fallback UI for this and get back to you. |
Streaming audio out broke in 4.0, as can be seen in the
stream_audio_out
demo. The waveform generator does not support a streaming audio source, so did a fallback onto a regular audio component. Test this viastream_audio_out
demo.There was another issue that whenever the DOM re-rendered for any reason, the waveform would have to regenerate, causing it to fetch the audio source on every DOM re-render. This is because normalize_files caused a new JSON to be passed to the AudioPlayer, so any DOM change caused a re-render. Now only re-renders if the URL changes. Test this via demo below while watching the Network Chrome inspector: