Created
November 19, 2024 22:09
-
-
Save hubgit/39b14fe937df0747748559ac5afcef82 to your computer and use it in GitHub Desktop.
Record video + audio from a browser tab/window/screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const media = await navigator.mediaDevices.getDisplayMedia({ | |
audio: { | |
echoCancellation: false, | |
autoGainControl: false, | |
noiseSuppression: false, | |
}, | |
}) | |
const recorder = new MediaRecorder(media, { | |
mimeType: 'video/webm', | |
}) | |
recorder.ondataavailable = (event) => { | |
event.data.stream().pipeTo(writableStream) | |
} | |
recorder.start() | |
const fileHandle = await window.showSaveFilePicker({ | |
startIn: 'desktop', | |
suggestedName: 'output.webm', | |
}) | |
const writableStream = await fileHandle.createWritable() | |
// recorder.requestData() | |
// recorder.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment