devicechange event mustn't be kept from tab in focus (or later receiving focus)
Categories
(Core :: WebRTC: Audio/Video, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox57 | --- | affected |
People
(Reporter: jib, Unassigned)
References
Details
The spec [1] requires us to always fire the devicechange event on tabs where: • permission is "granted", • any of the input devices are attached to an active MediaStream in the browsing context, or • the active document is fully active and has focus. Our current implementation is too conservative, only firing on the first two categories. [1] https://w3c.github.io/mediacapture-main/getusermedia.html#mediadevices
Reporter | ||
Updated•7 years ago
|
Comment 2•7 years ago
|
||
Mass change P2->P3 to align with new Mozilla triage process.
Comment 6•4 years ago
|
||
(In reply to Jan-Ivar Bruaroey [:jib] (needinfo? me) from comment #0)
The spec [1] requires us to always fire the devicechange event on tabs where:
• permission is "granted",
• any of the input devices are attached to an active MediaStream in the
browsing context, or
• the active document is fully active and has focus.Our current implementation is too conservative, only firing on the first two
categories.[1] https://w3c.github.io/mediacapture-main/getusermedia.html#mediadevices
At Firefox 77.0.1 (32-bit) ondevicechange
is fired when the active document does not have focus.
Is this already fixed?
Note, the jsfiddle link https://fiddle.jshell.net/jib1/LbtxeLvw/show at https://stackoverflow.com/a/62161568 is 404.
Comment 7•4 years ago
|
||
Cannot reproduce the issue described at https://stackoverflow.com/questions/62154061/firefox-32-bit-does-not-fire-ondevicechange-event at 32 -bit Linux.
Perhaps OP needs to post a minimal, complete, verifiable example.
Comment 8•4 years ago
|
||
Observed this bug today on Unity content when running on Windows 10 and Firefox 81, the following code does not work in Firefox, but works on Chrome:
<html>
<body>
<script>
function test() {
console.log('starting media enumeration');
var t0 = performance.now();
navigator.mediaDevices.enumerateDevices().then(function(devices) {
console.log('finished media enumeration, took ' + (performance.now() - t0));
devices.forEach(function(device) {
console.log(device);
});
});
}
test();
navigator.mediaDevices.ondevicechange = function(event) { // Fires in Chrome, not in Firefox
console.log('ondevicechange');
test();
}
navigator.mediaDevices.addEventListener('devicechange', function(event) { // Fires in Chrome, not in Firefox
console.log('devicechange');
test();
});
</script>
</body>
</html>
Open e.g. just via file:// .
Comment 9•4 years ago
•
|
||
Considering shipping the following polling workaround in Unity, not sure of the performance implications:
// Work around Firefox bug on Windows:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1397977, devicechange
// events do not fire, so resort to polling for device changes once every
// 60 seconds.
if (/Firefox/.test(navigator.userAgent)) {
setInterval(test, 60000);
}
Maybe this will cause stuttering on Unity content on Windows, but cannot think of any other way to resolve.
Comment 10•4 years ago
|
||
#8 devicechange
is fired at Firefox 81 and Nightly 83 (Linux, 64-bit) when USB camera plus microphone device is connected to machine when media.navigator.permission.disabled
is set to true
at about:config
.
Comment 11•4 years ago
|
||
#8 Note, at Chromium 88 label
of devices is always empty string ""
at enumerateDevices()
at file:
protocol when running the provided HTML, including after calling navigator.mediaDevices.getUserMedia({video: true})
granting permissions for the page.
Updated•2 years ago
|
Description
•