src/AudioContextFactory.js
function getAudioContext() {

        // Fallback to Webkit-specific AudioContext implementation
        var AudioContext = window.AudioContext || window.webkitAudioContext;

        // Get new AudioContext instance if Web Audio API is supported
        if (AudioContext) {
            try {

                // Create new instance if none yet exists
                if (!Guacamole.AudioContextFactory.singleton)
                    Guacamole.AudioContextFactory.singleton = new AudioContext();

                // Return singleton instance
                return Guacamole.AudioContextFactory.singleton;

            }
            catch (e) {
                // Do not use Web Audio API if not allowed by browser
            }
        }

        // Web Audio API not supported
        return null;

    }
function getAudioContext() {

        // Fallback to Webkit-specific AudioContext implementation
        var AudioContext = window.AudioContext || window.webkitAudioContext;

        // Get new AudioContext instance if Web Audio API is supported
        if (AudioContext) {
            try {

                // Create new instance if none yet exists
                if (!Guacamole.AudioContextFactory.singleton)
                    Guacamole.AudioContextFactory.singleton = new AudioContext();

                // Return singleton instance
                return Guacamole.AudioContextFactory.singleton;

            }
            catch (e) {
                // Do not use Web Audio API if not allowed by browser
            }
        }

        // Web Audio API not supported
        return null;

    }
function getAudioContext ( ) { // Fallback to Webkit-specific AudioContext implementation var AudioContext = window . AudioContext || window . webkitAudioContext ; // Get new AudioContext instance if Web Audio API is supported if ( AudioContext ) { try { // Create new instance if none yet exists if ( ! Guacamole . AudioContextFactory . singleton ) Guacamole . AudioContextFactory . singleton = new AudioContext ( ) ; // Return singleton instance return Guacamole . AudioContextFactory . singleton ; } catch ( e ) { // Do not use Web Audio API if not allowed by browser } } // Web Audio API not supported return null ; }
Returns a singleton instance of a Web Audio API AudioContext object.

@return {AudioContext}
A singleton instance of a Web Audio API AudioContext object, or null
if the Web Audio API is not supported.
Returns a singleton instance of a Web Audio API AudioContext object .