decodeAudioData Promise is never fullfilled
Categories
(Core :: Web Audio, defect)
Tracking
()
People
(Reporter: francexi, Unassigned)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
56.21 KB,
text/plain
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0
Steps to reproduce:
load an OGG Vorbis file using Fetch API as ArrayBuffer, then try to decode it using decodeAudioData() from a valid AudioContext
Here the code I use:
let myRequest = new Request(url);
fetch(myRequest).then(function(response) {
return response.arrayBuffer();
}).then(function(data) {
const promise1 = audioCtx.decodeAudioData(data)
promises.push(promise1); //here to check later the promise
promise1.then(function(buffer) {
/* do stuff */
});
});
Actual results:
The Promise returned from decodeAudioData is always into the state "pending" and never goes into fullfilled.
If you set some callback functions, they are never called, both the succesful and the error one
Expected results:
Promise goes fullfilled when the decoding is finished and/or callback function is called
Comment 1•4 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Comment 2•4 years ago
|
||
This works well here in Firefox Nightly on macOS, and is tested, and tests are passing.
Please provide a copy of about:support
(copy raw data), and the exact code you're testing with (i.e. a working example).
on https://spy-cards.lubar.me (none of the code on the page is required for this snippet to run, just the relative URL)
buzzer = await (await fetch("audio/Buzzer.opus")).arrayBuffer();
actx = new AudioContext();
await actx.decodeAudioData(buzzer, function(x){debugger}, function(y){debugger});
the promise does not resolve or reject, and the debugger statements are not reached.
without the callback functions, the behavior is the same (the promise never resolves or rejects).
Reporter | ||
Comment 5•4 years ago
|
||
i found a little workaround. Putting this line before the decodeAudioData makes it work:
if(audioCtx.state === "suspended") await audioCtx.resume();
I noticed console logging the context before calling decodeAudioData that its state was suspended, resuming it did the trick. Anyway the bug seems to be that if decodeAudioData is called while the context is suspended, it will never be fullfilled, even if the context resumes later. I'm also kinda positive that the audio context should not be suspended at initizialization time.
Tried the code without the workaround on Chromium, there works properly
Additional information:
- I'm using Firefox Developer Edition on Windows 10.
- This works properly on Firefox ESR in my Chromebook's Debian Buster VM.
- This worked previously in Firefox Developer Edition on Windows 10.
- Audio was added to Spy Cards Online on July 21st, so this defect appeared in Firefox Developer Edition less than 3 weeks ago.
- https://spy-cards.lubar.me/?audioDebug logs information about the loading of audio files to the console. The "decoded audio:" message in this function is not reached in Firefox Developer Edition: https://git.lubar.me/ben/spy-cards/src/commit/147a642980abc971b5a3a4bf8da294d0546408a0/src/sc-audio.ts#L81-L94
Reporter | ||
Comment 7•4 years ago
|
||
Additional informations:
- Firefox Developer Edition on Slackware64 current
- The code worked perfectly on Firefox 79
This appears to be fixed for spy-cards.lubar.me on my machine in Firefox Developer Edition 80.0b5, which would explain why it wasn't showing up on Nightly.
Comment 9•4 years ago
|
||
- Load https://spy-cards.lubar.me/?audioDebug
Optional 2. Ctrl+Shift+k to show Web Console - Click "Enable Audio".
- Wait 1 second
Expect:
sound
AUDIO: decoded audio: Inside2
AUDIO: decoded audio: Miniboss
Actual:
no sound
decoding still pending
Good 732d6918f5bbd8578d623e07c643512296ea4706 20200710094819
Bad f3ab1da2cea8d35101840daed1b94e35e07782d5
Updated•4 years ago
|
Description
•