src/webaudio.js
/**
     * This is called when wavesurfer is destroyed
     */
This is called when wavesurfer is destroyed
This is called when wavesurfer is destroyed
destroy() {
        if (!this.isPaused()) {
            this.pause();
        }
        this.unAll();
        this.buffer = null;
        this.disconnectFilters();
        this.disconnectSource();
        this.gainNode.disconnect();
        this.scriptNode.disconnect();
        this.analyser.disconnect();
        if (this.params.closeAudioContext) {
            if (
                typeof this.ac.close === 'function' &&
                this.ac.state != 'closed'
            ) {
                this.ac.close();
            }
            this.ac = null;
            if (!this.params.audioContext) {
                window.WaveSurferAudioContext = null;
            } else {
                this.params.audioContext = null;
            }
            window.WaveSurferOfflineAudioContext = null;
        }
    }
destroy ( ) { if ( ! this . isPaused ( ) ) { this . pause ( ) ; } this . unAll ( ) ; this . buffer = null ; this . disconnectFilters ( ) ; this . disconnectSource ( ) ; this . gainNode . disconnect ( ) ; this . scriptNode . disconnect ( ) ; this . analyser . disconnect ( ) ; if ( this . params . closeAudioContext ) { if ( typeof this . ac . close === 'function' && this . ac . state != 'closed' ) { this . ac . close ( ) ; } this . ac = null ; if ( ! this . params . audioContext ) { window . WaveSurferAudioContext = null ; } else { this . params . audioContext = null ; } window . WaveSurferOfflineAudioContext = null ; } }
This is called when wavesurfer is destroyed
This is called when wavesurfer is destroyed
// close the audioContext if closeAudioContext option is set to true // check if browser supports AudioContext.close() // clear the reference to the audiocontext // clear the actual audiocontext, either passed as param or the // global singleton // clear the offlineAudioContext