blob: 2b3295bc20cde83a14683f258fdcb810c0b39a3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<!DOCTYPE html>
<title>Display-capture request delegation test: subframe</title>
<script>
function reportResult(msg) {
window.top.postMessage({"type": "result", "result": msg}, "*");
}
window.addEventListener("message", async e => {
if (e.data.type == "make-display-capture-request") {
try {
const stream = await navigator.mediaDevices.getDisplayMedia();
stream.getTracks()[0].stop();
reportResult("success");
} catch(e) {
reportResult("failure");
}
}
});
window.top.postMessage({"type": "subframe-loaded"}, "*");
</script>
|