![]() Omit the property or set it to 2 to record 2 channel sound. We’re passing numChannels:1 to force mono sound. The actual recording process is triggered by rec.record(). StartRecording() launches the promise based getUserMedia() and on success it passes the audio stream to an AudioContext which is then passed to our Recorder.js object. The code is then split between 4 important functions: PauseButton.addEventListener("click", pauseRecording) StopButton.addEventListener("click", stopRecording) RecordButton.addEventListener("click", startRecording) Var pauseButton = document.getElementById("pauseButton") Var stopButton = document.getElementById("stopButton") Var recordButton = document.getElementById("recordButton") Var AudioContext = window.AudioContext || window.webkitAudioContext shim for AudioContext when it's not avb. MediaStreamAudioSourceNode we'll be recording Moving on to app.js we start by setting up a few variables, shims, getting references to our UI elements and adding event listeners: //webkitURL is deprecated but nevertheless Simple Recorder.js demo with record, stop and pause Our index.html file is pretty straightforward:
0 Comments
Leave a Reply. |