-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideojs-offset-v1.js
3 lines (2 loc) · 1.39 KB
/
videojs-offset-v1.js
1
2
3
/*! videojs-offset 31-05-2016 */
(function(){"use strict";var a=function(a){var b;return this._offsetStart=a.start||0,this._offsetEnd=a.end||0,this._restartBeginning=a.restart_beginning||!1,b=this.constructor,b.__super__&&b.__super__.__offsetInit||(b.__super__={__offsetInit:!0,duration:b.prototype.duration,currentTime:b.prototype.currentTime,bufferedPercent:b.prototype.bufferedPercent,remainingTime:b.prototype.remainingTime},b.prototype.duration=function(){return this._offsetEnd>0?this._offsetEnd-this._offsetStart:b.__super__.duration.apply(this,arguments)-this._offsetStart},b.prototype.currentTime=function(a){return void 0!==a?b.__super__.currentTime.call(this,a+this._offsetStart)-this._offsetStart:b.__super__.currentTime.apply(this,arguments)-this._offsetStart},b.prototype.remainingTime=function(){var a=this.currentTime();return a<this._offsetStart&&(a=0),this.duration()-a},b.prototype.startOffset=function(){return this._offsetStart},b.prototype.endOffset=function(){return this._offsetEnd>0?this._offsetEnd:this.duration()}),this.on("timeupdate",function(){var a=this.currentTime();0>a&&(this.currentTime(0),this.play()),this._offsetEnd>0&&a>this._offsetEnd-this._offsetStart&&(this.pause(),this._restartBeginning?(this.trigger("loadstart"),this.currentTime(0)):this.currentTime(this._offsetEnd-this._offsetStart))}),this};a.VERSION="1.0.1",window.vjsoffset=a,window.videojs.plugin("offset",a)}).call(this);