Closed Bug 528566 Opened 16 years ago Closed 15 years ago

Resource selection algorithm not invoked on "new Audio(url)"

Categories

(Core :: Audio/Video, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: benadler, Assigned: cpearce)

References

()

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (compatible; Konqueror/4.3; Linux) KHTML/4.3.73 (like Gecko) Build Identifier: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 If I go to https://politbuero.dyndns.org/audiotest.html, I cannot hear any sound. When I UNcomment "//audio.play();", it works. For some reason, adding function foo() as event listeners for these events does not work. The alert("foo!"); does never show. There's no errors in the console, firebug shows no problems either. I tried finding the problems for days, no success. Noone in #js or #firefox could help. Same problem on winXp/32. Reproducible: Always
Oh, I'd like to know whether this might be related: https://bugzilla.mozilla.org/show_bug.cgi?id=493692
As far as I know the behaviour whereby the audio doesn't play unless that line is commented out is the correct one. Creating an Audio object shouldn't play unless play() is called on it. If I uncomment that line, the audio plays and the alerts as a result of the event listeners fire for me (on a trunk build). So as far as I can tell there is no bug here. Can you confirm if this is the case?
Hi Chris, I know it plays the sound when the audio.play() line is uncommented. Instead of playing the sound immediately, I want it to play when it canplaythrough. When an audio object is created and autobuffer is set to true, the browser should start downloading it. As soon as enough data for canplaythrough is available, it should fire the canplaythrough event. But it never does that on my machine. With the code as it is, the canplaythrough event (or suspend event) should be fired and the sound should play because foo() calls obj.play(). But again, these events are never fired for me. If you leave the audio.play on line 13 COMMENTED, do the events fire for you? Is the audio being played?
The testcase provided now refers to a audio file which is no longer there. The problem here is that we don't kick off the resource selection algorithm when "new Audio(url)" is called. According to the spec we should http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#audio Fix is simple, in nsHTMLAudioElement::Initialize() we should call QueueSelectResourceTask() after we successfully have set the src attribute.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: audio events canplaythrough, suspend are never fired → Resource selection algorithm not invoked on "new Audio(url)"
OS: Linux → All
Hardware: x86_64 → All
Attached patch Patch v1Splinter Review
Patch with backend independent test.
Assignee: nobody → chris
Attachment #432734 - Flags: review?(chris.double)
Chris, I fixed the testcase and applied your patch to gentoo's www-client/mozilla-firefox-3.5.8. Same behaviour as before, foo() is never executed. Nothing in the error console. I assume the patch works for you? How can I help? ben
Attachment #432734 - Flags: review?(chris.double) → review+
Keywords: checkin-needed
Whiteboard: needs-landing
Status: NEW → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: needs-landing
Ben - the patch works for me locally (and the included test passes). I encourage you to try a nightly build now that the fix has been committed and verify that the problem is solved. There may be some other issue with the older 3.5 codebase that has since been fixed.
Excuse me, but it still doesn't work for me. Not with a patched 3.5.8 on linux/amd64, and not with 3.6.3 on either winxp/32 or linux/amd64. I haven't tried the test in the patch, I'm talking about my testcase, which still doesn't play any sounds. Is https://politbuero.dyndns.org/audiotest.html doing something wrong? thanks! ben
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(In reply to comment #9) > Excuse me, but it still doesn't work for me. Not with a patched 3.5.8 on > linux/amd64, and not with 3.6.3 on either winxp/32 or linux/amd64. The fix was made in development builds of Firefox. It won't be fixed in Firefox 3.5 or 3.6. You can download a mozilla-central nightly build at http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-central/ to see it fixed.
Status: REOPENED → RESOLVED
Closed: 16 years ago15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: