Files
teams-whisper/app/ext/mic.js
T

7 lines
480 B
JavaScript

// Run in mic.html (a normal tab): asks for mic permission once so offscreen.js can use it later without a prompt.
navigator.mediaDevices.getUserMedia({ audio: true })
// Stop the probe tracks at once: only the permission grant was needed, not the audio.
.then(s => { s.getTracks().forEach(t => t.stop()); document.body.append(" granted."); })
// Show the outcome in the page (the error text if the user denied or the call failed).
.catch(e => document.body.append(" " + e));