...
recordAudio.stopRecording(function() {
        if (isFirefox) onStopRecording(true);
    });

    if (!isFirefox) {
        recordVideo.stopRecording();
        onStopRecording(false);
    }

function onStopRecording(onlyAudio) {
        recordAudio.getDataURL(function(audioDataURL) { // recordAudio variables saves the recorder state that is running
            if (!onlyAudio) {                           // and is responsible for providing the recorded information.
                recordVideo.getDataURL(function(videoDataURL) {
                    captureStreams(audioDataURL, videoDataURL); // CaptureStreams takes these 2 binary objects and creates a JSON
                });
            } else captureStreams(audioDataURL); // It can also use a single stream as its input
        });
    }