[Webkit-unassigned] [Bug 173332] New: HTML5 audio .ended event not fired when app in background or phone screen is off

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 13 14:48:26 PDT 2017


            Bug ID: 173332
           Summary: HTML5 audio .ended event not fired when app in
                    background or phone screen is off
           Product: WebKit
           Version: Safari 10
          Hardware: iPhone / iPad
                OS: iOS 10
            Status: NEW
          Severity: Major
          Priority: P2
         Component: Media Elements
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: judahgabriel at gmail.com

When HTML5 audio finishes playing, the .ended event doesn't fire if the web app is running in the background or if the screen is off. 

Here's a simple page that demonstrates the problem: http://bitshuvafiles01.com/iOSAudioBugRepro/audioError.html

Steps to reproduce: 

1. Create web page with a single <audio> element.
2. In JavaScript, set audio.src = "song1.mp3", and .play();
3. Add an .ended event handler to the audio element. In the .ended event handler, set audio.src = "song2.mp3", and .play().
4. While song1.mp3 is playing, turn off the phone screen.
5. Wait for the audio to finish. When it finishes, audio will stop; song2.mp3 will never.

Expected results: The audio.ended event fires and the next song starts playing.

Actual results: The audio.ended event never fires because the screen is off or because Safari is in the background; JS execution is suspended.

Additional info: While suspending JS execution is wise for battery life reasons, it harms the user experience when listening to audio on the web. Either don't suspend JS execution for tabs playing audio, or at least fire the .ended event so we can play the next song.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170613/d30978b9/attachment.html>

More information about the webkit-unassigned mailing list