mirror of https://github.com/ekimekim/wubloader
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3 lines
7.3 KiB
JavaScript
3 lines
7.3 KiB
JavaScript
5 years ago
|
/*! @name videojs-trimming-controls @version 0.0.0 @license MIT */
|
||
|
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],i):t.videojsTrimmingControls=i(t.videojs)}(this,function(t){"use strict";function i(t,i){t.prototype=Object.create(i.prototype),t.prototype.constructor=t,t.__proto__=i}var e=(t=t&&t.hasOwnProperty("default")?t.default:t).getPlugin("plugin"),n={startTrim:60,endTrim:120,limitPlayback:!1},r=function(e){function r(i,r){var o;return(o=e.call(this,i)||this).options=t.mergeOptions(n,r),o.createTrimmingControls(),i.ready(function(){setTimeout(function(){o.updateTrimTimes(o.options.startTrim,o.options.endTrim)},100),i.on("timeupdate",function(){o.options.limitPlayback&&o.player.currentTime()>=o.options.endTrim&&(o.player.currentTime(o.options.endTrim),o.player.pause())}),i.on("playing",function(){t.log("playback began!"),o.updateTrimTimes(o.options.startTrim,o.options.endTrim)})}),o}i(r,e);var o=r.prototype;return o.createTrimmingControls=function(){var e=this.player,n=t.getComponent("Component"),r=function(n){function r(){return n.call(this,e,{title:e.localize("Trimming Controls")})||this}return i(r,n),r.prototype.createEl=function(){return t.dom.createEl("div",{className:"vjs-control-bar vjs-trimming-controls",dir:"ltr"})},r}(n),o=t.getComponent("Spacer"),s=t.getComponent("Button"),a=function(t){function n(i,n,r){var o;return(o=t.call(this,e,{})||this).trimmingControls=i,o.targetPosition=n,o.controlText(r),o.el().getElementsByClassName("vjs-icon-placeholder")[0].classList+=" material-icons",o}return i(n,t),n.prototype.handleClick=function(){0==this.targetPosition?this.player().currentTime(this.trimmingControls.options.startTrim):1==this.targetPosition&&this.player().currentTime(this.trimmingControls.options.endTrim)},n}(s),l=function(t){function n(i,n,r){var o;return(o=t.call(this,e,{})||this).trimmingControls=i,o.targetPosition=n,o.controlText(r),o.el().getElementsByClassName("vjs-icon-placeholder")[0].classList+=" material-icons",o}return i(n,t),n.prototype.handleClick=function(){0==this.targetPosition?this.trimmingControls.updateTrimTimes(this.player().currentTime(),this.trimmingControls.options.endTrim):1==this.targetPosition&&this.trimmingControls.updateTrimTimes(this.trimmingControls.options.startTrim,this.player().currentTime())},n}(s),m=function(n){function r(t){var i;return(i=n.call(this,e,{})||this).updateTimeContent(t),i}i(r,n);var o=r.prototype;return o.createEl=function(){return t.dom.createEl("input",{className:"vjs-time-display"})},o.updateTimeContent=function(i){t.dom.emptyEl(this.el()),this.el().value=t.formatTime(i,600.01)},r}(n),d=function(t){function n(i,n,r){var o;return(o=t.call(this,e,{})||this).trimmingControls=i,o.targetPosition=n,o.controlText(r),o.el().getElementsByClassName("vjs-icon-placeholder")[0].classList+=" material-icons",o}return i(n,t),n.prototype.handleClick=function(){0==this.targetPosition?this.player().currentTime(this.player().currentTime()-.1):1==this.targetPosition&&this.player().currentTime(this.player().currentTime()+.1)},n}(s),c=t.getComponent("PlayToggle"),p=function(t){function n(i,n){var r;return(r=t.call(this,e,{})||this).trimmingControls=i,r.controlText(n),r.el().getElementsByClassName("vjs-icon-placeholder")[0].classList+=" material-icons",r}return i(n,t),n.prototype.handleClick=function(){this.trimmingControls.options.limitPlayback=!this.trimmingControls.options.limitPlayback,this.toggleClass("playbackLimited")},n}(s);this._trimSeekControlBar=new r;var h=e.addChild(this._trimSeekControlBar,{componentClass:"trimControlBar"},e.children().length);h.addClass("vljs-trim-seek"),h.el().innerHTML='<div id="trimBarPlaceholderContainer"><div id="trimBarPlaceholder"></div></div>',this._trimControlBar=new r,e.addChild(this._trimControlBar,{componentClass:"trimControlBar"},e.children().length).addClass("vljs-trim-buttons"),this._spacer=new o;this._trimControlBar.addChild(this._spacer,{componentClass:"spacer"},0);this._startGoToButton=new a(this,0,"Go to start of trim segment");var u=this._trimControlBar.addChild(this._startGo
|