3 lines
2.1 KiB
JavaScript
3 lines
2.1 KiB
JavaScript
/*! @name videojs-seek-buttons @version 3.0.1 @license Apache-2.0 */
|
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojsSeekButtons=t(e.videojs)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(e);function n(e,t){return n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(e,t)}var r=o.default.getComponent("Button"),i={forwardIndex:1,backIndex:1},s=function(e){var t=this;this.ready((function(){!function(e,t){e.addClass("vjs-seek-buttons"),t.forward&&t.forward>0&&(e.controlBar.seekForward=e.controlBar.addChild("seekButton",{direction:"forward",seconds:t.forward},t.forwardIndex)),t.back&&t.back>0&&(e.controlBar.seekBack=e.controlBar.addChild("seekButton",{direction:"back",seconds:t.back},t.backIndex))}(t,o.default.mergeOptions(i,e))}))};s.VERSION="3.0.1";var a=function(e){var t,o;function r(t,o){var n;return"forward"===(n=e.call(this,t,o)||this).options_.direction?n.controlText(n.localize("Seek forward {{seconds}} seconds").replace("{{seconds}}",n.options_.seconds)):"back"===n.options_.direction&&n.controlText(n.localize("Seek back {{seconds}} seconds").replace("{{seconds}}",n.options_.seconds)),n}o=e,(t=r).prototype=Object.create(o.prototype),t.prototype.constructor=t,n(t,o);var i=r.prototype;return i.buildCSSClass=function(){return"vjs-seek-button skip-"+this.options_.direction+" skip-"+this.options_.seconds+" "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(){var e=this.player_.currentTime();if("forward"===this.options_.direction){var t=this.player_.duration();this.player_.liveTracker&&this.player_.liveTracker.isLive()&&(t=this.player_.liveTracker.seekableEnd()),this.player_.currentTime(Math.min(e+this.options_.seconds,t))}else"back"===this.options_.direction&&this.player_.currentTime(Math.max(0,e-this.options_.seconds))},r}(r);return o.default.registerComponent("SeekButton",a),o.default.registerPlugin("seekButtons",s),s}));
|