Skip to content

Instantly share code, notes, and snippets.

@PAEz
Created June 9, 2026 11:22
Show Gist options
  • Select an option

  • Save PAEz/7dcadb7e77fc6b61661f3c9a252c5d6b to your computer and use it in GitHub Desktop.

Select an option

Save PAEz/7dcadb7e77fc6b61661f3c9a252c5d6b to your computer and use it in GitHub Desktop.
Hijack the mic and pass in a screen/tab captures audio instead
/*
Add this to what ever and when it tries to connect with the mic it will connect with screen/tab sharing instead
and can pipe its audio into whatever instead. On linux you'll only be able to stream the audio of another tab,
but on windows you can pick screen plus audio and get the full system audio...sweet!!!!
*/
// Overwrite the browser's microphone API right on the webpage
navigator.mediaDevices.getUserMedia = async function(constraints) {
if (constraints && constraints.audio) {
console.log("Intercepted OpenProcessing mic request! Diverting to system audio...");
try {
// Prompt the user for system audio instead of the microphone
let stream = await navigator.mediaDevices.getDisplayMedia({
video: true, // Required by Chrome to trigger the prompt
audio: { systemAudio: "include" }
});
return stream;
} catch(e) {
console.error("User denied system audio sharing.", e);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment