Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async plugLineIn() {
try {
if (!this.lineInSource) {
const mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: false,
autoGainControl: false,
noiseSuppression: false,
latency: 0
}
});
this.lineInSource = new MediaStreamAudioSourceNode(this.context, {
mediaStream
});
this.connectInOrder();
}
} catch (err) {
console.error(err);
}
if (this.context.state === 'suspended') {
await this.context.resume();
}
}