[Webkit-unassigned] [Bug 238456] New: HTMLMediaElement plays MediaStream with 'muted' attribute, but plays sounds again after getUserMedia again
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Mar 28 07:50:58 PDT 2022
https://bugs.webkit.org/show_bug.cgi?id=238456
Bug ID: 238456
Summary: HTMLMediaElement plays MediaStream with 'muted'
attribute, but plays sounds again after getUserMedia
again
Product: WebKit
Version: Safari 15
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebRTC
Assignee: webkit-unassigned at lists.webkit.org
Reporter: 913007768zyw at gmail.com
CC: youennf at gmail.com
Created attachment 455918
--> https://bugs.webkit.org/attachment.cgi?id=455918&action=review
sample-test
Device:
iOS 15.4 iPhone 12
iOS 15.3.1 iphoen 13
Browser:
safari
Steps to reproduce:
1. video element with 'muted' 'playsinline' 'autoplay'
2. get MediaStream wih getUserMedia({ audio: true, video: { facingMode: 'user' } }) with front camera and play wih video element
localStream = await navigator.mediaDevices.getUserMedia({ audio: true, video: { facingMode: 'user' } });
video.srcObject = localStream;
3. get MediaStream with getUserMedia({ audio: false, video: { facingMode: 'environment' } }) with back camera and play
backCameraStream = await navigator.mediaDevices.getUserMedia({ audio: false, video: { facingMode: 'environment' } });
const originVideoTrack = localStream.getVideoTracks()[0];
localStream.removeTrack(originVideoTrack);
localStream.addTrack(backCameraStream.getVideoTracks()[0]);
Actual result: you can hear the sound
Expected result: video can't play any sound
Sample test:
https://zhangyuwei-1254112368.cos.ap-guangzhou.myqcloud.com/safari-test-muted/index.html
1. click on the first button
you can't hear any sound
2. click on the second button
you can hear the sound
The code is listed below:
```
let video = document.getElementById('localStream');
let btnA = document.getElementById('btnA');
let btnB = document.getElementById('btnB');
let localStream, backCameraStream;
btnA.addEventListener('click', async () => {
localStream = await navigator.mediaDevices.getUserMedia({ audio: true, video: { facingMode: 'user' } });
video.srcObject = localStream;
});
btnB.addEventListener('click', async () => {
backCameraStream = await navigator.mediaDevices.getUserMedia({ audio: false, video: { facingMode: 'environment' } });
const originVideoTrack = localStream.getVideoTracks()[0];
localStream.removeTrack(originVideoTrack);
localStream.addTrack(backCameraStream.getVideoTracks()[0]);
});
```
--
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/20220328/5da488ab/attachment-0001.htm>
More information about the webkit-unassigned
mailing list