Fix audio response playback for non-GET requests #10228
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is another attempt to fix #8378 when audio playback controller point to the URL of dynamically generated content and not the actual returned content (in browser memory).
Description
The difference of this PR from the previous attempt by the issue author is that this PR checks if the request method was other than GET (and thus is compatible with the default behavior) before trying to convert returned response content to a blob URL into browser cache memory.
Motivation and Context
The problem with the default approach before this PR is that it assumes the URL points to a static resource on the remote host, but in case of dynamically generated audio content (as it usually is the case with Text-to-Speech APIs), the REST API call requires extra parameters (without such the response is invalid) and is not reasonable to be run implicitly by browser.
Fixes #8378.
How Has This Been Tested?
Tested with POST request to a TTS (Text-to-Speech) API endpoint that generates audio response dynamically on-demand depending on extra parameters (query, body content etc.).
Screenshots (if appropriate):
Checklist
My PR contains...
src/
is unmodified: changes to documentation, CI, metadata, etc.)package.json
)My changes...
Documentation
Automated tests