OAVp5.mic.start()#
functionoav-p5OAVp5.mic.start()
Turns the microphone on and returns a promise that says whether it worked: the same as startMic().
startMic() is this function: see it for what must happen first (a click, https or localhost). OAVp5.mic.start() also lifts the "stopped by you" mark that stopMic() leaves, which is what lets a later read of micLevel switch the microphone on again.
Returns
Promise<Boolean> Resolves to true once the microphone is on, false if it was blocked, is missing, or the mic option is off.
Examples
function setup() {
createCanvas(400, 300);
}
function mousePressed() {
OAVp5.mic.start().then((ok) => console.log(ok ? 'microphone on' : 'no microphone'));
}
function draw() {
background(20);
fill(255);
text(OAVp5.mic.state === 'on' ? 'listening' : 'click the canvas to start the microphone', 20, 30);
}Related
startMic()Turns the microphone on and returns a promise that says whether it worked.OAVp5.mic.stop()Turns the microphone off and sets every microphone value back to 0: the same asstopMic().OAVp5.mic.stateWhere the microphone is:'off','asking','on','denied'or'unavailable'.micWho may turn the microphone on:auto(the first read ofmicLeveland friends),click(only 🎤 orstartMic()) oroff(nobody).