Created
October 17, 2019 16:29
-
-
Save chicken-suop/47c8d98c9269a2587650a49b6cc1fa95 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 timeout = 1000; | |
this.stream = await navigator.mediaDevices.getUserMedia({ audio: true }); | |
const recorder = new MediaRecorder(this.stream); | |
recorder.addEventListener('dataavailable', ({ data }) => this.upload(data)); | |
recorder.addEventListener('stop', () => { | |
recorder.start(); | |
setTimeout(() => recorder.stop(), timeout); | |
}); | |
recorder.start(); | |
setTimeout(() => recorder.stop(), timeout); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment