[Webkit-unassigned] [Bug 197688] New: Safari resumes autoplay audio elements after getUserMedia

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 8 01:24:52 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=197688

            Bug ID: 197688
           Summary: Safari resumes autoplay audio elements after
                    getUserMedia
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Macintosh
                OS: macOS 10.14
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Media
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: szymon.witamborski at bibo.com.ph

Audio elements that have autoplay attribute start playing after getUserMedia resolves.

Steps to reproduce:

1. have an <audio src="..." loop autoplay> element in the document
   - loop is optional but helps to demonstrate the issue, it could be just a long audio file instead
2. start playback by either:
   - setting "Allow All Auto-Play" for the site
   - starting playback manually
3. stop playback by either:
   - calling pause() method on the play element
   - removing the audio element from DOM
4. request access to the microphone via getUserMedia({ audio: true })

After getUserMedia resolves successfully, the audio element starts playing again, even emits "play" event, even if the element is not in the DOM any more.

I found out that removing the autoplay attribute from the element before calling getUserMedia works around it.

Here's a codepen that demonstrates the issue with the "remove from DOM" approach but it's the same when calling pause() method instead:

https://codepen.io/brainshave/pen/LoVaRj

I'm guessing this is related to Safari lifting up constraints on autoplay after successful getUserMedia request. Resuming explicitly paused elements seems like an undesired side-effect though.

Tested on Safari 12.1 and TP 81. Tried to run Nightly but I seem to be getting a case of https://bugs.webkit.org/show_bug.cgi?id=194808

-- 
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/20190508/113dcea2/attachment-0001.html>


More information about the webkit-unassigned mailing list