()
| 3 | |
| 4 | // Prompt to select media stream, pass to video element, then play |
| 5 | async function selectMediaStream() { |
| 6 | try { |
| 7 | const mediaStream = await navigator.mediaDevices.getDisplayMedia(); |
| 8 | videoElement.srcObject = mediaStream; |
| 9 | videoElement.onloadedmetadata = () => { |
| 10 | videoElement.play(); |
| 11 | }; |
| 12 | } catch (error) { |
| 13 | // Catch Error Here |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | button.addEventListener('click', async () => { |
| 18 | // Disable Button |