[Webkit-unassigned] [Bug 179964] Camera/microphone acquisition false positive after receiving phone call

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 20 09:46:00 PST 2017


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

--- Comment #5 from youenn fablet <youennf at gmail.com> ---
(In reply to daginge from comment #4)
> Based on what I've been observing, it seems like the following is happening
> here:
> 
> 1. On the initial getUserMedia call, you will get a reference to audio and
> video resources (only one process may have this at any point in time).
> 2. On subsequent getUserMedia calls, the reference to the media resource is
> re-used.

Only one media stream at a time can grab camera or microphone.
If you do a getUserMedia in a page and get a stream, it will work.
If you do another getUserMedia (on the page or another page), the first stream will get muted.
The second stream should be fine.

> 3. If another process steals the resource (audio and/or video), the
> reference that Safari has will fail, and would have to be requested again.
> However, this is never checked by Safari, and it simply returns with the
> reference which now does not have access anymore to read from the resource.

If so, that is a bug.
The newest getUserMedia should succeed and will mute the initial tab.
If this is done on different pages, you should be able to switch between the streams using Safari UI (camera icons).
It is working consistently on MacOS. Doing some testing in recent iOS builds, we might have some bugs there.

> 4. Subsequent getUserMedia calls will not fix this, as it will detect the
> old reference and think it has permission to read from the media resource.

If you keep all tabs opened it should work.
It seems there is a bug when one capturing tab is closing and another is starting at the same time.

> I suspect that closing the tab and trying again will make it work, as it
> seems from my tests that the permissions are granted on a per-tab basis,
> instead of for all of Safari. This will also explain why requesting media
> from a new tab on iOS will break capturing of media in the old tab (and make
> that tab never work with getUserMedia again).
> 
> I do not know of a workaround from JavaScript to fix this unfortunately.
> Perhaps youenn has some details?

There is no perfect workaround right now.
It seems the only possibility is to:
- open a new tab
- close all the tabs that are capturing/trying to capture.
- wait a little bit to capture in the new tab.
This should hopefully work as the previously closed tabs will do their cleanup and tear down the capture devices.
Then the new tab will do a fresh start without any issue.
That may be doable if your web site is the only one capturing at any given time.

This is a bad bug and we should try to fix it asap.

-- 
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/20171220/8c2ee715/attachment.html>


More information about the webkit-unassigned mailing list