I have successfully added a timer to the audio recorder but failed to stop when clicked on the pause button.
I am using the example mentioned below.
I have modified the HTML and JS.
HTML
<div class="audio-input-area">
<div id="controls">
<button id="recordButton">Record</button>
<button id="pauseButton" disabled>Pause</button>
<button id="stopButton" disabled>Stop</button>
</div>
<!--- Added .status-text paragraph for timer --->
<p id="status-text"></p>
<div id="recordingsList"></div>
</div>
JS
navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
................Existing code..................
.................Existing code.....................
// Added the code below for the timer
intervalId = window.setInterval(function(){
floatValue = Math.floor( audioContext.getOutputTimestamp(stream).contextTime )
statusText.innerText = secondsToHms(floatValue);
// console.log(secondsToHms(floatValue));
// console.log(audioContext.currentTime);
/// call your function here
// console.log(audioContext.getOutputTimestamp(stream))
// console.log(floatValue);
}, 1000);
..............Existing code....................
................Existing code......................
}