mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
1bd4890f44
commit
e453a5b9f7
18 changed files with 387 additions and 128 deletions
275
dashboard-ui/bower_components/hls.js/dist/hls.js
vendored
275
dashboard-ui/bower_components/hls.js/dist/hls.js
vendored
|
@ -390,6 +390,10 @@ var _errors = require('../errors');
|
|||
|
||||
var _logger = require('../utils/logger');
|
||||
|
||||
var _ewmaBandwidthEstimator = require('./ewma-bandwidth-estimator');
|
||||
|
||||
var _ewmaBandwidthEstimator2 = _interopRequireDefault(_ewmaBandwidthEstimator);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
@ -408,12 +412,13 @@ var AbrController = function (_EventHandler) {
|
|||
function AbrController(hls) {
|
||||
_classCallCheck(this, AbrController);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AbrController).call(this, hls, _events2.default.FRAG_LOADING, _events2.default.FRAG_LOAD_PROGRESS, _events2.default.FRAG_LOADED, _events2.default.ERROR));
|
||||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AbrController).call(this, hls, _events2.default.FRAG_LOADING, _events2.default.FRAG_LOADED, _events2.default.ERROR));
|
||||
|
||||
_this.lastLoadedFragLevel = 0;
|
||||
_this._autoLevelCapping = -1;
|
||||
_this._nextAutoLevel = -1;
|
||||
_this.hls = hls;
|
||||
_this.bwEstimator = new _ewmaBandwidthEstimator2.default(hls);
|
||||
_this.onCheck = _this.abandonRulesCheck.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
|
@ -432,19 +437,6 @@ var AbrController = function (_EventHandler) {
|
|||
}
|
||||
this.fragCurrent = data.frag;
|
||||
}
|
||||
}, {
|
||||
key: 'onFragLoadProgress',
|
||||
value: function onFragLoadProgress(data) {
|
||||
var stats = data.stats;
|
||||
// only update stats if first frag loading
|
||||
// if same frag is loaded multiple times, it might be in browser cache, and loaded quickly
|
||||
// and leading to wrong bw estimation
|
||||
if (stats.aborted === undefined && data.frag.loadCounter === 1) {
|
||||
this.lastfetchduration = (performance.now() - stats.trequest) / 1000;
|
||||
this.lastbw = stats.loaded * 8 / this.lastfetchduration;
|
||||
//console.log(`fetchDuration:${this.lastfetchduration},bw:${(this.lastbw/1000).toFixed(0)}/${stats.aborted}`);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'abandonRulesCheck',
|
||||
value: function abandonRulesCheck() {
|
||||
|
@ -502,6 +494,8 @@ var AbrController = function (_EventHandler) {
|
|||
nextLoadLevel = Math.max(0, nextLoadLevel);
|
||||
// force next load level in auto mode
|
||||
hls.nextLoadLevel = nextLoadLevel;
|
||||
// update bw estimate for this fragment before cancelling load (this will help reducing the bw)
|
||||
this.bwEstimator.sample(requestDelay, frag.loaded);
|
||||
// abort fragment loading ...
|
||||
_logger.logger.warn('loading too slow, abort fragment loading and switch to level ' + nextLoadLevel);
|
||||
//abort fragment loading
|
||||
|
@ -516,6 +510,14 @@ var AbrController = function (_EventHandler) {
|
|||
}, {
|
||||
key: 'onFragLoaded',
|
||||
value: function onFragLoaded(data) {
|
||||
var stats = data.stats;
|
||||
// only update stats on first frag loading
|
||||
// if same frag is loaded multiple times, it might be in browser cache, and loaded quickly
|
||||
// and leading to wrong bw estimation
|
||||
if (stats.aborted === undefined && data.frag.loadCounter === 1) {
|
||||
this.bwEstimator.sample(performance.now() - stats.trequest, stats.loaded);
|
||||
}
|
||||
|
||||
// stop monitoring bw once frag loaded
|
||||
this.clearTimer();
|
||||
// store level id after successful fragment load
|
||||
|
@ -561,13 +563,13 @@ var AbrController = function (_EventHandler) {
|
|||
}, {
|
||||
key: 'nextAutoLevel',
|
||||
get: function get() {
|
||||
var lastbw = this.lastbw,
|
||||
hls = this.hls,
|
||||
adjustedbw,
|
||||
var hls = this.hls,
|
||||
i,
|
||||
maxAutoLevel;
|
||||
if (this._autoLevelCapping === -1 && hls.levels && hls.levels.length) {
|
||||
maxAutoLevel = hls.levels.length - 1;
|
||||
maxAutoLevel,
|
||||
levels = hls.levels,
|
||||
config = hls.config;
|
||||
if (this._autoLevelCapping === -1 && levels && levels.length) {
|
||||
maxAutoLevel = levels.length - 1;
|
||||
} else {
|
||||
maxAutoLevel = this._autoLevelCapping;
|
||||
}
|
||||
|
@ -577,6 +579,8 @@ var AbrController = function (_EventHandler) {
|
|||
return Math.min(this._nextAutoLevel, maxAutoLevel);
|
||||
}
|
||||
|
||||
var avgbw = this.bwEstimator.getEstimate(),
|
||||
adjustedbw = void 0;
|
||||
// follow algorithm captured from stagefright :
|
||||
// https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/httplive/LiveSession.cpp
|
||||
// Pick the highest bandwidth stream below or equal to estimated bandwidth.
|
||||
|
@ -585,11 +589,11 @@ var AbrController = function (_EventHandler) {
|
|||
// be even more conservative (70%) to avoid overestimating and immediately
|
||||
// switching back.
|
||||
if (i <= this.lastLoadedFragLevel) {
|
||||
adjustedbw = 0.8 * lastbw;
|
||||
adjustedbw = config.abrBandWidthFactor * avgbw;
|
||||
} else {
|
||||
adjustedbw = 0.7 * lastbw;
|
||||
adjustedbw = config.abrBandWidthUpFactor * avgbw;
|
||||
}
|
||||
if (adjustedbw < hls.levels[i].bitrate) {
|
||||
if (adjustedbw < levels[i].bitrate) {
|
||||
return Math.max(0, i - 1);
|
||||
}
|
||||
}
|
||||
|
@ -605,7 +609,7 @@ var AbrController = function (_EventHandler) {
|
|||
|
||||
exports.default = AbrController;
|
||||
|
||||
},{"../errors":20,"../event-handler":21,"../events":22,"../helper/buffer-helper":23,"../utils/logger":36}],4:[function(require,module,exports){
|
||||
},{"../errors":21,"../event-handler":22,"../events":23,"../helper/buffer-helper":24,"../utils/logger":38,"./ewma-bandwidth-estimator":6}],4:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -1005,7 +1009,7 @@ var BufferController = function (_EventHandler) {
|
|||
|
||||
exports.default = BufferController;
|
||||
|
||||
},{"../errors":20,"../event-handler":21,"../events":22,"../utils/logger":36}],5:[function(require,module,exports){
|
||||
},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],5:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -1148,7 +1152,75 @@ var CapLevelController = function (_EventHandler) {
|
|||
|
||||
exports.default = CapLevelController;
|
||||
|
||||
},{"../event-handler":21,"../events":22}],6:[function(require,module,exports){
|
||||
},{"../event-handler":22,"../events":23}],6:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*
|
||||
* EWMA Bandwidth Estimator
|
||||
* - heavily inspired from shaka-player
|
||||
* Tracks bandwidth samples and estimates available bandwidth.
|
||||
* Based on the minimum of two exponentially-weighted moving averages with
|
||||
* different half-lives.
|
||||
*/
|
||||
|
||||
var _ewma = require('../utils/ewma');
|
||||
|
||||
var _ewma2 = _interopRequireDefault(_ewma);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var EwmaBandWidthEstimator = function () {
|
||||
function EwmaBandWidthEstimator(hls) {
|
||||
_classCallCheck(this, EwmaBandWidthEstimator);
|
||||
|
||||
this.hls = hls;
|
||||
this.defaultEstimate_ = 5e5; // 500kbps
|
||||
this.minWeight_ = 0.001;
|
||||
this.minDelayMs_ = 50;
|
||||
this.fast_ = new _ewma2.default(hls.config.abrEwmaFast);
|
||||
this.slow_ = new _ewma2.default(hls.config.abrEwmaSlow);
|
||||
}
|
||||
|
||||
_createClass(EwmaBandWidthEstimator, [{
|
||||
key: 'sample',
|
||||
value: function sample(durationMs, numBytes) {
|
||||
durationMs = Math.max(durationMs, this.minDelayMs_);
|
||||
var bandwidth = 8000 * numBytes / durationMs;
|
||||
//console.log('instant bw:'+ Math.round(bandwidth));
|
||||
// we weight sample using loading duration....
|
||||
var weigth = durationMs / 1000;
|
||||
this.fast_.sample(weigth, bandwidth);
|
||||
this.slow_.sample(weigth, bandwidth);
|
||||
}
|
||||
}, {
|
||||
key: 'getEstimate',
|
||||
value: function getEstimate() {
|
||||
if (this.fast_.getTotalWeight() < this.minWeight_) {
|
||||
return this.defaultEstimate_;
|
||||
}
|
||||
//console.log('slow estimate:'+ Math.round(this.slow_.getEstimate()));
|
||||
//console.log('fast estimate:'+ Math.round(this.fast_.getEstimate()));
|
||||
// Take the minimum of these two estimates. This should have the effect of
|
||||
// adapting down quickly, but up more slowly.
|
||||
return Math.min(this.fast_.getEstimate(), this.slow_.getEstimate());
|
||||
}
|
||||
}, {
|
||||
key: 'destroy',
|
||||
value: function destroy() {}
|
||||
}]);
|
||||
|
||||
return EwmaBandWidthEstimator;
|
||||
}();
|
||||
|
||||
exports.default = EwmaBandWidthEstimator;
|
||||
|
||||
},{"../utils/ewma":37}],7:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -1501,7 +1573,7 @@ var LevelController = function (_EventHandler) {
|
|||
|
||||
exports.default = LevelController;
|
||||
|
||||
},{"../errors":20,"../event-handler":21,"../events":22,"../utils/logger":36}],7:[function(require,module,exports){
|
||||
},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],8:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -2718,7 +2790,7 @@ var StreamController = function (_EventHandler) {
|
|||
|
||||
exports.default = StreamController;
|
||||
|
||||
},{"../demux/demuxer":16,"../errors":20,"../event-handler":21,"../events":22,"../helper/buffer-helper":23,"../helper/level-helper":24,"../utils/binary-search":34,"../utils/logger":36}],8:[function(require,module,exports){
|
||||
},{"../demux/demuxer":17,"../errors":21,"../event-handler":22,"../events":23,"../helper/buffer-helper":24,"../helper/level-helper":25,"../utils/binary-search":35,"../utils/logger":38}],9:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -2816,7 +2888,7 @@ var TimelineController = function (_EventHandler) {
|
|||
|
||||
exports.default = TimelineController;
|
||||
|
||||
},{"../event-handler":21,"../events":22,"../utils/cea-708-interpreter":35}],9:[function(require,module,exports){
|
||||
},{"../event-handler":22,"../events":23,"../utils/cea-708-interpreter":36}],10:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -3060,7 +3132,7 @@ var AES = function () {
|
|||
|
||||
exports.default = AES;
|
||||
|
||||
},{}],10:[function(require,module,exports){
|
||||
},{}],11:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -3246,7 +3318,7 @@ var AES128Decrypter = function () {
|
|||
|
||||
exports.default = AES128Decrypter;
|
||||
|
||||
},{"./aes":9}],11:[function(require,module,exports){
|
||||
},{"./aes":10}],12:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -3343,7 +3415,7 @@ var Decrypter = function () {
|
|||
|
||||
exports.default = Decrypter;
|
||||
|
||||
},{"../errors":20,"../utils/logger":36,"./aes128-decrypter":10}],12:[function(require,module,exports){
|
||||
},{"../errors":21,"../utils/logger":38,"./aes128-decrypter":11}],13:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -3471,7 +3543,7 @@ var AACDemuxer = function () {
|
|||
|
||||
exports.default = AACDemuxer;
|
||||
|
||||
},{"../demux/id3":18,"../utils/logger":36,"./adts":13}],13:[function(require,module,exports){
|
||||
},{"../demux/id3":19,"../utils/logger":38,"./adts":14}],14:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -3618,7 +3690,7 @@ var ADTS = function () {
|
|||
|
||||
exports.default = ADTS;
|
||||
|
||||
},{"../errors":20,"../utils/logger":36}],14:[function(require,module,exports){
|
||||
},{"../errors":21,"../utils/logger":38}],15:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -3701,7 +3773,7 @@ var DemuxerInline = function () {
|
|||
|
||||
exports.default = DemuxerInline;
|
||||
|
||||
},{"../demux/aacdemuxer":12,"../demux/tsdemuxer":19,"../errors":20,"../events":22,"../remux/mp4-remuxer":31,"../remux/passthrough-remuxer":32}],15:[function(require,module,exports){
|
||||
},{"../demux/aacdemuxer":13,"../demux/tsdemuxer":20,"../errors":21,"../events":23,"../remux/mp4-remuxer":32,"../remux/passthrough-remuxer":33}],16:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -3790,7 +3862,7 @@ var DemuxerWorker = function DemuxerWorker(self) {
|
|||
|
||||
exports.default = DemuxerWorker;
|
||||
|
||||
},{"../demux/demuxer-inline":14,"../events":22,"events":1}],16:[function(require,module,exports){
|
||||
},{"../demux/demuxer-inline":15,"../events":23,"events":1}],17:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -3936,7 +4008,7 @@ var Demuxer = function () {
|
|||
|
||||
exports.default = Demuxer;
|
||||
|
||||
},{"../crypt/decrypter":11,"../demux/demuxer-inline":14,"../demux/demuxer-worker":15,"../events":22,"../utils/logger":36,"webworkify":2}],17:[function(require,module,exports){
|
||||
},{"../crypt/decrypter":12,"../demux/demuxer-inline":15,"../demux/demuxer-worker":16,"../events":23,"../utils/logger":38,"webworkify":2}],18:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -4300,7 +4372,7 @@ var ExpGolomb = function () {
|
|||
|
||||
exports.default = ExpGolomb;
|
||||
|
||||
},{"../utils/logger":36}],18:[function(require,module,exports){
|
||||
},{"../utils/logger":38}],19:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -4453,7 +4525,7 @@ var ID3 = function () {
|
|||
|
||||
exports.default = ID3;
|
||||
|
||||
},{"../utils/logger":36}],19:[function(require,module,exports){
|
||||
},{"../utils/logger":38}],20:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -4515,6 +4587,8 @@ var TSDemuxer = function () {
|
|||
this._aacTrack = { container: 'video/mp2t', type: 'audio', id: -1, sequenceNumber: 0, samples: [], len: 0 };
|
||||
this._id3Track = { type: 'id3', id: -1, sequenceNumber: 0, samples: [], len: 0 };
|
||||
this._txtTrack = { type: 'text', id: -1, sequenceNumber: 0, samples: [], len: 0 };
|
||||
// flush any partial content
|
||||
this.aacOverFlow = null;
|
||||
this.remuxer.switchLevel();
|
||||
}
|
||||
}, {
|
||||
|
@ -4550,7 +4624,8 @@ var TSDemuxer = function () {
|
|||
_logger.logger.log('discontinuity detected');
|
||||
this.insertDiscontinuity();
|
||||
this.lastCC = cc;
|
||||
} else if (level !== this.lastLevel) {
|
||||
}
|
||||
if (level !== this.lastLevel) {
|
||||
_logger.logger.log('level switch detected');
|
||||
this.switchLevel();
|
||||
this.lastLevel = level;
|
||||
|
@ -4559,11 +4634,6 @@ var TSDemuxer = function () {
|
|||
}
|
||||
this.lastSN = sn;
|
||||
|
||||
if (!this.contiguous) {
|
||||
// flush any partial content
|
||||
this.aacOverFlow = null;
|
||||
}
|
||||
|
||||
var pmtParsed = this.pmtParsed,
|
||||
avcId = this._avcTrack.id,
|
||||
aacId = this._aacTrack.id,
|
||||
|
@ -5193,7 +5263,7 @@ var TSDemuxer = function () {
|
|||
|
||||
exports.default = TSDemuxer;
|
||||
|
||||
},{"../errors":20,"../events":22,"../utils/logger":36,"./adts":13,"./exp-golomb":17}],20:[function(require,module,exports){
|
||||
},{"../errors":21,"../events":23,"../utils/logger":38,"./adts":14,"./exp-golomb":18}],21:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -5251,7 +5321,7 @@ var ErrorDetails = exports.ErrorDetails = {
|
|||
INTERNAL_EXCEPTION: 'internalException'
|
||||
};
|
||||
|
||||
},{}],21:[function(require,module,exports){
|
||||
},{}],22:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -5360,7 +5430,7 @@ var EventHandler = function () {
|
|||
|
||||
exports.default = EventHandler;
|
||||
|
||||
},{"./errors":20,"./events":22,"./utils/logger":36}],22:[function(require,module,exports){
|
||||
},{"./errors":21,"./events":23,"./utils/logger":38}],23:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
|
@ -5436,7 +5506,7 @@ module.exports = {
|
|||
KEY_LOADED: 'hlsKeyLoaded'
|
||||
};
|
||||
|
||||
},{}],23:[function(require,module,exports){
|
||||
},{}],24:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -5539,7 +5609,7 @@ var BufferHelper = function () {
|
|||
|
||||
exports.default = BufferHelper;
|
||||
|
||||
},{}],24:[function(require,module,exports){
|
||||
},{}],25:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -5687,7 +5757,7 @@ var LevelHelper = function () {
|
|||
|
||||
exports.default = LevelHelper;
|
||||
|
||||
},{"../utils/logger":36}],25:[function(require,module,exports){
|
||||
},{"../utils/logger":38}],26:[function(require,module,exports){
|
||||
/**
|
||||
* HLS interface
|
||||
*/
|
||||
|
@ -5823,7 +5893,11 @@ var Hls = function () {
|
|||
streamController: _streamController2.default,
|
||||
timelineController: _timelineController2.default,
|
||||
enableCEA708Captions: true,
|
||||
enableMP2TPassThrough: false
|
||||
enableMP2TPassThrough: false,
|
||||
abrEwmaFast: 0,
|
||||
abrEwmaSlow: 0,
|
||||
abrBandWidthFactor: 0.8,
|
||||
abrBandWidthUpFactor: 0.7
|
||||
};
|
||||
}
|
||||
return Hls.defaultConfig;
|
||||
|
@ -6109,7 +6183,7 @@ var Hls = function () {
|
|||
|
||||
exports.default = Hls;
|
||||
|
||||
},{"./controller/abr-controller":3,"./controller/buffer-controller":4,"./controller/cap-level-controller":5,"./controller/level-controller":6,"./controller/stream-controller":7,"./controller/timeline-controller":8,"./errors":20,"./events":22,"./loader/fragment-loader":27,"./loader/key-loader":28,"./loader/playlist-loader":29,"./utils/logger":36,"./utils/xhr-loader":38,"events":1}],26:[function(require,module,exports){
|
||||
},{"./controller/abr-controller":3,"./controller/buffer-controller":4,"./controller/cap-level-controller":5,"./controller/level-controller":7,"./controller/stream-controller":8,"./controller/timeline-controller":9,"./errors":21,"./events":23,"./loader/fragment-loader":28,"./loader/key-loader":29,"./loader/playlist-loader":30,"./utils/logger":38,"./utils/xhr-loader":40,"events":1}],27:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
// This is mostly for support of the es6 module export
|
||||
|
@ -6117,7 +6191,7 @@ exports.default = Hls;
|
|||
// function exports like we are used to in node/commonjs
|
||||
module.exports = require('./hls.js').default;
|
||||
|
||||
},{"./hls.js":25}],27:[function(require,module,exports){
|
||||
},{"./hls.js":26}],28:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -6212,7 +6286,7 @@ var FragmentLoader = function (_EventHandler) {
|
|||
|
||||
exports.default = FragmentLoader;
|
||||
|
||||
},{"../errors":20,"../event-handler":21,"../events":22}],28:[function(require,module,exports){
|
||||
},{"../errors":21,"../event-handler":22,"../events":23}],29:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -6317,7 +6391,7 @@ var KeyLoader = function (_EventHandler) {
|
|||
|
||||
exports.default = KeyLoader;
|
||||
|
||||
},{"../errors":20,"../event-handler":21,"../events":22}],29:[function(require,module,exports){
|
||||
},{"../errors":21,"../event-handler":22,"../events":23}],30:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -6497,7 +6571,7 @@ var PlaylistLoader = function (_EventHandler) {
|
|||
byteRangeEndOffset,
|
||||
byteRangeStartOffset;
|
||||
|
||||
regexp = /(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.*))|(?:#EXT(INF):([\d\.]+)[^\r\n]*([\r\n]+[^#|\r\n]+)?)|(?:#EXT-X-(BYTERANGE):([\d]+[@[\d]*)]*[\r\n]+([^#|\r\n]+)?|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.*))/g;
|
||||
regexp = /(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.*))|(?:#EXT(INF):([\d\.]+)[^\r\n]*([\r\n]+[^#|\r\n]+)?)|(?:#EXT-X-(BYTERANGE):([\d]+[@[\d]*)]*[\r\n]+([^#|\r\n]+)?|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.*)[\r\n]+([^#|\r\n]+)?)/g;
|
||||
while ((result = regexp.exec(string)) !== null) {
|
||||
result.shift();
|
||||
result = result.filter(function (n) {
|
||||
|
@ -6574,6 +6648,10 @@ var PlaylistLoader = function (_EventHandler) {
|
|||
break;
|
||||
case 'PROGRAM-DATE-TIME':
|
||||
programDateTime = new Date(Date.parse(result[1]));
|
||||
if (frag && !frag.url && result.length >= 3) {
|
||||
frag.url = this.resolve(result[2], baseurl);
|
||||
frag.programDateTime = programDateTime;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -6673,7 +6751,7 @@ var PlaylistLoader = function (_EventHandler) {
|
|||
|
||||
exports.default = PlaylistLoader;
|
||||
|
||||
},{"../errors":20,"../event-handler":21,"../events":22,"../utils/attr-list":33,"../utils/url":37}],30:[function(require,module,exports){
|
||||
},{"../errors":21,"../event-handler":22,"../events":23,"../utils/attr-list":34,"../utils/url":39}],31:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -7182,7 +7260,7 @@ var MP4 = function () {
|
|||
|
||||
exports.default = MP4;
|
||||
|
||||
},{}],31:[function(require,module,exports){
|
||||
},{}],32:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -7226,7 +7304,7 @@ var MP4Remuxer = function () {
|
|||
}, {
|
||||
key: 'insertDiscontinuity',
|
||||
value: function insertDiscontinuity() {
|
||||
this._initPTS = this._initDTS = this.nextAacPts = this.nextAvcDts = undefined;
|
||||
this._initPTS = this._initDTS = undefined;
|
||||
}
|
||||
}, {
|
||||
key: 'switchLevel',
|
||||
|
@ -7526,7 +7604,7 @@ var MP4Remuxer = function () {
|
|||
}
|
||||
// always adjust sample duration to avoid av sync issue
|
||||
mp4Sample.duration = expectedSampleDuration;
|
||||
dtsnorm = expectedSampleDuration * pes2mp4ScaleFactor + lastDTS;
|
||||
ptsnorm = dtsnorm = expectedSampleDuration * pes2mp4ScaleFactor + lastDTS;
|
||||
} else {
|
||||
var nextAacPts = void 0,
|
||||
delta = void 0;
|
||||
|
@ -7696,7 +7774,7 @@ var MP4Remuxer = function () {
|
|||
|
||||
exports.default = MP4Remuxer;
|
||||
|
||||
},{"../errors":20,"../events":22,"../remux/mp4-generator":30,"../utils/logger":36}],32:[function(require,module,exports){
|
||||
},{"../errors":21,"../events":23,"../remux/mp4-generator":31,"../utils/logger":38}],33:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -7791,7 +7869,7 @@ var PassThroughRemuxer = function () {
|
|||
|
||||
exports.default = PassThroughRemuxer;
|
||||
|
||||
},{"../events":22}],33:[function(require,module,exports){
|
||||
},{"../events":23}],34:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -7898,7 +7976,7 @@ var AttrList = function () {
|
|||
|
||||
exports.default = AttrList;
|
||||
|
||||
},{}],34:[function(require,module,exports){
|
||||
},{}],35:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
var BinarySearch = {
|
||||
|
@ -7943,7 +8021,7 @@ var BinarySearch = {
|
|||
|
||||
module.exports = BinarySearch;
|
||||
|
||||
},{}],35:[function(require,module,exports){
|
||||
},{}],36:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -8363,7 +8441,66 @@ var CEA708Interpreter = function () {
|
|||
|
||||
exports.default = CEA708Interpreter;
|
||||
|
||||
},{}],36:[function(require,module,exports){
|
||||
},{}],37:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/*
|
||||
* compute an Exponential Weighted moving average
|
||||
* - https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average
|
||||
* - heavily inspired from shaka-player
|
||||
*/
|
||||
|
||||
var EWMA = function () {
|
||||
|
||||
// About half of the estimated value will be from the last |halfLife| samples by weight.
|
||||
|
||||
function EWMA(halfLife) {
|
||||
_classCallCheck(this, EWMA);
|
||||
|
||||
// Larger values of alpha expire historical data more slowly.
|
||||
this.alpha_ = halfLife ? Math.exp(Math.log(0.5) / halfLife) : 0;
|
||||
this.estimate_ = 0;
|
||||
this.totalWeight_ = 0;
|
||||
}
|
||||
|
||||
_createClass(EWMA, [{
|
||||
key: "sample",
|
||||
value: function sample(weight, value) {
|
||||
var adjAlpha = Math.pow(this.alpha_, weight);
|
||||
this.estimate_ = value * (1 - adjAlpha) + adjAlpha * this.estimate_;
|
||||
this.totalWeight_ += weight;
|
||||
}
|
||||
}, {
|
||||
key: "getTotalWeight",
|
||||
value: function getTotalWeight() {
|
||||
return this.totalWeight_;
|
||||
}
|
||||
}, {
|
||||
key: "getEstimate",
|
||||
value: function getEstimate() {
|
||||
if (this.alpha_) {
|
||||
var zeroFactor = 1 - Math.pow(this.alpha_, this.totalWeight_);
|
||||
return this.estimate_ / zeroFactor;
|
||||
} else {
|
||||
return this.estimate_;
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return EWMA;
|
||||
}();
|
||||
|
||||
exports.default = EWMA;
|
||||
|
||||
},{}],38:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -8446,7 +8583,7 @@ var enableLogs = exports.enableLogs = function enableLogs(debugConfig) {
|
|||
|
||||
var logger = exports.logger = exportedLogger;
|
||||
|
||||
},{}],37:[function(require,module,exports){
|
||||
},{}],39:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var URLHelper = {
|
||||
|
@ -8534,7 +8671,7 @@ var URLHelper = {
|
|||
|
||||
module.exports = URLHelper;
|
||||
|
||||
},{}],38:[function(require,module,exports){
|
||||
},{}],40:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -8680,6 +8817,6 @@ var XhrLoader = function () {
|
|||
|
||||
exports.default = XhrLoader;
|
||||
|
||||
},{"../utils/logger":36}]},{},[26])(26)
|
||||
},{"../utils/logger":38}]},{},[27])(27)
|
||||
});
|
||||
//# sourceMappingURL=hls.js.map
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue