diff --git a/src/plugins/envelope.ts b/src/plugins/envelope.ts index d41e475f7..2070af38c 100644 --- a/src/plugins/envelope.ts +++ b/src/plugins/envelope.ts @@ -21,7 +21,6 @@ export type EnvelopePluginOptions = { dragPointSize?: number dragPointFill?: string dragPointStroke?: string - audioContext?: AudioContext } const defaultOptions = { @@ -253,8 +252,6 @@ class EnvelopePlugin extends BasePlugin | null = null - private ac: AudioContext | null = null - private gain: GainNode['gain'] | null = null private volume = 1 /** @@ -326,9 +323,6 @@ class EnvelopePlugin extends BasePlugin { this.onTimeUpdate(time) }), - - this.wavesurfer.on('play', () => { - if (this.ac?.state === 'suspended') { - this.ac.resume() - } - }), ) } - private initAudioContext(mediaElement: HTMLMediaElement) { - const ac = this.options.audioContext || new AudioContext() - const gainNode = ac.createGain() - gainNode.gain.value = this.options.volume ?? 1 - gainNode.connect(ac.destination) - - // Create a media element source - const source = ac.createMediaElementSource(mediaElement) - source.connect(gainNode) - - this.ac = ac - this.gain = gainNode.gain - } - private emitPoints() { if (this.throttleTimeout) { clearTimeout(this.throttleTimeout)