diff --git a/public/libs/video-js/LICENSE b/public/libs/video-js/LICENSE new file mode 100644 index 0000000..8a7f05f --- /dev/null +++ b/public/libs/video-js/LICENSE @@ -0,0 +1,13 @@ +Copyright Brightcove, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/public/libs/videojs-seek-buttons/LICENSE b/public/libs/videojs-seek-buttons/LICENSE new file mode 100644 index 0000000..2f8716d --- /dev/null +++ b/public/libs/videojs-seek-buttons/LICENSE @@ -0,0 +1,13 @@ +Copyright mister-ben + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/public/libs/video-js/videojs-seek-buttons.css b/public/libs/videojs-seek-buttons/videojs-seek-buttons.min.css similarity index 100% rename from public/libs/video-js/videojs-seek-buttons.css rename to public/libs/videojs-seek-buttons/videojs-seek-buttons.min.css diff --git a/public/libs/video-js/videojs-seek-buttons.min.js b/public/libs/videojs-seek-buttons/videojs-seek-buttons.min.js similarity index 100% rename from public/libs/video-js/videojs-seek-buttons.min.js rename to public/libs/videojs-seek-buttons/videojs-seek-buttons.min.js diff --git a/public/libs/videojs-wavesurfer/LICENSE b/public/libs/videojs-wavesurfer/LICENSE new file mode 100644 index 0000000..bd87de0 --- /dev/null +++ b/public/libs/videojs-wavesurfer/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014-2020 Collab + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/public/libs/videojs-wavesurfer/videojs.wavesurfer.min.css b/public/libs/videojs-wavesurfer/videojs.wavesurfer.min.css new file mode 100644 index 0000000..a8cc999 --- /dev/null +++ b/public/libs/videojs-wavesurfer/videojs.wavesurfer.min.css @@ -0,0 +1,3 @@ +/*! +Default styles for videojs-wavesurfer 3.3.1 +*/.vjs-wavesurfer .vjs-using-native-controls .vjs-control-bar{display:flex!important}.vjs-progress-control,.vjs-text-track-display,.vjs-wavesurfer .vjs-menu-content,.vjs-wavesurfer .vjs-modal-dialog{z-index:4}.vjs-wavesurfer.vjs-fluid wave.vjs-wavedisplay{top:0;position:absolute!important;width:100%;min-width:100%;max-width:100%;height:100%} \ No newline at end of file diff --git a/public/libs/videojs-wavesurfer/videojs.wavesurfer.min.js b/public/libs/videojs-wavesurfer/videojs.wavesurfer.min.js new file mode 100644 index 0000000..e45e82c --- /dev/null +++ b/public/libs/videojs-wavesurfer/videojs.wavesurfer.min.js @@ -0,0 +1,8 @@ +/*! + * videojs-wavesurfer + * @version 3.3.1 + * @see https://github.com/collab-project/videojs-wavesurfer + * @copyright 2014-2020 Collab + * @license MIT + */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("video.js"),require("wavesurfer.js")):"function"==typeof define&&define.amd?define("VideojsWavesurfer",["video.js","wavesurfer.js"],t):"object"==typeof exports?exports.VideojsWavesurfer=t(require("video.js"),require("wavesurfer.js")):e.VideojsWavesurfer=t(e.videojs,e.WaveSurfer)}(window,(function(e,t){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(i,o,function(t){return e[t]}.bind(null,o));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){r(2),e.exports=r(13)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Wavesurfer=void 0;var i=h(r(3)),o=h(r(4)),a=h(r(5)),n=h(r(8)),s=h(r(9)),l=h(r(10)),u=h(r(0)),c=h(r(12));function h(e){return e&&e.__esModule?e:{default:e}}function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){for(var r=0;r0,r.displayMilliseconds=t.displayMilliseconds,u.default.setFormatTime((function(e,t){return(0,a.default)(e,t,r.displayMilliseconds)})),r.player.one(i.default.READY,r.initialize.bind(g(r))),r}return t=d,(r=[{key:"initialize",value:function(){var e=this;void 0!==this.player.bigPlayButton&&this.player.bigPlayButton.hide();var t=this.parseOptions(this.player.options_.plugins.wavesurfer);!0===this.player.options_.controls&&(this.player.controlBar.show(),this.player.controlBar.el_.style.display="flex",this.backend===k&&void 0!==this.player.controlBar.progressControl&&this.player.controlBar.progressControl.hide(),void 0!==this.player.controlBar.pictureInPictureToggle&&this.player.controlBar.pictureInPictureToggle.hide(),["currentTimeDisplay","timeDivider","durationDisplay"].forEach((function(t){void 0!==(t=e.player.controlBar[t])&&(t.el_.style.display="block",t.show())})),void 0!==this.player.controlBar.remainingTimeDisplay&&this.player.controlBar.remainingTimeDisplay.hide(),this.backend===k&&void 0!==this.player.controlBar.playToggle&&(this.player.controlBar.playToggle.on(["tap","click"],this.onPlayToggle.bind(this)),this.player.controlBar.playToggle.hide())),this.surfer=c.default.create(t),this.surfer.on(i.default.ERROR,this.onWaveError.bind(this)),this.surfer.on(i.default.FINISH,this.onWaveFinish.bind(this)),this.backend=this.surfer.params.backend,this.log("Using wavesurfer.js "+this.backend+" backend."),"microphone"in this.player.wavesurfer().surfer.getActivePlugins()&&(this.liveMode=!0,this.waveReady=!0,this.log("wavesurfer.js microphone plugin enabled."),this.player.controlBar.playToggle.show(),this.surfer.microphone.on(i.default.DEVICE_ERROR,this.onWaveError.bind(this))),this.surferReady=this.onWaveReady.bind(this),this.backend===k&&(this.surferProgress=this.onWaveProgress.bind(this),this.surferSeek=this.onWaveSeek.bind(this),this.player.muted()&&this.setVolume(0)),this.liveMode||this.setupPlaybackEvents(!0),this.player.on(i.default.VOLUMECHANGE,this.onVolumeChange.bind(this)),this.player.on(i.default.FULLSCREENCHANGE,this.onScreenChange.bind(this)),!0===this.player.options_.fluid&&(this.surfer.drawer.wrapper.className=w,this.responsiveWave=c.default.util.debounce(this.onResizeChange.bind(this),150),l.default.addEventListener(i.default.RESIZE,this.responsiveWave))}},{key:"parseOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},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=e.waveformHeight;return e.splitChannels&&!0===e.splitChannels&&(e.height/=2),"backend"in e?this.backend=e.backend:e.backend=this.backend=R,e}},{key:"setupPlaybackEvents",value:function(e){!1===e?(this.surfer.un(i.default.READY,this.surferReady),this.backend===k&&(this.surfer.un(i.default.AUDIOPROCESS,this.surferProgress),this.surfer.un(i.default.SEEK,this.surferSeek))):!0===e&&(this.surfer.on(i.default.READY,this.surferReady),this.backend===k&&(this.surfer.on(i.default.AUDIOPROCESS,this.surferProgress),this.surfer.on(i.default.SEEK,this.surferSeek)))}},{key:"load",value:function(e,t){e instanceof Blob||e instanceof File?(this.log("Loading object: "+JSON.stringify(e)),this.surfer.loadBlob(e)):void 0!==t?this.loadPeaks(e,t):("string"==typeof e?this.log("Loading URL: "+e):this.log("Loading element: "+e),this.surfer.load(e))}},{key:"loadPeaks",value:function(e,t){var r=this;if(Array.isArray(t))this.log("Loading URL with array of peaks: "+e),this.surfer.load(e,t);else{var o={url:t,responseType:"json"};void 0!==this.player.options_.plugins.wavesurfer.xhr&&(o.xhr=this.player.options_.plugins.wavesurfer.xhr);var a=c.default.util.fetchFile(o);a.once("success",(function(o){r.log("Loaded Peak Data URL: "+t),o&&o.data?r.surfer.load(e,o.data):(r.player.trigger(i.default.ERROR,"Could not load peaks data from "+t),r.log(err,"error"))})),a.on("error",(function(i){r.log("Unable to retrieve peak data from "+t+". Status code: "+a.response.status,"warn"),r.log("Loading URL: "+e),r.surfer.load(e)}))}}},{key:"play",value:function(){void 0!==this.player.controlBar.playToggle&&this.player.controlBar.playToggle.contentEl()&&this.player.controlBar.playToggle.handlePlay(),this.liveMode?this.surfer.microphone.active?this.surfer.microphone.paused?(this.log("Resume microphone"),this.surfer.microphone.play()):this.pause():(this.log("Start microphone"),this.surfer.microphone.start()):(this.log("Start playback"),this.player.play(),this.surfer.play())}},{key:"pause",value:function(){void 0!==this.player.controlBar.playToggle&&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){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"blob";return this.surfer.exportImage(e,t,r)}},{key:"setAudioOutput",value:function(e){var t=this;e&&this.surfer.setSinkId(e).then((function(e){t.player.trigger(i.default.AUDIO_OUTPUT_READY)})).catch((function(e){t.player.trigger(i.default.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){if(void 0===e&&(e=this.surfer.getCurrentTime()),void 0===t&&(t=this.surfer.getDuration()),e=isNaN(e)?0:e,t=isNaN(t)?0:t,this.player.controlBar.currentTimeDisplay&&this.player.controlBar.currentTimeDisplay.contentEl()&&this.player.controlBar.currentTimeDisplay.contentEl().lastChild){var r=Math.min(e,t);this.player.controlBar.currentTimeDisplay.formattedTime_=this.player.controlBar.currentTimeDisplay.contentEl().lastChild.textContent=(0,a.default)(r,t,this.displayMilliseconds)}this.textTracksEnabled&&this.player.tech_&&this.player.tech_.el_&&this.player.tech_.setCurrentTime(e)}},{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&&this.player.controlBar.durationDisplay.contentEl()&&this.player.controlBar.durationDisplay.contentEl().lastChild&&(this.player.controlBar.durationDisplay.formattedTime_=this.player.controlBar.durationDisplay.contentEl().lastChild.textContent=(0,a.default)(e,e,this.displayMilliseconds))}},{key:"onWaveReady",value:function(){var e=this;this.waveReady=!0,this.waveFinished=!1,this.liveMode=!1,this.log("Waveform is ready"),this.player.trigger(i.default.WAVE_READY),this.backend===k&&(this.setCurrentTime(),this.setDuration(),void 0!==this.player.controlBar.playToggle&&this.player.controlBar.playToggle.contentEl()&&this.player.controlBar.playToggle.show()),this.player.loadingSpinner.contentEl()&&this.player.loadingSpinner.hide(),!0===this.player.options_.autoplay&&(this.setVolume(0),this.backend===k?this.play():this.player.play().catch((function(t){e.onWaveError(t)})))}},{key:"onWaveFinish",value:function(){var e=this;this.log("Finished playback"),this.player.trigger(i.default.PLAYBACK_FINISH),!0===this.player.options_.loop?this.backend===k&&(this.surfer.stop(),this.play()):(this.waveFinished=!0,this.backend===k&&(this.pause(),this.player.trigger(i.default.ENDED),this.surfer.once(i.default.SEEK,(function(){void 0!==e.player.controlBar.playToggle&&e.player.controlBar.playToggle.removeClass("vjs-ended"),e.player.trigger(i.default.PAUSE)}))))}},{key:"onWaveProgress",value:function(e){this.setCurrentTime()}},{key:"onWaveSeek",value:function(){this.setCurrentTime()}},{key:"onWaveError",value:function(e){e.name&&"AbortError"===e.name||"DOMException"===e.name&&e.message.startsWith("The operation was aborted")?this.player.trigger(i.default.ABORT,e):(this.player.trigger(i.default.ERROR,e),this.log(e,"error"))}},{key:"onPlayToggle",value:function(){void 0!==this.player.controlBar.playToggle&&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,i;if(e.player.isFullscreen()||(r=e.originalWidth,i=e.originalHeight),e.waveReady){if(e.liveMode&&!e.surfer.microphone.active)return;e.redrawWaveform(r,i)}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=w,this.surfer.drawBuffer(),this.surfer.drawer.progress(this.surfer.backend.getPlayedPercents())}}},{key:"log",value:function(e,t){(0,o.default)(e,t,this.debug)}}])&&f(t.prototype,r),s&&f(t,s),d}(m);t.Wavesurfer=_,_.VERSION="3.3.1",u.default.Wavesurfer=_,void 0===u.default.getPlugin(E)&&u.default.registerPlugin(E,_),u.default.use("*",(function(e){return s.default.player=e,s.default}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)};i.READY="ready",i.ERROR="error",i.VOLUMECHANGE="volumechange",i.FULLSCREENCHANGE="fullscreenchange",i.TIMEUPDATE="timeupdate",i.ENDED="ended",i.PAUSE="pause",i.FINISH="finish",i.SEEK="seek",i.REDRAW="redraw",i.AUDIOPROCESS="audioprocess",i.DEVICE_READY="deviceReady",i.DEVICE_ERROR="deviceError",i.AUDIO_OUTPUT_READY="audioOutputReady",i.WAVE_READY="waveReady",i.PLAYBACK_FINISH="playbackFinish",i.ABORT="abort",i.RESIZE="resize",Object.freeze(i);var o=i;t.default=o,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,o=(i=r(0))&&i.__esModule?i:{default:i};var a=function(e,t,r){!0===r&&("error"===t?o.default.log.error(e):"warn"===t?o.default.log.warn(e):o.default.log(e))};t.default=a,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=a(r(6)),o=a(r(7));function a(e){return e&&e.__esModule?e:{default:e}}var n=function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=e<0?0:e,(isNaN(e)||e===1/0)&&(e=0);var a=(0,o.default)(1e3*e),n=a;void 0!==t&&(n=(0,o.default)(1e3*t));var s=(0,i.default)(a.hours),l=(0,i.default)(a.minutes),u=(0,i.default)(a.seconds),c=(0,i.default)(a.milliseconds,3);if(a.days>0||n.days>0){var h=(0,i.default)(a.days);return"".concat(h,":").concat(s,":").concat(l,":").concat(u)}return a.hours>0||n.hours>0?"".concat(s,":").concat(l,":").concat(u):r?"".concat(l,":").concat(u,":").concat(c):"".concat(l,":").concat(u)};t.default=n,e.exports=t.default},function(e,t,r){var i;!function(t){"use strict";function o(e,t){t=t||2;var r,i=Number(e)<0,o=e.toString();return i&&(o=o.slice(1)),r=t-o.length+1,(i?"-":"")+(o=new Array(r).join("0").concat(o))}void 0===(i=function(){return o}.call(t,r,t,e))||(e.exports=i)}(this)},function(e,t,r){"use strict";e.exports=e=>{if("number"!=typeof e)throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(1e3*e)%1e3,nanoseconds:t(1e6*e)%1e3}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i={debug:!1,displayMilliseconds:!0};t.default=i,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i={setSource:function(e,t){if(this.player.usingPlugin("wavesurfer")){var r=this.player.wavesurfer().surfer.params.backend,i=e.src,o=e.peaks;switch(r){case"WebAudio":this.player.wavesurfer().load(i);break;default:t(null,e);var a=this.player.tech_.el();void 0===o?this.player.wavesurfer().load(a):this.player.wavesurfer().load(a,o)}}else t(null,e)}};t.default=i,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(this,r(11))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,r){e.exports=t},function(e,t,r){}])})); \ No newline at end of file diff --git a/public/libs/wavesurfer-js/LICENSE b/public/libs/wavesurfer-js/LICENSE new file mode 100644 index 0000000..148cbe4 --- /dev/null +++ b/public/libs/wavesurfer-js/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2012-2020, katspaugh and contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/public/libs/wavesurfer-js/wavesurfer.min.js b/public/libs/wavesurfer-js/wavesurfer.min.js new file mode 100644 index 0000000..7f8a478 --- /dev/null +++ b/public/libs/wavesurfer-js/wavesurfer.min.js @@ -0,0 +1,7 @@ +/*! + * wavesurfer.js 3.3.3 (2020-04-16) + * https://github.com/katspaugh/wavesurfer.js + * @license BSD-3-Clause + */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("WaveSurfer",[],t):"object"==typeof exports?exports.WaveSurfer=t():e.WaveSurfer=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=7)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ajax",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"getId",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"max",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"min",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"Observer",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"extend",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"style",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"requestAnimationFrame",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"frame",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(t,"preventClick",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(t,"fetchFile",{enumerable:!0,get:function(){return p.default}});var n=v(r(8)),i=v(r(2)),a=v(r(9)),s=v(r(10)),o=v(r(1)),u=v(r(11)),l=v(r(3)),c=v(r(4)),f=v(r(12)),h=v(r(13)),d=v(r(14)),p=v(r(15));function v(e){return e&&e.__esModule?e:{default:e}}},function(e,t,r){"use strict";function n(e,t){for(var r=0;r=0;r--)n[r]==t&&n.splice(r,1);else n.length=0}}},{key:"unAll",value:function(){this.handlers=null}},{key:"once",value:function(e,t){var r=this;return this.on(e,(function n(){for(var i=arguments.length,a=new Array(i),s=0;s1?t-1:0),n=1;n=e.getDuration()?(e.setState("finished"),e.fireEvent("pause")):t>=e.scheduledPause?e.pause():e.state===e.states.playing&&e.fireEvent("audioprocess",t)}}},{key:"removeOnAudioProcess",value:function(){this.scriptNode.onaudioprocess=function(){}}},{key:"createAnalyserNode",value:function(){this.analyser=this.ac.createAnalyser(),this.analyser.connect(this.gainNode)}},{key:"createVolumeNode",value:function(){this.ac.createGain?this.gainNode=this.ac.createGain():this.gainNode=this.ac.createGainNode(),this.gainNode.connect(this.ac.destination)}},{key:"setSinkId",value:function(e){if(e){var t=new window.Audio;if(!t.setSinkId)return Promise.reject(new Error("setSinkId is not supported in your browser"));t.autoplay=!0;var r=this.ac.createMediaStreamDestination();return this.gainNode.disconnect(),this.gainNode.connect(r),t.srcObject=r.stream,t.setSinkId(e)}return Promise.reject(new Error("Invalid deviceId: "+e))}},{key:"setVolume",value:function(e){this.gainNode.gain.setValueAtTime(e,this.ac.currentTime)}},{key:"getVolume",value:function(){return this.gainNode.gain.value}},{key:"decodeArrayBuffer",value:function(e,t,r){this.offlineAc||(this.offlineAc=this.getOfflineAudioContext(this.ac&&this.ac.sampleRate?this.ac.sampleRate:44100)),this.offlineAc.decodeAudioData(e,(function(e){return t(e)}),r)}},{key:"setPeaks",value:function(e,t){null!=t&&(this.explicitDuration=t),this.peaks=e}},{key:"setLength",value:function(e){if(!this.mergedPeaks||e!=2*this.mergedPeaks.length-1+2){this.splitPeaks=[],this.mergedPeaks=[];var t,r=this.buffer?this.buffer.numberOfChannels:1;for(t=0;tp&&(p=y),ythis.mergedPeaks[2*c])&&(this.mergedPeaks[2*c]=p),(0==i||d=this.getDuration()&&(e=0),null==t&&(t=this.getDuration()),this.startPosition=e,this.lastPlay=this.ac.currentTime,this.state===this.states.finished&&this.setState("paused"),{start:e,end:t}}},{key:"getPlayedTime",value:function(){return(this.ac.currentTime-this.lastPlay)*this.playbackRate}},{key:"play",value:function(e,t){if(this.buffer){this.createSource();var r=this.seekTo(e,t);e=r.start,t=r.end,this.scheduledPause=t,this.source.start(0,e),"suspended"==this.ac.state&&this.ac.resume&&this.ac.resume(),this.setState("playing"),this.fireEvent("play")}}},{key:"pause",value:function(){this.scheduledPause=null,this.startPosition+=this.getPlayedTime(),this.source&&this.source.stop(0),this.setState("paused"),this.fireEvent("pause")}},{key:"getCurrentTime",value:function(){return this.state.getCurrentTime.call(this)}},{key:"getPlaybackRate",value:function(){return this.playbackRate}},{key:"setPlaybackRate",value:function(e){e=e||1,this.isPaused()?this.playbackRate=e:(this.pause(),this.playbackRate=e,this.play())}},{key:"setPlayEnd",value:function(e){this.scheduledPause=e}}]),t}(n.Observer);t.default=h,h.scriptBufferSize=256,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(5))&&n.__esModule?n:{default:n},a=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==o(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=n?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}r.default=e,t&&t.set(e,r);return r}(r(0));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var r=0;r=1/0&&(e=this.media.seekable.end(0)),e}},{key:"getCurrentTime",value:function(){return this.media&&this.media.currentTime}},{key:"getPlayedPercents",value:function(){return this.getCurrentTime()/this.getDuration()||0}},{key:"getPlaybackRate",value:function(){return this.playbackRate||this.media.playbackRate}},{key:"setPlaybackRate",value:function(e){this.playbackRate=e||1,this.media.playbackRate=this.playbackRate}},{key:"seekTo",value:function(e){null!=e&&(this.media.currentTime=e),this.clearPlayEnd()}},{key:"play",value:function(e,t){this.seekTo(e);var r=this.media.play();return t&&this.setPlayEnd(t),r}},{key:"pause",value:function(){var e;return this.media&&(e=this.media.pause()),this.clearPlayEnd(),e}},{key:"setPlayEnd",value:function(e){var t=this;this.clearPlayEnd(),this._onPlayEnd=function(r){r>=e&&(t.pause(),t.seekTo(e))},this.on("audioprocess",this._onPlayEnd)}},{key:"clearPlayEnd",value:function(){this._onPlayEnd&&(this.un("audioprocess",this._onPlayEnd),this._onPlayEnd=null)}},{key:"getPeaks",value:function(e,r,n){return this.buffer?c(f(t.prototype),"getPeaks",this).call(this,e,r,n):this.peaks||[]}},{key:"setSinkId",value:function(e){return e?this.media.setSinkId?this.media.setSinkId(e):Promise.reject(new Error("setSinkId is not supported in your browser")):Promise.reject(new Error("Invalid deviceId: "+e))}},{key:"getVolume",value:function(){return this.volume}},{key:"setVolume",value:function(e){this.volume=e,this.media.volume!==this.volume&&(this.media.volume=this.volume)}},{key:"destroy",value:function(){var e=this;this.pause(),this.unAll(),this.destroyed=!0,Object.keys(this.mediaListeners).forEach((function(t){e.media&&e.media.removeEventListener(t,e.mediaListeners[t])})),this.params.removeMediaElementOnDestroy&&this.media&&this.media.parentNode&&this.media.parentNode.removeChild(this.media),this.media=null}}])&&u(r.prototype,n),i&&u(r,i),t}(i.default);t.default=d,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==f(e)&&"function"!=typeof e)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=n?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}r.default=e,t&&t.set(e,r);return r}(r(0)),i=l(r(16)),a=l(r(5)),s=l(r(6)),o=l(r(19)),u=l(r(20));function l(e){return e&&e.__esModule?e:{default:e}}function c(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return c=function(){return e},e}function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?p(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var r=0;r=this.getDuration()?this.seekTo(1):this.seekTo(e/this.getDuration())}},{key:"play",value:function(e,t){var r=this;return this.fireEvent("interaction",(function(){return r.play(e,t)})),this.backend.play(e,t)}},{key:"setPlayEnd",value:function(e){this.backend.setPlayEnd(e)}},{key:"pause",value:function(){if(!this.backend.isPaused())return this.backend.pause()}},{key:"playPause",value:function(){return this.backend.isPaused()?this.play():this.pause()}},{key:"isPlaying",value:function(){return!this.backend.isPaused()}},{key:"skipBackward",value:function(e){this.skip(-e||-this.params.skipLength)}},{key:"skipForward",value:function(e){this.skip(e||this.params.skipLength)}},{key:"skip",value:function(e){var t=this.getDuration()||1,r=this.getCurrentTime()||0;r=Math.max(0,Math.min(t,r+(e||0))),this.seekAndCenter(r/t)}},{key:"seekAndCenter",value:function(e){this.seekTo(e),this.drawer.recenter(e)}},{key:"seekTo",value:function(e){var t=this;if("number"!=typeof e||!isFinite(e)||e<0||e>1)throw new Error("Error calling wavesurfer.seekTo, parameter must be a number between 0 and 1!");this.fireEvent("interaction",(function(){return t.seekTo(e)}));var r=this.backend.isPaused();r||this.backend.pause();var n=this.params.scrollParent;this.params.scrollParent=!1,this.backend.seekTo(e*this.getDuration()),this.drawer.progress(e),r||this.backend.play(),this.params.scrollParent=n,this.fireEvent("seek",e)}},{key:"stop",value:function(){this.pause(),this.seekTo(0),this.drawer.progress(0)}},{key:"setSinkId",value:function(e){return this.backend.setSinkId(e)}},{key:"setVolume",value:function(e){this.backend.setVolume(e),this.fireEvent("volume",e)}},{key:"getVolume",value:function(){return this.backend.getVolume()}},{key:"setPlaybackRate",value:function(e){this.backend.setPlaybackRate(e)}},{key:"getPlaybackRate",value:function(){return this.backend.getPlaybackRate()}},{key:"toggleMute",value:function(){this.setMute(!this.isMuted)}},{key:"setMute",value:function(e){e!==this.isMuted?(e?(this.savedVolume=this.backend.getVolume(),this.backend.setVolume(0),this.isMuted=!0,this.fireEvent("volume",0)):(this.backend.setVolume(this.savedVolume),this.isMuted=!1,this.fireEvent("volume",this.savedVolume)),this.fireEvent("mute",this.isMuted)):this.fireEvent("mute",this.isMuted)}},{key:"getMute",value:function(){return this.isMuted}},{key:"getFilters",value:function(){return this.backend.filters||[]}},{key:"toggleScroll",value:function(){this.params.scrollParent=!this.params.scrollParent,this.drawBuffer()}},{key:"toggleInteraction",value:function(){this.params.interact=!this.params.interact}},{key:"getWaveColor",value:function(){return this.params.waveColor}},{key:"setWaveColor",value:function(e){this.params.waveColor=e,this.drawBuffer()}},{key:"getProgressColor",value:function(){return this.params.progressColor}},{key:"setProgressColor",value:function(e){this.params.progressColor=e,this.drawBuffer()}},{key:"getBackgroundColor",value:function(){return this.params.backgroundColor}},{key:"setBackgroundColor",value:function(e){this.params.backgroundColor=e,n.style(this.container,{background:this.params.backgroundColor})}},{key:"getCursorColor",value:function(){return this.params.cursorColor}},{key:"setCursorColor",value:function(e){this.params.cursorColor=e,this.drawer.updateCursor()}},{key:"getHeight",value:function(){return this.params.height}},{key:"setHeight",value:function(e){this.params.height=e,this.drawer.setHeight(e*this.params.pixelRatio),this.drawBuffer()}},{key:"drawBuffer",value:function(){var e,t=Math.round(this.getDuration()*this.params.minPxPerSec*this.params.pixelRatio),r=this.drawer.getWidth(),n=t,i=0,a=Math.max(i+r,n);if(this.params.fillParent&&(!this.params.scrollParent||tt&&(t=e[r])})),t},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=Number(1/0);return Object.keys(e).forEach((function(r){e[r]1?t-1:0),n=1;n=0?n=setTimeout(u,t-l):(n=null,r||(o=e.apply(a,i),a=i=null))}null==t&&(t=100);var l=function(){a=this,i=arguments,s=Date.now();var l=r&&!n;return n||(n=setTimeout(u,t)),l&&(o=e.apply(a,i),a=i=null),o};return l.clear=function(){n&&(clearTimeout(n),n=null)},l.flush=function(){n&&(o=e.apply(a,i),a=i=null,clearTimeout(n),n=null)},l}r.debounce=r,e.exports=r},function(e,t,r){"use strict";function n(e){e.stopPropagation(),document.body.removeEventListener("click",n,!0)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){document.body.addEventListener("click",n,!0)},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(!e)throw new Error("fetch options missing");if(!e.url)throw new Error("fetch url missing");var t=new i.default,r=new Headers,n=new Request(e.url);t.controller=new AbortController,e&&e.requestHeaders&&e.requestHeaders.forEach((function(e){r.append(e.key,e.value)}));var a=e.responseType||"json",o={method:e.method||"GET",headers:r,mode:e.mode||"cors",credentials:e.credentials||"same-origin",cache:e.cache||"default",redirect:e.redirect||"follow",referrer:e.referrer||"client",signal:t.controller.signal};return fetch(n,o).then((function(e){t.response=e;var r=!0;e.body||(r=!1);var n=e.headers.get("content-length");return null===n&&(r=!1),r?(t.onProgress=function(e){t.fireEvent("progress",e)},new Response(new ReadableStream(new s(t,n,e)),o)):e})).then((function(e){var t;if(e.ok)switch(a){case"arraybuffer":return e.arrayBuffer();case"json":return e.json();case"blob":return e.blob();case"text":return e.text();default:t="Unknown responseType: "+a}throw t||(t="HTTP error status: "+e.status),new Error(t)})).then((function(e){t.fireEvent("success",e)})).catch((function(e){t.fireEvent("error",e)})),t.fetchRequest=n,t};var n,i=(n=r(1))&&n.__esModule?n:{default:n};function a(e,t){for(var r=0;rr;)this.removeCanvas();var n=this.maxCanvasWidth+this.overlap,i=this.canvases.length-1;this.canvases.forEach((function(t,r){r==i&&(n=e.width-e.maxCanvasWidth*i),e.updateDimensions(t,n,e.height),t.clearWave()}))}},{key:"addCanvas",value:function(){var e=new this.EntryClass;e.canvasContextAttributes=this.canvasContextAttributes,e.hasProgressCanvas=this.hasProgressCanvas,e.halfPixel=this.halfPixel;var t=this.maxCanvasElementWidth*this.canvases.length;e.initWave(this.wrapper.appendChild(this.style(document.createElement("canvas"),{position:"absolute",zIndex:2,left:t+"px",top:0,bottom:0,height:"100%",pointerEvents:"none"}))),this.hasProgressCanvas&&e.initProgress(this.progressWave.appendChild(this.style(document.createElement("canvas"),{position:"absolute",left:t+"px",top:0,bottom:0,height:"100%"}))),this.canvases.push(e)}},{key:"removeCanvas",value:function(){var e=this.canvases[this.canvases.length-1];e.wave.parentElement.removeChild(e.wave),this.hasProgressCanvas&&e.progress.parentElement.removeChild(e.progress),e&&(e.destroy(),e=null),this.canvases.pop()}},{key:"updateDimensions",value:function(e,t,r){var n=Math.round(t/this.params.pixelRatio),i=Math.round(this.width/this.params.pixelRatio);e.updateDimensions(n,i,t,r),this.style(this.progressWave,{display:"block"})}},{key:"clearWave",value:function(){var e=this;i.frame((function(){e.canvases.forEach((function(e){return e.clearWave()}))}))()}},{key:"drawBars",value:function(e,t,r,n){var i=this;return this.prepareDraw(e,t,r,n,(function(e){var t=e.absmax,a=e.hasMinVals,s=(e.height,e.offsetY),o=e.halfH,u=e.peaks;if(void 0!==r)for(var l=a?2:1,c=u.length/l,f=i.params.barWidth*i.params.pixelRatio,h=f+(null===i.params.barGap?Math.max(i.params.pixelRatio,~~(f/2)):Math.max(i.params.pixelRatio,i.params.barGap*i.params.pixelRatio)),d=c/i.width,p=n,v=r;vl?-c:l}var f=[].some.call(e,(function(e){return e<0})),h=s.params.height*s.params.pixelRatio;return a({absmax:u,hasMinVals:f,height:h,offsetY:h*t||0,halfH:h/2,peaks:e})}))()}},{key:"setFillStyles",value:function(e){e.setFillStyles(this.params.waveColor,this.params.progressColor)}},{key:"getImage",value:function(e,t,r){if("blob"===r)return Promise.all(this.canvases.map((function(n){return n.getImage(e,t,r)})));if("dataURL"===r){var n=this.canvases.map((function(n){return n.getImage(e,t,r)}));return n.length>1?n:n[0]}}},{key:"updateProgress",value:function(e){this.style(this.progressWave,{width:e+"px"})}}])&&l(r.prototype,n),s&&l(r,s),t}(n.default);t.default=d,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var o=n?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(r,s,o):r[s]=e[s]}r.default=e,t&&t.set(e,r);return r}(r(0));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var r=0;r1&&(r=1):r=((this.params.rtl?i.right-n:n-i.left)+this.wrapper.scrollLeft)/this.wrapper.scrollWidth||0,r}},{key:"setupWrapperEvents",value:function(){var e=this;this.wrapper.addEventListener("click",(function(t){var r=e.wrapper.offsetHeight-e.wrapper.clientHeight;if(0!==r){var n=e.wrapper.getBoundingClientRect();if(t.clientY>=n.bottom-r)return}e.params.interact&&e.fireEvent("click",t,e.handleEvent(t))})),this.wrapper.addEventListener("dblclick",(function(t){e.params.interact&&e.fireEvent("dblclick",t,e.handleEvent(t))})),this.wrapper.addEventListener("scroll",(function(t){return e.fireEvent("scroll",t)}))}},{key:"drawPeaks",value:function(e,t,r,n){this.setWidth(t)||this.clearWave(),this.params.barWidth?this.drawBars(e,0,r,n):this.drawWave(e,0,r,n)}},{key:"resetScroll",value:function(){null!==this.wrapper&&(this.wrapper.scrollLeft=0)}},{key:"recenter",value:function(e){var t=this.wrapper.scrollWidth*e;this.recenterOnPosition(t,!0)}},{key:"recenterOnPosition",value:function(e,t){var r=this.wrapper.scrollLeft,n=~~(this.wrapper.clientWidth/2),i=this.wrapper.scrollWidth-this.wrapper.clientWidth,a=e-n,s=a-r;if(0!=i){if(!t&&-n<=s&&s=t){if(this.lastPos=r,this.params.scrollParent&&this.params.autoCenter){var n=~~(this.wrapper.scrollWidth*e);this.recenterOnPosition(n,this.params.autoCenterImmediately)}this.updateProgress(r)}}},{key:"destroy",value:function(){this.unAll(),this.wrapper&&(this.wrapper.parentNode==this.container&&this.container.removeChild(this.wrapper),this.wrapper=null)}},{key:"updateCursor",value:function(){}},{key:"updateSize",value:function(){}},{key:"drawBars",value:function(e,t,r,n){}},{key:"drawWave",value:function(e,t,r,n){}},{key:"clearWave",value:function(){}},{key:"updateProgress",value:function(e){}}])&&s(r.prototype,i),a&&s(r,a),t}(n.Observer);t.default=c,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a(r(3)),i=a(r(2));function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){for(var r=0;r=h;m--)u=t[2*m+1]||0,l=Math.round(u/y),e.lineTo((m-f)*p+this.halfPixel,v-l);e.lineTo((h-f)*p,v-Math.round((t[2*h+1]||0)/y)),e.closePath(),e.fill()}}},{key:"destroy",value:function(){this.waveCtx=null,this.wave=null,this.progressCtx=null,this.progress=null}},{key:"getImage",value:function(e,t,r){var n=this;return"blob"===r?new Promise((function(r){n.wave.toBlob(r,e,t)})):"dataURL"===r?this.wave.toDataURL(e,t):void 0}}])&&s(t.prototype,r),a&&s(t,a),e}();t.default=o,e.exports=t.default},function(e,t,r){"use strict";function n(e,t){for(var r=0;r { return page.onAxiosError(response) } - if (!/^(video|audio)\//.test(response.headers['content-type'])) { + const type = response.headers['content-type'] || '' + const isvideo = type.startsWith('video/') + const isaudio = type.startsWith('audio/') + if (!isvideo && !isaudio) { page.toggleReloadBtn(true) return swal('An error occurred!', 'The requested upload does not appear to be a media file.', 'error') } @@ -82,17 +85,29 @@ page.reloadVideo = () => { videoElement.setAttribute('controls', true) videoElement.setAttribute('preload', 'auto') - const sourceElement = document.createElement('source') - sourceElement.src = src - sourceElement.type = response.headers['content-type'] - - videoElement.appendChild(sourceElement) page.videoContainer.appendChild(videoElement) - page.player = videojs('video-js', { + const options = { language: 'en', playbackRates: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2], responsive: true + } + + if (isaudio) { + options.plugins = { + wavesurfer: { + backend: 'MediaElement' + } + } + } + + page.player = videojs('video-js', options, () => { + let message = `Using video.js ${videojs.VERSION}` + if (isaudio) { + message += `with videojs-wavesurfer ${videojs.getPluginVersion('wavesurfer')} and wavesurfer.js ${WaveSurfer.VERSION}` + } + videojs.log(message) + page.player.src({ src, type }) }) page.player.seekButtons({ forward: 10, back: 10 }) diff --git a/views/player.njk b/views/player.njk index e3ea8b5..93ff3d3 100644 --- a/views/player.njk +++ b/views/player.njk @@ -11,8 +11,8 @@ - + + @@ -26,7 +26,9 @@ - + + + {# We assign an ID for this so that the script can find out proper root URL of uploaded files #}