Bug 237523 - WebRTC / HTMLMediaElement - calling getDisplayMedia "unmutes" getUserMedia stream on muted video element
Summary: WebRTC / HTMLMediaElement - calling getDisplayMedia "unmutes" getUserMedia st...
Status: RESOLVED DUPLICATE of bug 235544
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 15
Hardware: Mac (Intel) macOS 12
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-07 04:36 PST by Anders Johan Dalshov
Modified: 2022-03-07 05:29 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Johan Dalshov 2022-03-07 04:36:56 PST
The sample code below starts a local stream with getUserMedia and adds the stream to a muted video element (muted prop set on user video element to prevent audio feedback), audio is muted as expected, but after calling getDisplayMedia (allowing the request), the video element with the user media stream will unmute and cause audio feedback. It's not even needed to add the display media stream to the other video element, calling getDisplayMedia alone is sufficient.

Note that document.getElementById("user").muted will still return true even if audio feedback is clearly present. 

Tested with:

Safari Version 15.3 (17612.4.9.1.8) / macOS 12.2.1
Safari Technology Preview Release 141 (Safari 15.4, WebKit 17614.1.3.8) / macOS 12.2.1

---
<html>
<head></head>
<body>
	<button onclick="startScreenSharing()">Start screen sharing</button>
	<video id="user" playsinline autoplay muted></video>
	<video id="display" playsinline autoplay></video>
	<script>
		window.onload = function() {
			navigator.mediaDevices.getUserMedia({audio: true, video: true})
			.then((stream) => {
				document.getElementById("user").srcObject = stream;
			});
		};
		this.startScreenSharing = () => {
			navigator.mediaDevices.getDisplayMedia({video: true})
			.then((stream) => {
				document.getElementById("display").srcObject = stream;
			});
		};
	</script>
</body>
</html>
Comment 1 youenn fablet 2022-03-07 05:29:34 PST
Thanks for the report, this is probably fixed in bug 235544.

*** This bug has been marked as a duplicate of bug 235544 ***