1
0
Fork 0
firefox/dom/media/webrtc/tests/mochitests/test_enumerateDevices_iframe.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

28 lines
711 B
HTML

<!DOCTYPE HTML>
<html>
<body>
<pre id="test">
<script type="application/javascript">
/**
Runs inside iframe in test_enumerateDevices.html.
*/
const pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
const gUM = c => navigator.mediaDevices.getUserMedia(c);
(async () => {
await pushPrefs(["media.navigator.streams.fake", true]);
// Validate enumerated devices after gUM.
for (const track of (await gUM({video: true, audio: true})).getTracks()) {
track.stop();
}
const devices = await navigator.mediaDevices.enumerateDevices();
parent.postMessage(JSON.stringify(devices), "https://example.com:443");
})().catch(e => setTimeout(() => { throw e; }));
</script>
</pre>
</body>
</html>