text: /*!
   * videojs-wavesurfer
   * @version 2.3.1
   * @see https://github.com/collab-project/videojs-wavesurfer
   * @copyright 2014-2018 Collab
   * @license MIT
   */
  !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("videojs"),require("WaveSurfer")):"function"==typeof define&&define.amd?define("VideojsWavesurfer",["videojs","WaveSurfer"],t):"object"==typeof exports?exports.VideojsWavesurfer=t(require("videojs"),require("WaveSurfer")):e.VideojsWavesurfer=t(e.videojs,e.WaveSurfer)}("undefined"!=typeof self?self:this,function(e,t){return function(e){function t(i){if(r[i])return r[i].exports;var o=r[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=r(1),u=i(l),h=r(2),p=i(h),f=r(3),c=i(f),y=r(4),d=i(y),v=r(5),g=i(v),m=r(7),b=i(m),w=r(8),_=i(w),P=b.default.getPlugin("plugin"),k=function(e){function t(e,r){o(this,t);var i=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));if(r=b.default.mergeOptions(c.default,r),i.waveReady=!1,i.waveFinished=!1,i.liveMode=!1,i.debug="true"===r.debug.toString(),i.msDisplayMax=parseFloat(r.msDisplayMax),i.player.activeWavesurferPlugin=i,void 0!==i.player.options_.plugins.wavesurfer&&i.player.addClass("videojs-wavesurfer"),"live"===r.src){if(void 0===_.default.microphone)return i.onWaveError("Could not find wavesurfer.js microphone plugin!"),s(i);i.liveMode=!0,i.waveReady=!0}return i.player.one("ready",i.initialize.bind(i)),i}return a(t,e),n(t,[{key:"initialize",value:function(){if(this.player.tech_.setActivePlayer(this.player),this.player.bigPlayButton.hide(),!0===this.player.usingNativeControls_&&void 0!==this.player.tech_.el_&&(this.player.tech_.el_.controls=!1),!0===this.player.options_.controls){this.player.controlBar.show(),this.player.controlBar.el_.style.display="flex",this.player.controlBar.progressControl.hide();[this.player.controlBar.currentTimeDisplay,this.player.controlBar.timeDivider,this.player.controlBar.durationDisplay].forEach(function(e){void 0!==e&&(e.el_.style.display="block",e.show())}),void 0!==this.player.controlBar.remainingTimeDisplay&&this.player.controlBar.remainingTimeDisplay.hide(),this.player.controlBar.playToggle.on(["tap","click"],this.onPlayToggle.bind(this)),this.liveMode||this.player.controlBar.playToggle.hide()}var e=this.parseOptions(this.player.options_.plugins.wavesurfer);this.surfer=_.default.create(e),this.surfer.on("error",this.onWaveError.bind(this)),this.surfer.on("finish",this.onWaveFinish.bind(this)),!0===this.liveMode&&this.surfer.microphone.on("deviceError",this.onWaveError.bind(this)),this.surferReady=this.onWaveReady.bind(this),this.surferProgress=this.onWaveProgress.bind(this),this.surferSeek=this.onWaveSeek.bind(this),this.liveMode||this.setupPlaybackEvents(!0),this.player.on("volumechange",this.onVolumeChange.bind(this)),this.player.on("fullscreenchange",this.onScreenChange.bind(this)),this.player.muted()&&this.setVolume(0),!0===this.player.options_.fluid&&(this.surfer.drawer.wrapper.className="vjs-wavedisplay",this.responsiveWave=_.default.util.debounce(this.onResizeChange.bind(this),150),g.default.addEventListener("resize",this.responsiveWave)),this.startPlayers()}},{key:"parseOptions",value:function(e){var t=this.player.el_.getBoundingClientRect();this.originalWidth=this.player.options_.width||t.width,this.originalHeight=this.player.options_.height||t.height;var r=this.player.controlBar.height();if(!0===this.player.options_.controls&&0===r&&(r=30),void 0===e.container&&(e.container=this.player.el_),void 0===e.waveformHeight){var i=t.height;e.height=i-r}else e.height=opts.waveformHeight;return e.splitChannels&&!0===e.splitChannels&&(e.height/=2),!0===this.liveMode&&(e.plugins=[_.default.microphone.create(e)],this.log("wavesurfer.js microphone plugin enabled.")),e}},{key:"startPlayers",value:function(){var e=this.player.options_.plugins.wavesurfer;void 0!==e.src?void 0===this.surfer.microphone?(this.player.loadingSpinner.show(),this.load(e.src,e.peaks)):(this.player.loadingSpinner.hide(),e.wavesurfer=this.surfer):this.player.loadingSpinner.hide()}},{key:"setupPlaybackEvents",value:function(e){!1===e?(this.surfer.un("ready",this.surferReady),this.surfer.un("audioprocess",this.surferProgress),this.surfer.un("seek",this.surferSeek)):!0===e&&(this.surfer.on("ready",this.surferReady),this.surfer.on("audioprocess",this.surferProgress),this.surfer.on("seek",this.surferSeek))}},{key:"load",value:function(e,t){var r=this;if(e instanceof Blob||e instanceof File)this.log("Loading object: "+JSON.stringify(e)),this.surfer.loadBlob(e);else if(void 0!==t)if(Array.isArray(t))this.log("Loading URL: "+e),this.surfer.load(e,t);else{var i={url:t,responseType:"json"};void 0!==this.player.options_.plugins.wavesurfer.xhr&&(i.xhr=this.player.options_.plugins.wavesurfer.xhr);var o=_.default.util.ajax(i);o.on("success",function(i,o){r.log("Loaded Peak Data URL: "+t),r.surfer.load(e,i.data)}),o.on("error",function(i){r.log("Unable to retrieve peak data from "+t+". Status code: "+i.target.status,"warn"),r.log("Loading URL: "+e),r.surfer.load(e)})}else this.log("Loading URL: "+e),this.surfer.load(e)}},{key:"play",value:function(){if(this.player.controlBar.playToggle.handlePlay(),this.liveMode)if(this.surfer.microphone.active){var e=!this.surfer.microphone.paused;e?this.pause():(this.log("Resume microphone"),this.surfer.microphone.play())}else this.log("Start microphone"),this.surfer.microphone.start();else this.log("Start playback"),this.player.play(),this.surfer.play()}},{key:"pause",value:function(){this.player.controlBar.playToggle.contentEl()&&this.player.controlBar.playToggle.handlePause(),this.liveMode?(this.log("Pause microphone"),this.surfer.microphone.pause()):(this.log("Pause playback"),this.waveFinished?this.waveFinished=!1:this.surfer.pause(),this.setCurrentTime())}},{key:"dispose",value:function(){this.surfer&&(this.liveMode&&this.surfer.microphone&&(this.surfer.microphone.destroy(),this.log("Destroyed microphone plugin")),this.surfer.destroy()),this.log("Destroyed plugin")}},{key:"isDestroyed",value:function(){return this.player&&null===this.player.children()}},{key:"destroy",value:function(){this.player.dispose()}},{key:"setVolume",value:function(e){void 0!==e&&(this.log("Changing volume to: "+e),this.player.volume(e))}},{key:"exportImage",value:function(e,t){return this.surfer.exportImage(e,t)}},{key:"setAudioOutput",value:function(e){var t=this;e&&this.surfer.setSinkId(e).then(function(e){t.player.trigger("audioOutputReady")}).catch(function(e){t.player.trigger("error",e),t.log(e,"error")})}},{key:"getCurrentTime",value:function(){var e=this.surfer.getCurrentTime();return e=isNaN(e)?0:e}},{key:"setCurrentTime",value:function(e,t){this.trigger("timeupdate"),void 0===e&&(e=this.surfer.getCurrentTime()),void 0===t&&(t=this.surfer.getDuration()),e=isNaN(e)?0:e,t=isNaN(t)?0:t;var r=Math.min(e,t);this.player.controlBar.currentTimeDisplay.contentEl()&&(this.player.controlBar.currentTimeDisplay.formattedTime_=this.player.controlBar.currentTimeDisplay.contentEl().lastChild.textContent=(0,p.default)(r,t,this.msDisplayMax))}},{key:"getDuration",value:function(){var e=this.surfer.getDuration();return e=isNaN(e)?0:e}},{key:"setDuration",value:function(e){void 0===e&&(e=this.surfer.getDuration()),e=isNaN(e)?0:e,this.player.controlBar.durationDisplay.contentEl()&&(this.player.controlBar.durationDisplay.formattedTime_=this.player.controlBar.durationDisplay.contentEl().lastChild.textContent=(0,p.default)(e,e,this.msDisplayMax))}},{key:"onWaveReady",value:function(){this.waveReady=!0,this.waveFinished=!1,this.liveMode=!1,this.log("Waveform is ready"),this.player.trigger("waveReady"),this.setCurrentTime(),this.setDuration(),this.player.controlBar.playToggle.contentEl()&&this.player.controlBar.playToggle.show(),this.player.loadingSpinner.contentEl()&&this.player.loadingSpinner.hide(),!0===this.player.options_.autoplay&&this.play()}},{key:"onWaveFinish",value:function(){var e=this;this.log("Finished playback"),this.player.trigger("playbackFinish"),!0===this.player.options_.loop?(this.surfer.stop(),this.play()):(this.waveFinished=!0,this.pause(),this.player.trigger("ended"),this.surfer.once("seek",function(){e.player.controlBar.playToggle.removeClass("vjs-ended"),e.player.trigger("pause")}))}},{key:"onWaveProgress",value:function(e){this.setCurrentTime()}},{key:"onWaveSeek",value:function(){this.setCurrentTime()}},{key:"onWaveError",value:function(e){this.player.trigger("error",e),this.log(e,"error")}},{key:"onPlayToggle",value:function(){this.player.controlBar.playToggle.hasClass("vjs-ended")&&this.player.controlBar.playToggle.removeClass("vjs-ended"),this.surfer.isPlaying()?this.pause():this.play()}},{key:"onVolumeChange",value:function(){var e=this.player.volume();this.player.muted()&&(e=0),this.surfer.setVolume(e)}},{key:"onScreenChange",value:function(){var e=this,t=this.player.setInterval(function(){var r=e.player.isFullscreen(),i=void 0,o=void 0;if(r||(i=e.originalWidth,o=e.originalHeight),e.waveReady){if(e.liveMode&&!e.surfer.microphone.active)return;e.redrawWaveform(i,o)}e.player.clearInterval(t)},100)}},{key:"onResizeChange",value:function(){void 0!==this.surfer&&this.redrawWaveform()}},{key:"redrawWaveform",value:function(e,t){if(!this.isDestroyed()){if(this.player.el_){var r=this.player.el_.getBoundingClientRect();void 0===e&&(e=r.width),void 0===t&&(t=r.height)}this.surfer.drawer.destroy(),this.surfer.params.width=e,this.surfer.params.height=t-this.player.controlBar.height(),this.surfer.createDrawer(),this.surfer.drawer.wrapper.className="vjs-wavedisplay",this.surfer.drawBuffer(),this.surfer.drawer.progress(this.surfer.backend.getPlayedPercents())}}},{key:"log",value:function(e,t){(0,u.default)(e,t,this.debug)}}]),t}(P);k.VERSION="2.3.1",b.default.Wavesurfer=k,void 0===b.default.getPlugin("wavesurfer")&&b.default.registerPlugin("wavesurfer",k),b.default.registerTech("Html5",d.default),e.exports={Wavesurfer:k}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t,r){!0===r&&("error"===t?videojs.log.error(e):"warn"===t?videojs.log.warn(e):videojs.log(e))};t.default=i,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t,r){e=e<0?0:e,t=t||e;var i=Math.floor(e%60),o=Math.floor(e/60%60),s=Math.floor(e/3600),a=Math.floor(t/60%60),n=Math.floor(t/3600),l=Math.floor(1e3*(e-i));return(isNaN(e)||e===1/0)&&(s=o=i=l="-"),t>0&&t<r?(l<100&&(l=l<10?"00"+l:"0"+l),l=":"+l):l="",s=s>0||n>0?s+":":"",o=((s||a>=10)&&o<10?"0"+o:o)+":",i=i<10?"0"+i:i,s+o+i+l};t.default=i,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={debug:!1,msDisplayMax:3};t.default=i,e.exports=t.default},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=function e(t,r,i){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var s=Object.getPrototypeOf(t);return null===s?void 0:e(s,r,i)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(i)},l=videojs.getTech("Html5"),u=function(e){function t(e,r){return i(this,t),e.nativeTextTracks=!1,o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return s(t,e),a(t,[{key:"setActivePlayer",value:function(e){var t=this;this.activePlayer=e,this.waveready=!1,this.activePlayer.on("waveReady",function(){t.waveready=!0}),this.playerIsUsingWavesurfer()&&this.activePlayer.activeWavesurferPlugin.on("timeupdate",function(){t.trigger("timeupdate")})}},{key:"playerIsUsingWavesurfer",value:function(){var e=videojs.getPlugins(),t="wavesurfer"in e,r="record"in e;return t&&!r}},{key:"play",value:function(){return this.playerIsUsingWavesurfer()?this.activePlayer.activeWavesurferPlugin.play():n(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"play",this).call(this)}},{key:"pause",value:function(){return this.playerIsUsingWavesurfer()?this.activePlayer.activeWavesurferPlugin.pause():n(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"pause",this).call(this)}},{key:"currentTime",value:function(){return this.playerIsUsingWavesurfer()?this.waveready?this.activePlayer.activeWavesurferPlugin.getCurrentTime():0:n(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"currentTime",this).call(this)}},{key:"duration",value:function(){return this.playerIsUsingWavesurfer()?this.waveready?this.activePlayer.activeWavesurferPlugin.getDuration():0:n(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"duration",this).call(this)}},{key:"setCurrentTime",value:function(e){return this.playerIsUsingWavesurfer()?this.waveready?this.activePlayer.activeWavesurferPlugin.surfer.seekTo(e/this.activePlayer.activeWavesurferPlugin.surfer.getDuration()):0:n(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"currentTime",this).call(this,e)}},{key:"setPlaybackRate",value:function(e){return this.playerIsUsingWavesurfer()&&this.activePlayer.activeWavesurferPlugin.surfer.setPlaybackRate(e),n(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPlaybackRate",this).call(this,e)}}]),t}(l);u.isSupported=function(){return!0},t.default=u,e.exports=t.default},function(e,t,r){(function(t){var r;r="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},e.exports=r}).call(t,r(6))},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(t,r){t.exports=e},function(e,r){e.exports=t}])});
  //# sourceMappingURL=videojs.wavesurfer.min.js.map