getDisplayMedia does not work when firefox is full screen on macOS
Categories
(Core :: WebRTC: Audio/Video, defect, P2)
Tracking
()
People
(Reporter: matt.watson, Assigned: haik)
References
(Regression)
Details
(Keywords: enterprise, regression)
Attachments
(1 file)
|
47 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details | Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36
Steps to reproduce:
In MacOS 10.15.4 make Firefox full screen (clicking on the green icon in the header).
Open the dev tools and paste the following code:
navigator.mediaDevices.getDisplayMedia({ audio: true, video: true})
.then(function(stream) {
console.log(stream)
})
.catch(function(err) {
console.log(err)
});
In the firefox window select the window to share and click Allow
Back in the dev console there is an MediaStreamError name: "NotFoundError"
Actual results:
Firefox raised a MediaStreamError Name: NotFoundError
Expected results:
Should have allowed the window to be shared
Comment 1•5 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Comment 2•5 years ago
|
||
Does this work if the window is not in fullscreen? I couldn't get this to work on my side.
Updated•5 years ago
|
| Reporter | ||
Comment 3•5 years ago
|
||
I think you have to grant Firefox some permissions to do the screensharing to make it work at all, but yes this does work for me not in fullscreen. The expected result in the javascript console is it should return a MediaStream object.
To grant Firefox the appropriate permissions I went to System Preferences -> Security & Privacy -> Find Screen Recording in the left list -> Make sure Firefox is enabled for screen recording.
I think this is only relevant on Catalina, but I'm not 100%
Comment 4•5 years ago
|
||
Sending over to WebRTC to see if this is a legitimate and/or known issue.
Comment 5•5 years ago
|
||
STRs:
- Open https://jan-ivar.github.io/dummy/gdm.html, click button, in the prompt, select the window to share and click Allow
Workaround:
- Set
media.macos.screenrecording.oscheck.enabledtofalsein about:config
Regression range:
23:39.32 INFO: Narrowed inbound regression window from [77e54e76, 86d3343d] (3 builds) to [77e54e76, a2e0699b] (2 builds) (~1 steps left)
23:39.32 INFO: No more inbound revisions, bisection finished.
23:39.32 INFO: Last good revision: 77e54e76848ab510bb0a20e375e8692b0f21e5d8
23:39.32 INFO: First bad revision: a2e0699b6cb88cd88f1b0be00be031449a2d62fd
23:39.32 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=77e54e76848ab510bb0a20e375e8692b0f21e5d8&tochange=a2e0699b6cb88cd88f1b0be00be031449a2d62fd
Haik, this looks like the window name check we added in bug 1612006 breaks fullscreen. Is there a way we can detect the firefox window is fullscreen and bypass this oscheck?
Updated•5 years ago
|
| Assignee | ||
Comment 7•5 years ago
•
|
||
@jib, when the browser is full screen, is it expected for the window sharing list to only include the current window and a fullscreen option?
Comment 8•5 years ago
•
|
||
I imagine it's a limitation of the OS, since the comment 5 fiddle yields the same result in Chrome in fullscreen (Safari has no picker, always offering entire desktop only, so we don't learn much there).
| Assignee | ||
Comment 9•5 years ago
•
|
||
When running in full screen, our check in Mac platform code nsCocoaUtils::GetScreenCapturePermissionState() always returns false causing the checkOSPermission() call in WebRTCParent.jsm to always return false making Firefox act as if it does not have OS permission to record the screen.
The bug is that the window list used in the nsCocoaUtils::GetScreenCapturePermissionState() heuristic is kCGWindowListOptionOnScreenOnly instead of kCGWindowListOptionAll. Apologies for the oversight. This case never occurred to me when implementing the heuristic.
With kCGWindowListOptionOnScreenOnly, when the browser is in full screen mode, the window list returned from CGWindowListCopyWindowInfo() does not include windows necessary for the heuristic to work. A small subset of windows is included (6 in my testing on 10.15.4) and none of window layers match CGWindowLevelForKey(kCGDockWindowLevelKey), CGWindowLevelForKey(kCGNormalWindowLevelKey), or any documented key.
The fix will be to change the code to use kCGWindowListOptionAll.
Updated•5 years ago
|
| Assignee | ||
Comment 10•5 years ago
|
||
Change the GetScreenCapturePermissionState() heuristic to use the full window list instead of just on-screen windows to allow it it to work in full screen mode.
Comment 11•5 years ago
|
||
Comment 12•5 years ago
|
||
| bugherder | ||
| Assignee | ||
Comment 13•5 years ago
|
||
@Matt, thanks for the report. This is now fixed in the latest Nightly build. Are you able to use Firefox Nightly to confirm that the problem is now fixed for you?
Comment 14•5 years ago
|
||
I can confirm that this works fine on Firefox Nightly! Thanks!!!
| Reporter | ||
Comment 15•5 years ago
|
||
This works for me on nightly. Thanks!
Updated•5 years ago
|
| Assignee | ||
Comment 16•5 years ago
|
||
Thank you both for verifying.
| Assignee | ||
Comment 17•5 years ago
•
|
||
Comment on attachment 9140561 [details]
Bug 1627414 - getDisplayMedia does not work when firefox is full screen on macOS r?spohl!
Beta/Release Uplift Approval Request
- User impact if declined: On macOS Catalina 10.15+, when the browser is in full screen mode, attempts to start screen sharing on a site like talky.io will fail. When in full screen mode, the MediaDevices.getUserMedia() API returns an error (NotFoundError: "The object can not be found here") indicating screen recording is not available.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: Yes
- If yes, steps to reproduce:
- Reset screen recording permissions by running the following command from the Terminal.app (in /Applications/Utilities). This will reset which applications have screen recording permissions in macOS -> System Preferences -> Security & Privacy -> Screen Recording.
tccutil reset ScreenCapture
-
Launch the browser and enter full screen mode by clicking the green button in the top left corner of the window as described here https://support.apple.com/guide/mac-help/use-apps-in-full-screen-mchl9c21d2be/mac
-
Use a site such as :jib's test page (https://jan-ivar.github.io/dummy/gdm.html) or talky.io to share the full screen. The first time this is attempted, a macOS dialog will display instructing you to go to System Preferences and allow Firefox to record the screen described here https://support.apple.com/guide/mac-help/control-access-to-screen-recording-on-mac-mchld6aa7d23/mac
-
Still in full screen mode, reload the page, and attempt to share the full screen. Without the fix, sharing in full screen mode fails. If the application is not in full screen mode, sharing full screen should work.
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): The change is small, limited to macOS, and only affects WebRTC screen sharing/recording. However, the change does affect WebRTC screen sharing which is a critical feature at this time.
- String changes made/needed:
| Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 18•5 years ago
|
||
Comment on attachment 9140561 [details]
Bug 1627414 - getDisplayMedia does not work when firefox is full screen on macOS r?spohl!
Fixes broken WebRTC screensharing when in fullscreen mode on macOS 10.15+. Approved for 76.0b6.
Comment 19•5 years ago
|
||
| bugherder uplift | ||
Updated•5 years ago
|
Comment 20•5 years ago
|
||
Reproduced it on Firefox 75 (20200403170909)
Verified fixed on Firefox 76.0b6 (20200420031429)
Updated•10 months ago
|
Description
•