I am trying to connect an HTMLAudioElement
into the Web Audio API (MediaElementAudioSourceNode
). I set src
followed by calling load()
.
Now while in Chromium this gets me from readyState
0
(HAVE_NOTHING
) to 4
(HAVE_ENOUGH_DATA
), so a follow-up play()
succeeds. But in Firefox I only get to state 2
(HAVE_CURRENT_DATA
) and nothing else happens.
Am I missing a crucial step?
Edit: Here is my debug information:
| | FF Init | FF Load | Ch Init | Ch Load |
|readyState | 0 | 2 | 0 | 4 |
|preload | | | auto | auto |
|duration | NaN | 186.45 | NaN | 186.44 |
|error | null | null | null | null |
|networkState | 0 | 1 | 0 | 1 |
At least from this list, the only difference in initial data is the preload
value in Chrome.
So adding preload = "auto"
after creating the media element (to match the default it obviously has in Chromium) makes it work in Firefox, too.