summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/mediacapture-streams/message-enumerateddevices.js
blob: 4541636b4b1e579694129d11bd48e814bbe47d58 (plain)
1
2
3
4
5
6
7
8
onmessage = async e => {
  const stream = await navigator.mediaDevices.getUserMedia({audio: true, video: true});
  stream.getTracks().forEach(t => t.stop());
  const devices = await navigator.mediaDevices.enumerateDevices();
  e.source.postMessage({
    devices: devices.map(d => d.toJSON())
  }, '*');
}