src/AudioRecorder.js
function beginAudioCapture() {

        // Attempt to retrieve an audio input stream from the browser
        navigator.mediaDevices.getUserMedia({ 'audio' : true }, function streamReceived(stream) {

            // Create processing node which receives appropriately-sized audio buffers
            processor = context.createScriptProcessor(BUFFER_SIZE, format.channels, format.channels);
            processor.connect(context.destination);

            // Send blobs when audio buffers are received
            processor.onaudioprocess = function processAudio(e) {
                writer.sendData(toSampleArray(e.inputBuffer).buffer);
            };

            // Connect processing node to user's audio input source
            source = context.createMediaStreamSource(stream);
            source.connect(processor);

            // Save stream for later cleanup
            mediaStream = stream;

        }, function streamDenied() {

            // Simply end stream if audio access is not allowed
            writer.sendEnd();

            // Notify of closure
            if (recorder.onerror)
                recorder.onerror();

        });

    }
function beginAudioCapture() {

        // Attempt to retrieve an audio input stream from the browser
        navigator.mediaDevices.getUserMedia({ 'audio' : true }, function streamReceived(stream) {

            // Create processing node which receives appropriately-sized audio buffers
            processor = context.createScriptProcessor(BUFFER_SIZE, format.channels, format.channels);
            processor.connect(context.destination);

            // Send blobs when audio buffers are received
            processor.onaudioprocess = function processAudio(e) {
                writer.sendData(toSampleArray(e.inputBuffer).buffer);
            };

            // Connect processing node to user's audio input source
            source = context.createMediaStreamSource(stream);
            source.connect(processor);

            // Save stream for later cleanup
            mediaStream = stream;

        }, function streamDenied() {

            // Simply end stream if audio access is not allowed
            writer.sendEnd();

            // Notify of closure
            if (recorder.onerror)
                recorder.onerror();

        });

    }
function beginAudioCapture ( ) { // Attempt to retrieve an audio input stream from the browser navigator . mediaDevices . getUserMedia ( { 'audio' : true } , function streamReceived ( stream ) { // Create processing node which receives appropriately-sized audio buffers processor = context . createScriptProcessor ( BUFFER_SIZE , format . channels , format . channels ) ; processor . connect ( context . destination ) ; // Send blobs when audio buffers are received processor . onaudioprocess = function processAudio ( e ) { writer . sendData ( toSampleArray ( e . inputBuffer ) . buffer ) ; } ; // Connect processing node to user's audio input source source = context . createMediaStreamSource ( stream ) ; source . connect ( processor ) ; // Save stream for later cleanup mediaStream = stream ; } , function streamDenied ( ) { // Simply end stream if audio access is not allowed writer . sendEnd ( ) ; // Notify of closure if ( recorder . onerror ) recorder . onerror ( ) ; } ) ; }
Requests access to the user's microphone and begins capturing audio. All
received audio data is resampled as necessary and forwarded to the
Guacamole stream underlying this Guacamole.RawAudioRecorder. This
function must be invoked ONLY ONCE per instance of
Guacamole.RawAudioRecorder.

@private
Requests access to the user s microphone and begins capturing audio . All received audio data is resampled as necessary and forwarded to the Guacamole stream underlying this Guacamole . RawAudioRecorder . This function must be invoked ONLY ONCE per instance of Guacamole . RawAudioRecorder .