blob: beea3a4f97e9bf9571c1dd782c0499e5b44dce75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<!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>
|