Spaces:
Runtime error
Runtime error
| /*! | |
| * videojs-wavesurfer | |
| * @version 3.8.0 | |
| * @see https://github.com/collab-project/videojs-wavesurfer | |
| * @copyright 2014-2021 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)); | |
| })(self, function (e, t) { | |
| return (() => { | |
| var r = { | |
| 21: function (e, t, r) { | |
| var i; | |
| !(function (t) { | |
| "use strict"; | |
| function a(e, t) { | |
| t = t || 2; | |
| var r, | |
| i = Number(e) < 0, | |
| a = e.toString(); | |
| return ( | |
| i && (a = a.slice(1)), | |
| (r = t - a.length + 1), | |
| (i ? "-" : "") + | |
| (a = new Array(r).join("0").concat(a)) | |
| ); | |
| } | |
| void 0 === | |
| (i = function () { | |
| return a; | |
| }.call(t, r, t, e)) || (e.exports = i); | |
| })(this); | |
| }, | |
| 997: (e, t) => { | |
| "use strict"; | |
| Object.defineProperty(t, "__esModule", { value: !0 }), | |
| (t.default = void 0); | |
| var r = { debug: !1, displayMilliseconds: !0 }; | |
| (t.default = r), (e.exports = t.default); | |
| }, | |
| 537: (e, t) => { | |
| "use strict"; | |
| Object.defineProperty(t, "__esModule", { value: !0 }), | |
| (t.default = void 0); | |
| var r = function e() { | |
| !(function (e, t) { | |
| if (!(e instanceof t)) | |
| throw new TypeError( | |
| "Cannot call a class as a function" | |
| ); | |
| })(this, e); | |
| }; | |
| (r.READY = "ready"), | |
| (r.ERROR = "error"), | |
| (r.VOLUMECHANGE = "volumechange"), | |
| (r.FULLSCREENCHANGE = "fullscreenchange"), | |
| (r.TIMEUPDATE = "timeupdate"), | |
| (r.ENDED = "ended"), | |
| (r.PAUSE = "pause"), | |
| (r.FINISH = "finish"), | |
| (r.SEEK = "seek"), | |
| (r.REDRAW = "redraw"), | |
| (r.AUDIOPROCESS = "audioprocess"), | |
| (r.DEVICE_READY = "deviceReady"), | |
| (r.DEVICE_ERROR = "deviceError"), | |
| (r.AUDIO_OUTPUT_READY = "audioOutputReady"), | |
| (r.WAVE_READY = "waveReady"), | |
| (r.PLAYBACK_FINISH = "playbackFinish"), | |
| (r.ABORT = "abort"), | |
| (r.RESIZE = "resize"), | |
| Object.freeze(r); | |
| var i = r; | |
| (t.default = i), (e.exports = t.default); | |
| }, | |
| 200: (e, t) => { | |
| "use strict"; | |
| Object.defineProperty(t, "__esModule", { value: !0 }), | |
| (t.default = void 0); | |
| var r = { | |
| setSource: function (e, t) { | |
| if (this.player.usingPlugin("wavesurfer")) { | |
| var r = | |
| this.player.wavesurfer().surfer.params | |
| .backend, | |
| i = e.src, | |
| a = e.peaks; | |
| switch (r) { | |
| case "WebAudio": | |
| this.player.wavesurfer().load(i); | |
| break; | |
| default: | |
| t(null, e); | |
| var o = this.player.tech_.el(); | |
| void 0 === a | |
| ? this.player.wavesurfer().load(o) | |
| : this.player | |
| .wavesurfer() | |
| .load(o, a); | |
| } | |
| } else t(null, e); | |
| }, | |
| }; | |
| (t.default = r), (e.exports = t.default); | |
| }, | |
| 518: (e, t, r) => { | |
| "use strict"; | |
| Object.defineProperty(t, "__esModule", { value: !0 }), | |
| (t.default = void 0); | |
| var i = o(r(21)), | |
| a = o(r(455)); | |
| function o(e) { | |
| return e && e.__esModule ? e : { default: e }; | |
| } | |
| var s = 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 o = (0, a.default)(1e3 * e), | |
| s = o; | |
| void 0 !== t && (s = (0, a.default)(1e3 * t)); | |
| var n = (0, i.default)(o.hours), | |
| l = (0, i.default)(o.minutes), | |
| u = (0, i.default)(o.seconds), | |
| h = (0, i.default)(o.milliseconds, 3); | |
| if (o.days > 0 || s.days > 0) { | |
| var c = (0, i.default)(o.days); | |
| return "" | |
| .concat(c, ":") | |
| .concat(n, ":") | |
| .concat(l, ":") | |
| .concat(u); | |
| } | |
| return o.hours > 0 || s.hours > 0 | |
| ? "".concat(n, ":").concat(l, ":").concat(u) | |
| : r | |
| ? "".concat(l, ":").concat(u, ":").concat(h) | |
| : "".concat(l, ":").concat(u); | |
| }; | |
| (t.default = s), (e.exports = t.default); | |
| }, | |
| 456: (e, t, r) => { | |
| "use strict"; | |
| Object.defineProperty(t, "__esModule", { value: !0 }), | |
| (t.default = void 0); | |
| var i, | |
| a = (i = r(390)) && i.__esModule ? i : { default: i }; | |
| var o = function (e, t, r) { | |
| !0 === r && | |
| ("error" === t | |
| ? a.default.log.error(e) | |
| : "warn" === t | |
| ? a.default.log.warn(e) | |
| : a.default.log(e)); | |
| }; | |
| (t.default = o), (e.exports = t.default); | |
| }, | |
| 908: (e, t, r) => { | |
| var i; | |
| (i = | |
| "undefined" != typeof window | |
| ? window | |
| : void 0 !== r.g | |
| ? r.g | |
| : "undefined" != typeof self | |
| ? self | |
| : {}), | |
| (e.exports = i); | |
| }, | |
| 455: (e, t, r) => { | |
| "use strict"; | |
| function i(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, | |
| }; | |
| } | |
| r.r(t), r.d(t, { default: () => i }); | |
| }, | |
| 390: (t) => { | |
| "use strict"; | |
| t.exports = e; | |
| }, | |
| 410: (e) => { | |
| "use strict"; | |
| e.exports = t; | |
| }, | |
| }, | |
| i = {}; | |
| function a(e) { | |
| var t = i[e]; | |
| if (void 0 !== t) return t.exports; | |
| var o = (i[e] = { exports: {} }); | |
| return r[e].call(o.exports, o, o.exports, a), o.exports; | |
| } | |
| (a.d = (e, t) => { | |
| for (var r in t) | |
| a.o(t, r) && | |
| !a.o(e, r) && | |
| Object.defineProperty(e, r, { enumerable: !0, get: t[r] }); | |
| }), | |
| (a.g = (function () { | |
| if ("object" == typeof globalThis) return globalThis; | |
| try { | |
| return this || new Function("return this")(); | |
| } catch (e) { | |
| if ("object" == typeof window) return window; | |
| } | |
| })()), | |
| (a.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)), | |
| (a.r = (e) => { | |
| "undefined" != typeof Symbol && | |
| Symbol.toStringTag && | |
| Object.defineProperty(e, Symbol.toStringTag, { | |
| value: "Module", | |
| }), | |
| Object.defineProperty(e, "__esModule", { value: !0 }); | |
| }); | |
| var o = {}; | |
| return ( | |
| (() => { | |
| "use strict"; | |
| var e = o; | |
| function t(e) { | |
| return (t = | |
| "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); | |
| } | |
| Object.defineProperty(e, "__esModule", { value: !0 }), | |
| (e.Wavesurfer = void 0); | |
| var r = c(a(537)), | |
| i = c(a(456)), | |
| s = c(a(518)), | |
| n = c(a(997)), | |
| l = c(a(200)), | |
| u = (c(a(908)), c(a(390))), | |
| h = c(a(410)); | |
| function c(e) { | |
| return e && e.__esModule ? e : { default: e }; | |
| } | |
| function d(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); | |
| } | |
| } | |
| function f(e, t) { | |
| return (f = | |
| Object.setPrototypeOf || | |
| function (e, t) { | |
| return (e.__proto__ = t), e; | |
| })(e, t); | |
| } | |
| function p(e) { | |
| var t = (function () { | |
| if ("undefined" == typeof Reflect || !Reflect.construct) | |
| return !1; | |
| if (Reflect.construct.sham) return !1; | |
| if ("function" == typeof Proxy) return !0; | |
| try { | |
| return ( | |
| Boolean.prototype.valueOf.call( | |
| Reflect.construct( | |
| Boolean, | |
| [], | |
| function () {} | |
| ) | |
| ), | |
| !0 | |
| ); | |
| } catch (e) { | |
| return !1; | |
| } | |
| })(); | |
| return function () { | |
| var r, | |
| i = g(e); | |
| if (t) { | |
| var a = g(this).constructor; | |
| r = Reflect.construct(i, arguments, a); | |
| } else r = i.apply(this, arguments); | |
| return y(this, r); | |
| }; | |
| } | |
| function y(e, r) { | |
| return !r || ("object" !== t(r) && "function" != typeof r) | |
| ? v(e) | |
| : r; | |
| } | |
| function v(e) { | |
| if (void 0 === e) | |
| throw new ReferenceError( | |
| "this hasn't been initialised - super() hasn't been called" | |
| ); | |
| return e; | |
| } | |
| function g(e) { | |
| return (g = Object.setPrototypeOf | |
| ? Object.getPrototypeOf | |
| : function (e) { | |
| return e.__proto__ || Object.getPrototypeOf(e); | |
| })(e); | |
| } | |
| var m = u.default.getPlugin("plugin"), | |
| b = "wavesurfer", | |
| E = "vjs-wavedisplay", | |
| k = "WebAudio", | |
| w = "MediaElement", | |
| T = (function (e) { | |
| !(function (e, t) { | |
| if ("function" != typeof t && null !== t) | |
| throw new TypeError( | |
| "Super expression must either be null or a function" | |
| ); | |
| (e.prototype = Object.create(t && t.prototype, { | |
| constructor: { | |
| value: e, | |
| writable: !0, | |
| configurable: !0, | |
| }, | |
| })), | |
| t && f(e, t); | |
| })(c, e); | |
| var t, | |
| a, | |
| o, | |
| l = p(c); | |
| function c(e, t) { | |
| var i; | |
| return ( | |
| (function (e, t) { | |
| if (!(e instanceof t)) | |
| throw new TypeError( | |
| "Cannot call a class as a function" | |
| ); | |
| })(this, c), | |
| (i = l.call(this, e, t)), | |
| e.addClass("vjs-wavesurfer"), | |
| (t = u.default.mergeOptions(n.default, t)), | |
| (i.waveReady = !1), | |
| (i.waveFinished = !1), | |
| (i.liveMode = !1), | |
| (i.backend = null), | |
| (i.debug = "true" === t.debug.toString()), | |
| (i.textTracksEnabled = | |
| i.player.options_.tracks.length > 0), | |
| (i.displayMilliseconds = t.displayMilliseconds), | |
| t.formatTime && | |
| "function" == typeof t.formatTime | |
| ? i.setFormatTime(t.formatTime) | |
| : i.setFormatTime(function (e, t) { | |
| return (0, | |
| s.default)(e, t, i.displayMilliseconds); | |
| }), | |
| i.player.one( | |
| r.default.READY, | |
| i.initialize.bind(v(i)) | |
| ), | |
| i | |
| ); | |
| } | |
| return ( | |
| (t = c), | |
| (a = [ | |
| { | |
| 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 = h.default.create(t)), | |
| this.surfer.on( | |
| r.default.ERROR, | |
| this.onWaveError.bind(this) | |
| ), | |
| this.surfer.on( | |
| r.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( | |
| r.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( | |
| r.default.VOLUMECHANGE, | |
| this.onVolumeChange.bind(this) | |
| ), | |
| this.player.on( | |
| r.default.FULLSCREENCHANGE, | |
| this.onScreenChange.bind(this) | |
| ), | |
| !0 === this.player.options_.fluid && | |
| (this.surfer.drawer.wrapper.className = | |
| E); | |
| }, | |
| }, | |
| { | |
| 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 = | |
| w), | |
| e | |
| ); | |
| }, | |
| }, | |
| { | |
| key: "setupPlaybackEvents", | |
| value: function (e) { | |
| !1 === e | |
| ? (this.surfer.un( | |
| r.default.READY, | |
| this.surferReady | |
| ), | |
| this.backend === k && | |
| (this.surfer.un( | |
| r.default.AUDIOPROCESS, | |
| this.surferProgress | |
| ), | |
| this.surfer.un( | |
| r.default.SEEK, | |
| this.surferSeek | |
| ))) | |
| : !0 === e && | |
| (this.surfer.on( | |
| r.default.READY, | |
| this.surferReady | |
| ), | |
| this.backend === k && | |
| (this.surfer.on( | |
| r.default.AUDIOPROCESS, | |
| this.surferProgress | |
| ), | |
| this.surfer.on( | |
| r.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 i = this; | |
| if (Array.isArray(t)) | |
| this.log( | |
| "Loading URL with array of peaks: " + | |
| e | |
| ), | |
| this.surfer.load(e, t); | |
| else { | |
| var a = { | |
| url: t, | |
| responseType: "json", | |
| }; | |
| void 0 !== | |
| this.player.options_.plugins | |
| .wavesurfer.xhr && | |
| (a.xhr = | |
| this.player.options_.plugins.wavesurfer.xhr); | |
| var o = h.default.util.fetchFile(a); | |
| o.once("success", function (a) { | |
| i.log( | |
| "Loaded Peak Data URL: " + t | |
| ), | |
| a && a.data | |
| ? i.surfer.load( | |
| e, | |
| a.data | |
| ) | |
| : (i.player.trigger( | |
| r.default.ERROR, | |
| "Could not load peaks data from " + | |
| t | |
| ), | |
| i.log(err, "error")); | |
| }), | |
| o.once("error", function (e) { | |
| i.player.trigger( | |
| r.default.ERROR, | |
| "Unable to retrieve peak data from " + | |
| t + | |
| ". Status code: " + | |
| o.response.status | |
| ); | |
| }); | |
| } | |
| }, | |
| }, | |
| { | |
| 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( | |
| r.default | |
| .AUDIO_OUTPUT_READY | |
| ); | |
| }) | |
| .catch(function (e) { | |
| t.player.trigger( | |
| r.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 = | |
| this._formatTime( | |
| 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 = | |
| this._formatTime( | |
| 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( | |
| r.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( | |
| r.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( | |
| r.default.ENDED | |
| ), | |
| this.surfer.once( | |
| r.default.SEEK, | |
| function () { | |
| void 0 !== | |
| e.player | |
| .controlBar | |
| .playToggle && | |
| e.player.controlBar.playToggle.removeClass( | |
| "vjs-ended" | |
| ), | |
| e.player.trigger( | |
| r.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( | |
| r.default.ABORT, | |
| e | |
| ) | |
| : (this.player.trigger( | |
| r.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: "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 = | |
| E), | |
| this.surfer.drawBuffer(), | |
| this.surfer.drawer.progress( | |
| this.surfer.backend.getPlayedPercents() | |
| ); | |
| } | |
| }, | |
| }, | |
| { | |
| key: "log", | |
| value: function (e, t) { | |
| (0, i.default)(e, t, this.debug); | |
| }, | |
| }, | |
| { | |
| key: "setFormatTime", | |
| value: function (e) { | |
| (this._formatTime = e), | |
| u.default.setFormatTime( | |
| this._formatTime | |
| ); | |
| }, | |
| }, | |
| ]) && d(t.prototype, a), | |
| o && d(t, o), | |
| c | |
| ); | |
| })(m); | |
| (e.Wavesurfer = T), | |
| (T.VERSION = "3.8.0"), | |
| (u.default.Wavesurfer = T), | |
| void 0 === u.default.getPlugin(b) && | |
| u.default.registerPlugin(b, T), | |
| u.default.use("*", function (e) { | |
| return (l.default.player = e), l.default; | |
| }); | |
| })(), | |
| o | |
| ); | |
| })(); | |
| }); | |
| /*! | |
| * videojs-wavesurfer | |
| * @version 3.8.0 | |
| * @see https://github.com/collab-project/videojs-wavesurfer | |
| * @copyright 2014-2021 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)); | |
| })(self, function (e, t) { | |
| return (() => { | |
| var r = { | |
| 21: function (e, t, r) { | |
| var i; | |
| !(function (t) { | |
| "use strict"; | |
| function a(e, t) { | |
| t = t || 2; | |
| var r, | |
| i = Number(e) < 0, | |
| a = e.toString(); | |
| return ( | |
| i && (a = a.slice(1)), | |
| (r = t - a.length + 1), | |
| (i ? "-" : "") + | |
| (a = new Array(r).join("0").concat(a)) | |
| ); | |
| } | |
| void 0 === | |
| (i = function () { | |
| return a; | |
| }.call(t, r, t, e)) || (e.exports = i); | |
| })(this); | |
| }, | |
| 997: (e, t) => { | |
| "use strict"; | |
| Object.defineProperty(t, "__esModule", { value: !0 }), | |
| (t.default = void 0); | |
| var r = { debug: !1, displayMilliseconds: !0 }; | |
| (t.default = r), (e.exports = t.default); | |
| }, | |
| 537: (e, t) => { | |
| "use strict"; | |
| Object.defineProperty(t, "__esModule", { value: !0 }), | |
| (t.default = void 0); | |
| var r = function e() { | |
| !(function (e, t) { | |
| if (!(e instanceof t)) | |
| throw new TypeError( | |
| "Cannot call a class as a function" | |
| ); | |
| })(this, e); | |
| }; | |
| (r.READY = "ready"), | |
| (r.ERROR = "error"), | |
| (r.VOLUMECHANGE = "volumechange"), | |
| (r.FULLSCREENCHANGE = "fullscreenchange"), | |
| (r.TIMEUPDATE = "timeupdate"), | |
| (r.ENDED = "ended"), | |
| (r.PAUSE = "pause"), | |
| (r.FINISH = "finish"), | |
| (r.SEEK = "seek"), | |
| (r.REDRAW = "redraw"), | |
| (r.AUDIOPROCESS = "audioprocess"), | |
| (r.DEVICE_READY = "deviceReady"), | |
| (r.DEVICE_ERROR = "deviceError"), | |
| (r.AUDIO_OUTPUT_READY = "audioOutputReady"), | |
| (r.WAVE_READY = "waveReady"), | |
| (r.PLAYBACK_FINISH = "playbackFinish"), | |
| (r.ABORT = "abort"), | |
| (r.RESIZE = "resize"), | |
| Object.freeze(r); | |
| var i = r; | |
| (t.default = i), (e.exports = t.default); | |
| }, | |
| 200: (e, t) => { | |
| "use strict"; | |
| Object.defineProperty(t, "__esModule", { value: !0 }), | |
| (t.default = void 0); | |
| var r = { | |
| setSource: function (e, t) { | |
| if (this.player.usingPlugin("wavesurfer")) { | |
| var r = | |
| this.player.wavesurfer().surfer.params | |
| .backend, | |
| i = e.src, | |
| a = e.peaks; | |
| switch (r) { | |
| case "WebAudio": | |
| this.player.wavesurfer().load(i); | |
| break; | |
| default: | |
| t(null, e); | |
| var o = this.player.tech_.el(); | |
| void 0 === a | |
| ? this.player.wavesurfer().load(o) | |
| : this.player | |
| .wavesurfer() | |
| .load(o, a); | |
| } | |
| } else t(null, e); | |
| }, | |
| }; | |
| (t.default = r), (e.exports = t.default); | |
| }, | |
| 518: (e, t, r) => { | |
| "use strict"; | |
| Object.defineProperty(t, "__esModule", { value: !0 }), | |
| (t.default = void 0); | |
| var i = o(r(21)), | |
| a = o(r(455)); | |
| function o(e) { | |
| return e && e.__esModule ? e : { default: e }; | |
| } | |
| var s = 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 o = (0, a.default)(1e3 * e), | |
| s = o; | |
| void 0 !== t && (s = (0, a.default)(1e3 * t)); | |
| var n = (0, i.default)(o.hours), | |
| l = (0, i.default)(o.minutes), | |
| u = (0, i.default)(o.seconds), | |
| h = (0, i.default)(o.milliseconds, 3); | |
| if (o.days > 0 || s.days > 0) { | |
| var c = (0, i.default)(o.days); | |
| return "" | |
| .concat(c, ":") | |
| .concat(n, ":") | |
| .concat(l, ":") | |
| .concat(u); | |
| } | |
| return o.hours > 0 || s.hours > 0 | |
| ? "".concat(n, ":").concat(l, ":").concat(u) | |
| : r | |
| ? "".concat(l, ":").concat(u, ":").concat(h) | |
| : "".concat(l, ":").concat(u); | |
| }; | |
| (t.default = s), (e.exports = t.default); | |
| }, | |
| 456: (e, t, r) => { | |
| "use strict"; | |
| Object.defineProperty(t, "__esModule", { value: !0 }), | |
| (t.default = void 0); | |
| var i, | |
| a = (i = r(390)) && i.__esModule ? i : { default: i }; | |
| var o = function (e, t, r) { | |
| !0 === r && | |
| ("error" === t | |
| ? a.default.log.error(e) | |
| : "warn" === t | |
| ? a.default.log.warn(e) | |
| : a.default.log(e)); | |
| }; | |
| (t.default = o), (e.exports = t.default); | |
| }, | |
| 908: (e, t, r) => { | |
| var i; | |
| (i = | |
| "undefined" != typeof window | |
| ? window | |
| : void 0 !== r.g | |
| ? r.g | |
| : "undefined" != typeof self | |
| ? self | |
| : {}), | |
| (e.exports = i); | |
| }, | |
| 455: (e, t, r) => { | |
| "use strict"; | |
| function i(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, | |
| }; | |
| } | |
| r.r(t), r.d(t, { default: () => i }); | |
| }, | |
| 390: (t) => { | |
| "use strict"; | |
| t.exports = e; | |
| }, | |
| 410: (e) => { | |
| "use strict"; | |
| e.exports = t; | |
| }, | |
| }, | |
| i = {}; | |
| function a(e) { | |
| var t = i[e]; | |
| if (void 0 !== t) return t.exports; | |
| var o = (i[e] = { exports: {} }); | |
| return r[e].call(o.exports, o, o.exports, a), o.exports; | |
| } | |
| (a.d = (e, t) => { | |
| for (var r in t) | |
| a.o(t, r) && | |
| !a.o(e, r) && | |
| Object.defineProperty(e, r, { enumerable: !0, get: t[r] }); | |
| }), | |
| (a.g = (function () { | |
| if ("object" == typeof globalThis) return globalThis; | |
| try { | |
| return this || new Function("return this")(); | |
| } catch (e) { | |
| if ("object" == typeof window) return window; | |
| } | |
| })()), | |
| (a.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)), | |
| (a.r = (e) => { | |
| "undefined" != typeof Symbol && | |
| Symbol.toStringTag && | |
| Object.defineProperty(e, Symbol.toStringTag, { | |
| value: "Module", | |
| }), | |
| Object.defineProperty(e, "__esModule", { value: !0 }); | |
| }); | |
| var o = {}; | |
| return ( | |
| (() => { | |
| "use strict"; | |
| var e = o; | |
| function t(e) { | |
| return (t = | |
| "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); | |
| } | |
| Object.defineProperty(e, "__esModule", { value: !0 }), | |
| (e.Wavesurfer = void 0); | |
| var r = c(a(537)), | |
| i = c(a(456)), | |
| s = c(a(518)), | |
| n = c(a(997)), | |
| l = c(a(200)), | |
| u = (c(a(908)), c(a(390))), | |
| h = c(a(410)); | |
| function c(e) { | |
| return e && e.__esModule ? e : { default: e }; | |
| } | |
| function d(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); | |
| } | |
| } | |
| function f(e, t) { | |
| return (f = | |
| Object.setPrototypeOf || | |
| function (e, t) { | |
| return (e.__proto__ = t), e; | |
| })(e, t); | |
| } | |
| function p(e) { | |
| var t = (function () { | |
| if ("undefined" == typeof Reflect || !Reflect.construct) | |
| return !1; | |
| if (Reflect.construct.sham) return !1; | |
| if ("function" == typeof Proxy) return !0; | |
| try { | |
| return ( | |
| Boolean.prototype.valueOf.call( | |
| Reflect.construct( | |
| Boolean, | |
| [], | |
| function () {} | |
| ) | |
| ), | |
| !0 | |
| ); | |
| } catch (e) { | |
| return !1; | |
| } | |
| })(); | |
| return function () { | |
| var r, | |
| i = g(e); | |
| if (t) { | |
| var a = g(this).constructor; | |
| r = Reflect.construct(i, arguments, a); | |
| } else r = i.apply(this, arguments); | |
| return y(this, r); | |
| }; | |
| } | |
| function y(e, r) { | |
| return !r || ("object" !== t(r) && "function" != typeof r) | |
| ? v(e) | |
| : r; | |
| } | |
| function v(e) { | |
| if (void 0 === e) | |
| throw new ReferenceError( | |
| "this hasn't been initialised - super() hasn't been called" | |
| ); | |
| return e; | |
| } | |
| function g(e) { | |
| return (g = Object.setPrototypeOf | |
| ? Object.getPrototypeOf | |
| : function (e) { | |
| return e.__proto__ || Object.getPrototypeOf(e); | |
| })(e); | |
| } | |
| var m = u.default.getPlugin("plugin"), | |
| b = "wavesurfer", | |
| E = "vjs-wavedisplay", | |
| k = "WebAudio", | |
| w = "MediaElement", | |
| T = (function (e) { | |
| !(function (e, t) { | |
| if ("function" != typeof t && null !== t) | |
| throw new TypeError( | |
| "Super expression must either be null or a function" | |
| ); | |
| (e.prototype = Object.create(t && t.prototype, { | |
| constructor: { | |
| value: e, | |
| writable: !0, | |
| configurable: !0, | |
| }, | |
| })), | |
| t && f(e, t); | |
| })(c, e); | |
| var t, | |
| a, | |
| o, | |
| l = p(c); | |
| function c(e, t) { | |
| var i; | |
| return ( | |
| (function (e, t) { | |
| if (!(e instanceof t)) | |
| throw new TypeError( | |
| "Cannot call a class as a function" | |
| ); | |
| })(this, c), | |
| (i = l.call(this, e, t)), | |
| e.addClass("vjs-wavesurfer"), | |
| (t = u.default.mergeOptions(n.default, t)), | |
| (i.waveReady = !1), | |
| (i.waveFinished = !1), | |
| (i.liveMode = !1), | |
| (i.backend = null), | |
| (i.debug = "true" === t.debug.toString()), | |
| (i.textTracksEnabled = | |
| i.player.options_.tracks.length > 0), | |
| (i.displayMilliseconds = t.displayMilliseconds), | |
| t.formatTime && | |
| "function" == typeof t.formatTime | |
| ? i.setFormatTime(t.formatTime) | |
| : i.setFormatTime(function (e, t) { | |
| return (0, | |
| s.default)(e, t, i.displayMilliseconds); | |
| }), | |
| i.player.one( | |
| r.default.READY, | |
| i.initialize.bind(v(i)) | |
| ), | |
| i | |
| ); | |
| } | |
| return ( | |
| (t = c), | |
| (a = [ | |
| { | |
| 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 = h.default.create(t)), | |
| this.surfer.on( | |
| r.default.ERROR, | |
| this.onWaveError.bind(this) | |
| ), | |
| this.surfer.on( | |
| r.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( | |
| r.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( | |
| r.default.VOLUMECHANGE, | |
| this.onVolumeChange.bind(this) | |
| ), | |
| this.player.on( | |
| r.default.FULLSCREENCHANGE, | |
| this.onScreenChange.bind(this) | |
| ), | |
| !0 === this.player.options_.fluid && | |
| (this.surfer.drawer.wrapper.className = | |
| E); | |
| }, | |
| }, | |
| { | |
| 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 = | |
| w), | |
| e | |
| ); | |
| }, | |
| }, | |
| { | |
| key: "setupPlaybackEvents", | |
| value: function (e) { | |
| !1 === e | |
| ? (this.surfer.un( | |
| r.default.READY, | |
| this.surferReady | |
| ), | |
| this.backend === k && | |
| (this.surfer.un( | |
| r.default.AUDIOPROCESS, | |
| this.surferProgress | |
| ), | |
| this.surfer.un( | |
| r.default.SEEK, | |
| this.surferSeek | |
| ))) | |
| : !0 === e && | |
| (this.surfer.on( | |
| r.default.READY, | |
| this.surferReady | |
| ), | |
| this.backend === k && | |
| (this.surfer.on( | |
| r.default.AUDIOPROCESS, | |
| this.surferProgress | |
| ), | |
| this.surfer.on( | |
| r.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 i = this; | |
| if (Array.isArray(t)) | |
| this.log( | |
| "Loading URL with array of peaks: " + | |
| e | |
| ), | |
| this.surfer.load(e, t); | |
| else { | |
| var a = { | |
| url: t, | |
| responseType: "json", | |
| }; | |
| void 0 !== | |
| this.player.options_.plugins | |
| .wavesurfer.xhr && | |
| (a.xhr = | |
| this.player.options_.plugins.wavesurfer.xhr); | |
| var o = h.default.util.fetchFile(a); | |
| o.once("success", function (a) { | |
| i.log( | |
| "Loaded Peak Data URL: " + t | |
| ), | |
| a && a.data | |
| ? i.surfer.load( | |
| e, | |
| a.data | |
| ) | |
| : (i.player.trigger( | |
| r.default.ERROR, | |
| "Could not load peaks data from " + | |
| t | |
| ), | |
| i.log(err, "error")); | |
| }), | |
| o.once("error", function (e) { | |
| i.player.trigger( | |
| r.default.ERROR, | |
| "Unable to retrieve peak data from " + | |
| t + | |
| ". Status code: " + | |
| o.response.status | |
| ); | |
| }); | |
| } | |
| }, | |
| }, | |
| { | |
| 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( | |
| r.default | |
| .AUDIO_OUTPUT_READY | |
| ); | |
| }) | |
| .catch(function (e) { | |
| t.player.trigger( | |
| r.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 = | |
| this._formatTime( | |
| 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 = | |
| this._formatTime( | |
| 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( | |
| r.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( | |
| r.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( | |
| r.default.ENDED | |
| ), | |
| this.surfer.once( | |
| r.default.SEEK, | |
| function () { | |
| void 0 !== | |
| e.player | |
| .controlBar | |
| .playToggle && | |
| e.player.controlBar.playToggle.removeClass( | |
| "vjs-ended" | |
| ), | |
| e.player.trigger( | |
| r.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( | |
| r.default.ABORT, | |
| e | |
| ) | |
| : (this.player.trigger( | |
| r.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: "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 = | |
| E), | |
| this.surfer.drawBuffer(), | |
| this.surfer.drawer.progress( | |
| this.surfer.backend.getPlayedPercents() | |
| ); | |
| } | |
| }, | |
| }, | |
| { | |
| key: "log", | |
| value: function (e, t) { | |
| (0, i.default)(e, t, this.debug); | |
| }, | |
| }, | |
| { | |
| key: "setFormatTime", | |
| value: function (e) { | |
| (this._formatTime = e), | |
| u.default.setFormatTime( | |
| this._formatTime | |
| ); | |
| }, | |
| }, | |
| ]) && d(t.prototype, a), | |
| o && d(t, o), | |
| c | |
| ); | |
| })(m); | |
| (e.Wavesurfer = T), | |
| (T.VERSION = "3.8.0"), | |
| (u.default.Wavesurfer = T), | |
| void 0 === u.default.getPlugin(b) && | |
| u.default.registerPlugin(b, T), | |
| u.default.use("*", function (e) { | |
| return (l.default.player = e), l.default; | |
| }); | |
| })(), | |
| o | |
| ); | |
| })(); | |
| }); | |