text: /*! wavesurfer.js 1.0.28
  * https://github.com/katspaugh/wavesurfer.js
  * @license CC-BY 3.0 */!function(a,b){"function"==typeof define&&define.amd?define(["wavesurfer"],b):a.WaveSurfer.Microphone=b(a.WaveSurfer)}(this,function(a){"use strict";return a.Microphone={init:function(a){this.params=a;this.wavesurfer=a.wavesurfer;if(!this.wavesurfer)throw new Error("No WaveSurfer instance provided");this.active=!1,this.paused=!1,this.getUserMedia=(navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia).bind(navigator),this.bufferSize=this.params.bufferSize||4096,this.numberOfInputChannels=this.params.numberOfInputChannels||1,this.numberOfOutputChannels=this.params.numberOfOutputChannels||1,this.micContext=this.wavesurfer.backend.getAudioContext()},start:function(){this.getUserMedia({video:!1,audio:!0},this.gotStream.bind(this),this.deviceError.bind(this))},togglePlay:function(){this.active?(this.paused=!this.paused,this.paused?this.disconnect():this.connect()):this.start()},stop:function(){this.active&&(this.active=!1,this.stream&&this.stream.stop(),this.disconnect(),this.wavesurfer.empty())},connect:function(){void 0!==this.stream&&(this.mediaStreamSource=this.micContext.createMediaStreamSource(this.stream),this.levelChecker=this.micContext.createScriptProcessor(this.bufferSize,this.numberOfInputChannels,this.numberOfOutputChannels),this.mediaStreamSource.connect(this.levelChecker),this.levelChecker.connect(this.micContext.destination),this.levelChecker.onaudioprocess=this.reloadBuffer.bind(this))},disconnect:function(){void 0!==this.mediaStreamSource&&this.mediaStreamSource.disconnect(),void 0!==this.levelChecker&&this.levelChecker.disconnect()},reloadBuffer:function(a){this.paused||(this.wavesurfer.empty(),this.wavesurfer.loadDecodedBuffer(a.inputBuffer))},gotStream:function(a){this.stream=a,this.active=!0,this.connect(),this.fireEvent("deviceReady",a)},destroy:function(){this.stop()},deviceError:function(a){this.fireEvent("deviceError",a)}},a.util.extend(a.Microphone,a.Observer),a.Microphone});