My favorites | Sign in
Project Home Downloads Wiki Issues Code Search
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 30452: HTML5 audio ended event doesn't fire
18 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  hc...@chromium.org
Closed:  Apr 2010
Cc:  ism...@chromium.org
M-5

Restricted
  • Only users with EditIssue permission may comment.


Sign in to add a comment
 
Reported by WestonRuter, Dec 15, 2009
Chrome Version       : 4.0.249.30
URLs (if applicable) :
http://weston.ruter.net/projects/test-cases/chrome-premature-audio-ended-event/
Other browsers tested: Chrome on Windows and Mac
Add OK or FAIL after other browsers where you have tested this issue:
     Safari 4: n/a
  Firefox 3.x: n/a
         IE 7: n/a
         IE 8: n/a

What steps will reproduce the problem?
1. Load a short MP3 (<1s) into an Audio instance
2. Register an ended event listener to compare the currentTime with
(playStartTime+audio.duration).
3. Play the audio and save the playStartTime when the canplaythrough event
fires.

What is the expected result?
That in ended event handler, currentTime == (playStartTime+audio.duration)

What happens instead?
currentTime ends up being something like (playStartTime +
audio.duration*Math.random())

Please provide any additional information below. Attach a screenshot if
possible.

See URL above for test case; attached is sample output. Note that the test
case causes Chrome Mac to become unresponsive after a couple plays. See
 issue 30242 .
premature-ended-event-table.png
60.7 KB   View   Download
Jan 10, 2010
#1 j...@chromium.org
(No comment was entered for this change.)
Labels: BetaCandidate
Mar 4, 2010
#2 ism...@chromium.org
(No comment was entered for this change.)
Status: Untriaged
Cc: ism...@chromium.org
Labels: -Area-Misc Area-UI HTML5
Mar 23, 2010
#4 lafo...@chromium.org
(No comment was entered for this change.)
Labels: -Area-UI Area-WebKit
Apr 1, 2010
#5 ka...@chromium.org
(No comment was entered for this change.)
Labels: Mstone-X
Apr 5, 2010
#6 scherkus@chromium.org
I think I know what's causing this.
Status: Assigned
Owner: scher...@chromium.org
Labels: -Area-WebKit -Mstone-X Area-Internals Mstone-5 Internals-Video
Apr 5, 2010
#7 scherkus@chromium.org
 Issue 36398  has been merged into this issue.
Apr 5, 2010
#8 scherkus@chromium.org
 Issue 38930  has been merged into this issue.
Apr 6, 2010
#9 scherkus@chromium.org
Have this reproducing on tip-of-tree Linux building on MP3s.

Using --disable-audio makes the ended event work again, making me believe we've got a 
regression in our audio code.
Status: Started
Labels: -Pri-2 Pri-1
Apr 7, 2010
#10 scherkus@chromium.org
Alright we also had a regression on linux where the ended event wasn't firing at all.  
I've got a fix out for review.
Apr 7, 2010
#11 bugdroid1@gmail.com
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=43914 

------------------------------------------------------------------------
r43914 | scherkus@chromium.org | 2010-04-07 19:04:00 -0700 (Wed, 07 Apr 2010) | 10 lines
Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/linux/alsa_output.cc?r1=43914&r2=43913
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/linux/alsa_output.h?r1=43914&r2=43913
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/linux/alsa_output_unittest.cc?r1=43914&r2=43913
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/linux/alsa_wrapper.cc?r1=43914&r2=43913
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/linux/alsa_wrapper.h?r1=43914&r2=43913

Assume pending buffered bytes is zero when ALSA has underrun.

According to docs, snd_pcm_delay() may not reach zero when ALSA has underrun.  Furthermore it may return negative numbers when underrun, leading to an underflow when converted to uint32.  Previously none of this was an issue however as of r43546 we now wait for pending buffered bytes to reach zero before notifying that the audio stream has finished.

This doesn't completely fix the Linux ended event issue, but is a required fix regardless.

BUG=30452
TEST=media_unittests

Review URL: http://codereview.chromium.org/1618006
------------------------------------------------------------------------

Apr 13, 2010
#12 scherkus@chromium.org
Known issue on multiple platforms, fixes in progress.

Also has impact on looping, as reported in  issue 39478 .
Summary: HTML5 audio ended event doesn't fire
Apr 13, 2010
#13 scherkus@chromium.org
 Issue 37969  has been merged into this issue.
Apr 13, 2010
#14 scherkus@chromium.org
hclam: I'm moving this over to you to confirm whether your loop fix also fixes this 
issue (it should)

if so close/mark as duplicate as needed

thanks!
Owner: hc...@chromium.org
Apr 14, 2010
#15 berger....@gmail.com
Still not fixed in
Google Chrome	5.0.375.3 (Offizieller Build 44229) dev
(amd64, linux, ubuntu repository)
Apr 14, 2010
#16 hc...@chromium.org
Fixed in r44502. Verified on Windows and Mac.

Apr 14, 2010
#17 hc...@chromium.org
(No comment was entered for this change.)
Status: Fixed
Apr 16, 2010
#18 hugwi...@gmail.com
Fix verified on Ubuntu.
Apr 19, 2010
#19 pare...@gmail.com
Fix verified on Snow Leopard 10.6.2 with Chromium 5.0.382.0 (44980).
Apr 20, 2010
#20 scherkus@chromium.org
hugwijst, parente: thanks for verifying!!
May 13, 2010
#21 johnpaul...@gmail.com
hello. 

This never fixed for me, and I think the version number where it was claimed to work 
has rolled into dev channel I'm still without a reliable ended event. I've also 
tested on a Chromium nightly (6.0.401.0 (46998) Ubuntu) and I'm still without a fix 
for this.

One oddity, it seems that the ended event can be triggered by activity on another 
tab. Such as doing form query, navigating to another page. I can't imagine why, as I 
don't understand Chromium's internals well enough.

system {
os: Ubuntu 10.04 (lucid);
arch: AMDx64;
}

it's quite possible my mediaPlayer code is at fault, but the same code was working on 
Chrome, and continues to work on Firefox. Please also note, I'll check again today, 
but I think this isn't an issue on w32, and also perhaps OSX. I'll verify.
May 13, 2010
#22 pare...@gmail.com
johnpaul.harold

Try the test case at  http://jsfiddle.net/x5VRq/1/ which uses no JS library, just DOM APIs.

1) Click the "Click to run test" button in the bottom right pane.
2) The male voice speaks.
3) Text appears when the ended event fires.
4) The female voice speaks.
5) Text appears when the ended event fires.

The voices used to overlap for me on Mac. They do not anymore in Chrome 5.0.375.8 Beta on Mac or when I 
last tested in the 5.0.382.0 (44980) nightly on Mac.
May 13, 2010
#23 johnpaul...@gmail.com
hello parente

I get no ended event. I only hear the male voice, no female. However, I can attest it 
works on Chrome WinXp32.

So, still no ended event on Ubuntu 10.04 6.0.402.0 (47105)
May 23, 2010
#24 johnpaul...@gmail.com
hello all, this issue still isn't fixed for me (6.0.414.0 (47994) Ubuntu, X86_64).

Are there any particular steps that need to be taken to reopen fixed tickets?
May 28, 2010
#25 scherkus@chromium.org
johnpaul.harold: take a look at  issue 45074 

looks like this is a recent issue that's cropping up on linux
May 28, 2010
#26 johnpaul...@gmail.com
scherkus, umm, dude, that ticket you mention, was raised by me :-) But yes, I do have 
that and this starred.

To be slightly serious for a moment, and to reiterate a point I made earlier, while 
the ended event is fired, whatever handles such an event isn't happening, so to all 
intents and purposes, ended is useless (for me at least.) So, in the example given by 
parente above, that doesn't work for me, at all. However, in my own app (kind of 
Spotify done in Rails with HTML5 audio), the ended event fires, but the code I gave 
in  issue 45074  isn't recognising that it's actually fired. Inspector says it has, but 
that's about it.

Now, I have noticed my app working correctly, as in ended has fired and loads up the 
next item in the playlist and off it plays, but I can only force this to happen by 
loading a URL on another tab. I've got no idea why this might force things along, but 
it does. I'm repeating this point, as I'm worried whatever message I'm giving is 
getting diluted across two tickets. My apologies in advance for the duplication, and 
perhaps, noise.

jp
Jul 19, 2010
#27 scherkus@chromium.org
(No comment was entered for this change.)
Labels: -Internals-Video -Area-Internals Feature-Media Area-WebKit
Nov 23, 2010
#28 billbro...@gmail.com
Greetings: 

I've been testing this feature on 7.0.517.44 windows XP.  I was able to see "ended" event fire for the example above http://jsfiddle.net/x5VRq/1/ but when I try on my ogg file which is about 30 seconds in length, the "ended" event doesn't fire.  I tested this by plugging in my ogg file to the example. 

It seems to matter that using a longer ogg file causes the "ended" event not to be fired.  I also not that it didn't matter if I send the ogg file as an attachement or not when called from the server.  Another difference in my example is that the ogg file does not end with the .ogg extension. it is being streamed from the server but I'm not sure if that makes a difference.  

Have others seen this event working for larger ogg files? 

Thanks for the input.
Bill 
Nov 18, 2011
#29 downch...@gmail.com
Seems that audio.onended does not bind an event whereas  audio.addEventListener('ended', function() {}); will. I'll post back if I see any other quirks.

Mar 17, 2012
#30 uberscie...@gmail.com
I am also having this issue. I've tried using jQuery `.bind` (and live() for good measure):

$('#my_audio').bind('ended', function(){});

...as well as pure JS with the same result:

var my_audio = document.getElementById("my_audio");
my_audio.addEventListener('ended', function(){});

Firefox behaves as expected.  Currently http://mindsforge.com/chrome.html has the case in which I ran into the bug.

Sorry if this is a "+1 Me too!" -- but this bug seems old, please contact me if I can help!
Oct 13, 2012
#31 bugdroid1@chromium.org
This issue has been closed for some time. No one will pay attention to new comments.
If you are seeing this bug or have new data, please click New Issue to start a new bug.
Labels: Restrict-AddIssueComment-Commit
Mar 10, 2013
#32 bugdroid1@chromium.org
(No comment was entered for this change.)
Labels: -Mstone-5 -Feature-Media -Area-WebKit Cr-Content Cr-Internals-Media M-5
Mar 13, 2013
#33 bugdroid1@chromium.org
(No comment was entered for this change.)
Labels: -Restrict-AddIssueComment-Commit Restrict-AddIssueComment-EditIssue
Apr 5, 2013
#34 bugdroid1@chromium.org
(No comment was entered for this change.)
Labels: -Cr-Content Cr-Blink
Sign in to add a comment

Powered by Google Project Hosting