3 lines
1.8 KiB
JavaScript
3 lines
1.8 KiB
JavaScript
/*! @name videojs-seek-buttons @version 4.0.2 @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);const s=o.default.getComponent("Button"),i={forwardIndex:1,backIndex:1},n=function(e){this.ready((()=>{((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))})(this,o.default.obj.merge(i,e))}))};n.VERSION="4.0.2";return o.default.registerComponent("SeekButton",class extends s{constructor(e,t){super(e,t),"forward"===this.options_.direction?this.controlText(this.localize("Seek forward {{seconds}} seconds").replace("{{seconds}}",this.options_.seconds)):"back"===this.options_.direction&&this.controlText(this.localize("Seek back {{seconds}} seconds").replace("{{seconds}}",this.options_.seconds))}buildCSSClass(){return`vjs-seek-button skip-${this.options_.direction} skip-${this.options_.seconds} ${super.buildCSSClass()}`}handleClick(){const e=this.player_.currentTime();if("forward"===this.options_.direction){let 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))}}),o.default.registerPlugin("seekButtons",n),n}));
|