- From: guest271314 via GitHub <sysbot+gh@w3.org>
- Date: Thu, 25 Jun 2020 14:49:47 +0000
- To: public-webrtc@w3.org
guest271314 has just created a new issue for https://github.com/w3c/mediacapture-screen-share:
== mute and unmute events of MediaStreamTrack should not be fired based on user non-action ==
The specification uses the term "user activation" exactly once
> When the getDisplayMedia() method is called, the User Agent MUST run the following steps:
>
> If the method call is not triggered by user activation, return a promise rejected with a DOMException object whose name attribute has the value InvalidStateError.
The terms "user action" and "user gesture" are not included in the language of the specification.
Chromium 85 appears to fire `mute` and `unmute` events on `MediaStreamTrack` from `getDisplayMedia()` directly corresponding to user non-action, for example, not moving the cursor on the captured screen, or user action, moving the cursor on the captured screen.
```
onclick = async e => {
var input,
recorder,
audioTrack,
videoTrack,
stream,
mediaStream,
chunks = [];
onclick = null;
stream = await navigator.mediaDevices.getDisplayMedia({ video: true });
[videoTrack] = stream.getVideoTracks();
videoTrack.onended = videoTrack.onmuted = e => console.log(e);
await videoTrack.applyConstraints({
resizeMode: 'none',
cursor: 'never',
width: window.innerWidth * 0.7,
height: window.innerHeight,
});
video = document.createElement('video');
video.currentTime = 0;
video.autoplay = true;
videoTrack.onunmute = videoTrack.onmute = e => console.log(e);
video.ontimeupdate = _ => {
console.log(video.currentTime, 60 * 7 + 60 * 0.5);
if (video.currentTime > 60 * 7 + 60 * 0.5) {
recorder.stop();
videoTrack.stop();
}
};
video.onplay = _ => {
recorder = new MediaRecorder(stream);
recorder.start(0);
recorder.onstop = async e => {
console.log(
URL.createObjectURL(new Blob(chunks, { type: 'video/webm' }))
);
};
recorder.ondataavailable = e => {
if (e.data.size > 0) chunks.push(e.data);
};
};
video.srcObject = stream;
};
```
The result is a series of unintended consequences impacting other API's, including media file produced by `MediaRecorder`, `timeupdate` event of `HTMLMediaElement` not firing every 50 to 250ms per HTML Standard. The resulting bugs that have observed so far downstream https://bugs.chromium.org/p/chromium/issues/detail?id=1099280.
Kindly include language in the specification which prohibits implementations from firing `mute` and `unmute` events based on user non-action or user action.
Please view or discuss this issue at https://github.com/w3c/mediacapture-screen-share/issues/141 using your GitHub account
Received on Thursday, 25 June 2020 14:49:50 UTC