Closed Bug 780170 Opened 9 years ago Closed 9 years ago

Event "ended" fired late with some audio element

Categories

(Core :: Audio/Video, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 582513
blocking-basecamp +

People

(Reporter: ju.carrier, Unassigned)

Details

Attachments

(1 file)

Attached audio my sound sample
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Build ID: 20120714012003

Steps to reproduce:

I added an event listener on an audio element on the "ended" event.
HTML:
            <audio preload="auto" id="mySound" controls>
                <source src="/sounds/mySound.ogg" type='audio/ogg; codecs="vorbis"'>
            </audio>
JS:
// when I click on "play", I save a starting time:
startTime = new Date();

// this function listens to the "ended" event
mySound.addEventListener('ended', function() {
    endTime = new Date();
    elapsed = (endTime.getTime() - start.getTime()) / 1000
    console.log(elapsed)
}, false);


Actual results:

The snippet above will log the time elapsed between the moment I start playing the sound and the moment the event "ended" is fired. This time should be roughly equal to the audio duration. It is not: the audio lasts  less than one second while the event "ended" is fired more than 3 seconds after the click on "play".
Attachment #648721 - Attachment mime type: application/octet-stream → audio/ogg
blocking-basecamp: --- → ?
Dominic says this blocks Music app on gaia. Dominic, can you provide the details of why this blocks your work?
When the music app finishes a song, it should auto-play the next song.
What triggers music to play the next song is the "ended" event of the <audio> tag.

In my test, the ended event of ogg can be successfully fired, but mp3 fails.
So currently, if users play mp3, then after the mp3 finishes, the player will stop and do nothing.
Yep, this blocks. We can't play albums or playlists without this.
blocking-basecamp: ? → +
Component: Untriaged → Video/Audio
Product: Firefox → Core
Version: 14 Branch → Trunk
Status: UNCONFIRMED → NEW
Ever confirmed: true
Which platform are you seeing this on?  Comment 0's UA details suggest Firefox 14 on Linux, which is affected by bug 582513 (fixed in Firefox 15).  If you're seeing this on other versions/hardware, please be specific about what it is.

Can you confirm that this only happens with MP3 and never happens with Ogg (which comment 2 suggests)?
Yes, it is on Firefox 14 on Ubuntu 10.04 "Lucid Lynx" 64bits. It does happen with the Ogg file. However bug 582513 seems to describe exactly the same problem on the same platform. It seems that I just posted a duplicate.
Thanks.

Dominic, please file a new bug for your MP3 issue.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 582513
(In reply to Matthew Gregan [:kinetik] from comment #6)
> Thanks.
> 
> Dominic, please file a new bug for your MP3 issue.
> 
> *** This bug has been marked as a duplicate of bug 582513 ***

OK, I filed a new bug 783512
Thanks.
You need to log in before you can comment on or make changes to this bug.