<script>
    function callGetDisplayMedia(options)
    {
        let promise;
        window.internals.withUserGesture(() => {
            promise = navigator.mediaDevices.getDisplayMedia(options);
        });
        return promise;
    }

    async function enumerate(event)
    {
        let result;
        await callGetDisplayMedia({video: true})
            .then((s) => result = "allow")
            .catch((e) => result = "deny");
        parent.postMessage(`${event.data}:${result}`, '*');
        result.innerHTML = result;
    }

    window.addEventListener("message", (id) => enumerate(id));
</script>

<div id='result'></div>


