LocalCDN-Firefox-Chrome-Brave/resources/videojs-seek-buttons/4.0.3/videojs-seek-buttons.min.jsm

3 lines
1.9 KiB
JavaScript
Raw Normal View History

/*! @name videojs-seek-buttons @version 4.0.3 @license Apache-2.0 */
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],s):(e="undefined"!=typeof globalThis?globalThis:e||self).videojsSeekButtons=s(e.videojs)}(this,(function(e){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=s(e);const o=t.default.getComponent("Button"),i={forwardIndex:1,backIndex:1},n=function(e){this.ready((()=>{((e,s)=>{e.addClass("vjs-seek-buttons"),s.forward&&s.forward>0&&(e.controlBar.seekForward=e.controlBar.addChild("seekButton",{direction:"forward",seconds:s.forward},s.forwardIndex)),s.back&&s.back>0&&(e.controlBar.seekBack=e.controlBar.addChild("seekButton",{direction:"back",seconds:s.back},s.backIndex))})(this,t.default.obj.merge(i,e))}))};n.VERSION="4.0.3";return t.default.registerComponent("SeekButton",class extends o{constructor(e,s){super(e,s),this.$(".vjs-icon-placeholder").classList.add("vjs-icon-replay"),"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 s=this.player_.duration();this.player_.liveTracker&&this.player_.liveTracker.isLive()&&(s=this.player_.liveTracker.seekableEnd()),this.player_.currentTime(Math.min(e+this.options_.seconds,s))}else"back"===this.options_.direction&&this.player_.currentTime(Math.max(0,e-this.options_.seconds))}}),t.default.registerPlugin("seekButtons",n),n}));