@clappr/hlsjs-playback 1.8.2 → 1.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35487,7 +35487,7 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
35487
35487
  key: "supportedVersion",
35488
35488
  get: function get() {
35489
35489
  return {
35490
- min: "0.11.5"
35490
+ min: "0.13.0"
35491
35491
  };
35492
35492
  }
35493
35493
  }, {
@@ -35498,12 +35498,20 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
35498
35498
  }, {
35499
35499
  key: "currentLevel",
35500
35500
  get: function get() {
35501
- if (this._currentLevel === null || this._currentLevel === undefined) return AUTO;else return this._currentLevel; //0 is a valid level ID
35501
+ if (this._currentLevel === null || this._currentLevel === undefined) {
35502
+ return AUTO;
35503
+ } else {
35504
+ return this._currentLevel;
35505
+ } // 0 is a valid level ID
35502
35506
  },
35503
35507
  set: function set(id) {
35504
35508
  this._currentLevel = id;
35505
35509
  this.trigger(Events$1.PLAYBACK_LEVEL_SWITCH_START);
35506
- if (this.options.playback.hlsUseNextLevel) this._hls.nextLevel = this._currentLevel;else this._hls.currentLevel = this._currentLevel;
35510
+ if (this.options.playback.hlsUseNextLevel) {
35511
+ this._hls.nextLevel = this._currentLevel;
35512
+ } else {
35513
+ this._hls.currentLevel = this._currentLevel;
35514
+ }
35507
35515
  }
35508
35516
  }, {
35509
35517
  key: "isReady",
@@ -35528,7 +35536,9 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
35528
35536
  }, {
35529
35537
  key: "_startTime",
35530
35538
  get: function get() {
35531
- if (this._playbackType === Playback.LIVE && this._playlistType !== 'EVENT') return this._extrapolatedStartTime;
35539
+ if (this._playbackType === Playback.LIVE && this._playlistType !== 'EVENT') {
35540
+ return this._extrapolatedStartTime;
35541
+ }
35532
35542
  return this._playableRegionStartTime;
35533
35543
  }
35534
35544
  }, {
@@ -35542,7 +35552,9 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
35542
35552
  }, {
35543
35553
  key: "_extrapolatedStartTime",
35544
35554
  get: function get() {
35545
- if (!this._localStartTimeCorrelation) return this._playableRegionStartTime;
35555
+ if (!this._localStartTimeCorrelation) {
35556
+ return this._playableRegionStartTime;
35557
+ }
35546
35558
  var corr = this._localStartTimeCorrelation;
35547
35559
  var timePassed = this._now - corr.local;
35548
35560
  var extrapolatedWindowStartTime = (corr.remote + timePassed) / 1000;
@@ -35588,7 +35600,9 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
35588
35600
  }, {
35589
35601
  key: "_extrapolatedWindowDuration",
35590
35602
  get: function get() {
35591
- if (this._segmentTargetDuration === null) return 0;
35603
+ if (this._segmentTargetDuration === null) {
35604
+ return 0;
35605
+ }
35592
35606
  return this._extrapolatedWindowNumSegments * this._segmentTargetDuration;
35593
35607
  }
35594
35608
  }, {
@@ -35709,7 +35723,7 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
35709
35723
  _this2.options.hlsPlayback.preload && _this2._hls.loadSource(_this2.options.src);
35710
35724
  });
35711
35725
  this._hls.on(Hls.Events.MANIFEST_LOADING, function () {
35712
- return _this2._manifestLoading = true;
35726
+ _this2._manifestLoading = true;
35713
35727
  });
35714
35728
  this._hls.on(Hls.Events.LEVEL_LOADED, function (evt, data) {
35715
35729
  return _this2._updatePlaybackType(evt, data);
@@ -35885,7 +35899,13 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
35885
35899
  }, {
35886
35900
  key: "_updateSettings",
35887
35901
  value: function _updateSettings() {
35888
- if (this._playbackType === Playback.VOD) this.settings.left = ['playpause', 'position', 'duration'];else if (this.dvrEnabled) this.settings.left = ['playpause'];else this.settings.left = ['playstop'];
35902
+ if (this._playbackType === Playback.VOD) {
35903
+ this.settings.left = ['playpause', 'position', 'duration'];
35904
+ } else if (this.dvrEnabled) {
35905
+ this.settings.left = ['playpause'];
35906
+ } else {
35907
+ this.settings.left = ['playstop'];
35908
+ }
35889
35909
  this.settings.seekEnabled = this.isSeekEnabled();
35890
35910
  this.trigger(Events$1.PLAYBACK_SETTINGSUPDATE);
35891
35911
  }
@@ -36032,7 +36052,9 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
36032
36052
  start: Math.max(0, this.el.buffered.start(i) - this._playableRegionStartTime),
36033
36053
  end: Math.max(0, this.el.buffered.end(i) - this._playableRegionStartTime)
36034
36054
  }]);
36035
- if (this.el.currentTime >= buffered[i].start && this.el.currentTime <= buffered[i].end) bufferedPos = i;
36055
+ if (this.el.currentTime >= buffered[i].start && this.el.currentTime <= buffered[i].end) {
36056
+ bufferedPos = i;
36057
+ }
36036
36058
  }
36037
36059
  var progress = {
36038
36060
  start: buffered[bufferedPos].start,
@@ -36082,7 +36104,9 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
36082
36104
  this._playbackType = data.details.live ? Playback.LIVE : Playback.VOD;
36083
36105
  this._onLevelUpdated(evt, data);
36084
36106
  // Live stream subtitle tracks detection hack (may not immediately available)
36085
- if (this._ccTracksUpdated && this._playbackType === Playback.LIVE && this.hasClosedCaptionsTracks) this._onSubtitleLoaded();
36107
+ if (this._ccTracksUpdated && this._playbackType === Playback.LIVE && this.hasClosedCaptionsTracks) {
36108
+ this._onSubtitleLoaded();
36109
+ }
36086
36110
  }
36087
36111
  }, {
36088
36112
  key: "_fillLevels",
@@ -36108,7 +36132,9 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
36108
36132
  var previousPlayableRegionDuration = this._playableRegionDuration;
36109
36133
  if (fragments.length === 0) return;
36110
36134
  // #EXT-X-PROGRAM-DATE-TIME
36111
- if (fragments[0].rawProgramDateTime) this._programDateTime = fragments[0].rawProgramDateTime;
36135
+ if (fragments[0].rawProgramDateTime) {
36136
+ this._programDateTime = fragments[0].rawProgramDateTime;
36137
+ }
36112
36138
  if (this._playableRegionStartTime !== fragments[0].start) {
36113
36139
  startTimeChanged = true;
36114
36140
  this._playableRegionStartTime = fragments[0].start;
@@ -182,7 +182,7 @@
182
182
  key: "supportedVersion",
183
183
  get: function get() {
184
184
  return {
185
- min: "0.11.5"
185
+ min: "0.13.0"
186
186
  };
187
187
  }
188
188
  }, {
@@ -193,12 +193,20 @@
193
193
  }, {
194
194
  key: "currentLevel",
195
195
  get: function get() {
196
- if (this._currentLevel === null || this._currentLevel === undefined) return AUTO;else return this._currentLevel; //0 is a valid level ID
196
+ if (this._currentLevel === null || this._currentLevel === undefined) {
197
+ return AUTO;
198
+ } else {
199
+ return this._currentLevel;
200
+ } // 0 is a valid level ID
197
201
  },
198
202
  set: function set(id) {
199
203
  this._currentLevel = id;
200
204
  this.trigger(core.Events.PLAYBACK_LEVEL_SWITCH_START);
201
- if (this.options.playback.hlsUseNextLevel) this._hls.nextLevel = this._currentLevel;else this._hls.currentLevel = this._currentLevel;
205
+ if (this.options.playback.hlsUseNextLevel) {
206
+ this._hls.nextLevel = this._currentLevel;
207
+ } else {
208
+ this._hls.currentLevel = this._currentLevel;
209
+ }
202
210
  }
203
211
  }, {
204
212
  key: "isReady",
@@ -223,7 +231,9 @@
223
231
  }, {
224
232
  key: "_startTime",
225
233
  get: function get() {
226
- if (this._playbackType === core.Playback.LIVE && this._playlistType !== 'EVENT') return this._extrapolatedStartTime;
234
+ if (this._playbackType === core.Playback.LIVE && this._playlistType !== 'EVENT') {
235
+ return this._extrapolatedStartTime;
236
+ }
227
237
  return this._playableRegionStartTime;
228
238
  }
229
239
  }, {
@@ -237,7 +247,9 @@
237
247
  }, {
238
248
  key: "_extrapolatedStartTime",
239
249
  get: function get() {
240
- if (!this._localStartTimeCorrelation) return this._playableRegionStartTime;
250
+ if (!this._localStartTimeCorrelation) {
251
+ return this._playableRegionStartTime;
252
+ }
241
253
  var corr = this._localStartTimeCorrelation;
242
254
  var timePassed = this._now - corr.local;
243
255
  var extrapolatedWindowStartTime = (corr.remote + timePassed) / 1000;
@@ -283,7 +295,9 @@
283
295
  }, {
284
296
  key: "_extrapolatedWindowDuration",
285
297
  get: function get() {
286
- if (this._segmentTargetDuration === null) return 0;
298
+ if (this._segmentTargetDuration === null) {
299
+ return 0;
300
+ }
287
301
  return this._extrapolatedWindowNumSegments * this._segmentTargetDuration;
288
302
  }
289
303
  }, {
@@ -404,7 +418,7 @@
404
418
  _this2.options.hlsPlayback.preload && _this2._hls.loadSource(_this2.options.src);
405
419
  });
406
420
  this._hls.on(HLSJS__default["default"].Events.MANIFEST_LOADING, function () {
407
- return _this2._manifestLoading = true;
421
+ _this2._manifestLoading = true;
408
422
  });
409
423
  this._hls.on(HLSJS__default["default"].Events.LEVEL_LOADED, function (evt, data) {
410
424
  return _this2._updatePlaybackType(evt, data);
@@ -580,7 +594,13 @@
580
594
  }, {
581
595
  key: "_updateSettings",
582
596
  value: function _updateSettings() {
583
- if (this._playbackType === core.Playback.VOD) this.settings.left = ['playpause', 'position', 'duration'];else if (this.dvrEnabled) this.settings.left = ['playpause'];else this.settings.left = ['playstop'];
597
+ if (this._playbackType === core.Playback.VOD) {
598
+ this.settings.left = ['playpause', 'position', 'duration'];
599
+ } else if (this.dvrEnabled) {
600
+ this.settings.left = ['playpause'];
601
+ } else {
602
+ this.settings.left = ['playstop'];
603
+ }
584
604
  this.settings.seekEnabled = this.isSeekEnabled();
585
605
  this.trigger(core.Events.PLAYBACK_SETTINGSUPDATE);
586
606
  }
@@ -727,7 +747,9 @@
727
747
  start: Math.max(0, this.el.buffered.start(i) - this._playableRegionStartTime),
728
748
  end: Math.max(0, this.el.buffered.end(i) - this._playableRegionStartTime)
729
749
  }]);
730
- if (this.el.currentTime >= buffered[i].start && this.el.currentTime <= buffered[i].end) bufferedPos = i;
750
+ if (this.el.currentTime >= buffered[i].start && this.el.currentTime <= buffered[i].end) {
751
+ bufferedPos = i;
752
+ }
731
753
  }
732
754
  var progress = {
733
755
  start: buffered[bufferedPos].start,
@@ -777,7 +799,9 @@
777
799
  this._playbackType = data.details.live ? core.Playback.LIVE : core.Playback.VOD;
778
800
  this._onLevelUpdated(evt, data);
779
801
  // Live stream subtitle tracks detection hack (may not immediately available)
780
- if (this._ccTracksUpdated && this._playbackType === core.Playback.LIVE && this.hasClosedCaptionsTracks) this._onSubtitleLoaded();
802
+ if (this._ccTracksUpdated && this._playbackType === core.Playback.LIVE && this.hasClosedCaptionsTracks) {
803
+ this._onSubtitleLoaded();
804
+ }
781
805
  }
782
806
  }, {
783
807
  key: "_fillLevels",
@@ -803,7 +827,9 @@
803
827
  var previousPlayableRegionDuration = this._playableRegionDuration;
804
828
  if (fragments.length === 0) return;
805
829
  // #EXT-X-PROGRAM-DATE-TIME
806
- if (fragments[0].rawProgramDateTime) this._programDateTime = fragments[0].rawProgramDateTime;
830
+ if (fragments[0].rawProgramDateTime) {
831
+ this._programDateTime = fragments[0].rawProgramDateTime;
832
+ }
807
833
  if (this._playableRegionStartTime !== fragments[0].start) {
808
834
  startTimeChanged = true;
809
835
  this._playableRegionStartTime = fragments[0].start;
@@ -1,2 +1,2 @@
1
- var HlsjsPlayback=function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=e(Hls);function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function n(t,e,r){return e=l(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,u()?Reflect.construct(e,r||[],l(t).constructor):e.apply(t,r))}function a(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,p(i.key),i)}}function o(t,e,r){return(e=p(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function s(){return s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var i=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}(t,e);if(i){var n=Object.getOwnPropertyDescriptor(i,e);return n.get?n.get.call(arguments.length<3?t:r):n.value}},s.apply(null,arguments)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(u=function(){return!!t})()}function h(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function _(t,e){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_(t,e)}function d(t,e,r,i){var n=s(l(1&i?t.prototype:t),e,r);return 2&i&&"function"==typeof n?function(t){return n.apply(r,t)}:n}function f(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}var y=t.Utils.now,v=t.Utils.listContainsIgnoreCase;t.Events.register("PLAYBACK_FRAGMENT_CHANGED"),t.Events.register("PLAYBACK_FRAGMENT_PARSING_METADATA");var m=function(e){function i(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return(t=n(this,i,[].concat(r))).options.hlsPlayback=c(c({},t.defaultOptions),t.options.hlsPlayback),t._timeUpdateThrottleDelay=200,t._timeUpdateFiringRate=.2,t._durationChangeMinOffset=.5,t._setInitialState(),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_(t,e)}(i,e),o=i,l=[{key:"HLSJS",get:function(){return r.default}}],(s=[{key:"name",get:function(){return"hls"}},{key:"supportedVersion",get:function(){return{min:"0.11.5"}}},{key:"levels",get:function(){return this._levels||[]}},{key:"currentLevel",get:function(){return null===this._currentLevel||void 0===this._currentLevel?-1:this._currentLevel},set:function(e){this._currentLevel=e,this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH_START),this.options.playback.hlsUseNextLevel?this._hls.nextLevel=this._currentLevel:this._hls.currentLevel=this._currentLevel}},{key:"isReady",get:function(){return this._isReadyState}},{key:"latency",get:function(){return this._hls.latency}},{key:"liveSyncPosition",get:function(){return this._hls.liveSyncPosition}},{key:"currentProgramDateTime",get:function(){return this._hls.playingDate}},{key:"_startTime",get:function(){return this._playbackType===t.Playback.LIVE&&"EVENT"!==this._playlistType?this._extrapolatedStartTime:this._playableRegionStartTime}},{key:"_now",get:function(){return y()}},{key:"_extrapolatedStartTime",get:function(){if(!this._localStartTimeCorrelation)return this._playableRegionStartTime;var t=this._localStartTimeCorrelation,e=this._now-t.local,r=(t.remote+e)/1e3;return Math.min(r,this._playableRegionStartTime+this._extrapolatedWindowDuration)}},{key:"_extrapolatedEndTime",get:function(){var t=this._playableRegionStartTime+this._playableRegionDuration;if(!this._localEndTimeCorrelation)return t;var e=this._localEndTimeCorrelation,r=this._now-e.local,i=(e.remote+r)/1e3;return Math.max(t-this._extrapolatedWindowDuration,Math.min(i,t))}},{key:"_duration",get:function(){return this._extrapolatedEndTime-this._startTime}},{key:"_extrapolatedWindowDuration",get:function(){return null===this._segmentTargetDuration?0:this._extrapolatedWindowNumSegments*this._segmentTargetDuration}},{key:"bandwidthEstimate",get:function(){return this._hls&&this._hls.bandwidthEstimate}},{key:"defaultOptions",get:function(){return{preload:!0}}},{key:"customListeners",get:function(){return this.options.hlsPlayback&&this.options.hlsPlayback.customListeners||[]}},{key:"sourceMedia",get:function(){return this.options.src}},{key:"currentTimestamp",get:function(){return this._currentFragment?(this._currentFragment.programDateTime+1e3*(this.el.currentTime-this._currentFragment.start))/1e3:null}},{key:"_setInitialState",value:function(){this._minDvrSize=void 0===this.options.hlsMinimumDvrSize?60:this.options.hlsMinimumDvrSize,this._extrapolatedWindowNumSegments=this.options.playback&&void 0!==this.options.playback.extrapolatedWindowNumSegments?this.options.playback.extrapolatedWindowNumSegments:2,this._playbackType=t.Playback.VOD,this._lastTimeUpdate={current:0,total:0,firstFragDateTime:0},this._lastTimeUpdateFiredTime=0,this._lastDuration=null,this._playableRegionStartTime=0,this._localStartTimeCorrelation=null,this._localEndTimeCorrelation=null,this._playableRegionDuration=0,this._programDateTime=0,this._durationExcludesAfterLiveSyncPoint=!1,this._segmentTargetDuration=null,this._playlistType=null,this._recoverAttemptsRemaining=this.options.hlsRecoverAttempts||16}},{key:"_setup",value:function(){this._destroyHLSInstance(),this._createHLSInstance(),this._listenHLSEvents(),this._attachHLSMedia()}},{key:"_destroyHLSInstance",value:function(){this._hls&&(this._manifestLoading=!1,this._ccIsSetup=!1,this._ccTracksUpdated=!1,this._setInitialState(),this._hls.destroy(),this._hls=null)}},{key:"_createHLSInstance",value:function(){var t=c({},this.options.playback.hlsjsConfig);this._hls=new r.default(t)}},{key:"_attachHLSMedia",value:function(){this._hls&&this._hls.attachMedia(this.el)}},{key:"_listenHLSEvents",value:function(){var t=this;this._hls&&(this._hls.once(r.default.Events.MEDIA_ATTACHED,(function(){t.options.hlsPlayback.preload&&t._hls.loadSource(t.options.src)})),this._hls.on(r.default.Events.MANIFEST_LOADING,(function(){return t._manifestLoading=!0})),this._hls.on(r.default.Events.LEVEL_LOADED,(function(e,r){return t._updatePlaybackType(e,r)})),this._hls.on(r.default.Events.LEVEL_UPDATED,(function(e,r){return t._onLevelUpdated(e,r)})),this._hls.on(r.default.Events.LEVEL_SWITCHED,(function(e,r){return t._onLevelSwitch(e,r)})),this._hls.on(r.default.Events.FRAG_CHANGED,(function(e,r){return t._onFragmentChanged(e,r)})),this._hls.on(r.default.Events.FRAG_LOADED,(function(e,r){return t._onFragmentLoaded(e,r)})),this._hls.on(r.default.Events.FRAG_BUFFERED,(function(e,r){return t._onFragmentBuffered(e,r)})),this._hls.on(r.default.Events.FRAG_PARSING_METADATA,(function(e,r){return t._onFragmentParsingMetadata(e,r)})),this._hls.on(r.default.Events.ERROR,(function(e,r){return t._onHLSJSError(e,r)})),this._hls.on(r.default.Events.SUBTITLE_TRACK_LOADED,(function(e,r){return t._onSubtitleLoaded(e,r)})),this._hls.on(r.default.Events.SUBTITLE_TRACKS_UPDATED,(function(){return t._ccTracksUpdated=!0})),this.bindCustomListeners())}},{key:"bindCustomListeners",value:function(){var t=this;this.customListeners.forEach((function(e){var r=e.eventName,i=e.once?"once":"on";r&&t._hls["".concat(i)](r,e.callback)}))}},{key:"unbindCustomListeners",value:function(){var t=this;this.customListeners.forEach((function(e){var r=e.eventName;r&&t._hls.off(r,e.callback)}))}},{key:"_onFragmentParsingMetadata",value:function(e,r){this.trigger(t.Events.Custom.PLAYBACK_FRAGMENT_PARSING_METADATA,{evt:e,data:r})}},{key:"render",value:function(){return this._ready(),d(i,"render",this,3)([])}},{key:"_ready",value:function(){this._isReadyState||(!this._hls&&this._setup(),this._isReadyState=!0,this.trigger(t.Events.PLAYBACK_READY,this.name))}},{key:"_recover",value:function(e,r,i){if(this._recoveredDecodingError)if(this._recoveredAudioCodecError){t.Log.error("hlsjs: failed to recover",{evt:e,data:r}),i.level=t.PlayerError.Levels.FATAL;var n=this.createError(i);this.trigger(t.Events.PLAYBACK_ERROR,n),this.stop()}else this._recoveredAudioCodecError=!0,this._hls.swapAudioCodec(),this._hls.recoverMediaError(),this.play();else this._recoveredDecodingError=!0,this._hls.recoverMediaError(),this.play()}},{key:"_setupSrc",value:function(t){}},{key:"_startTimeUpdateTimer",value:function(){var t=this;this._timeUpdateTimer||(this._timeUpdateTimer=setInterval((function(){t._onDurationChange(),t._onTimeUpdate()}),100))}},{key:"_stopTimeUpdateTimer",value:function(){this._timeUpdateTimer&&(clearInterval(this._timeUpdateTimer),this._timeUpdateTimer=null)}},{key:"getProgramDateTime",value:function(){return this._programDateTime}},{key:"getDuration",value:function(){return this._duration}},{key:"getCurrentTime",value:function(){return Math.max(0,this.el.currentTime-this._startTime)}},{key:"getStartTimeOffset",value:function(){return this._startTime}},{key:"seekPercentage",value:function(t){var e=t>0?this._duration*(t/100):this._duration;this.seek(e)}},{key:"seek",value:function(e){e<0&&(t.Log.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),e=this.getDuration()),e+=this._startTime,this.el.currentTime=e}},{key:"seekToLivePoint",value:function(){this.seek(this.getDuration())}},{key:"_updateSettings",value:function(){this._playbackType===t.Playback.VOD?this.settings.left=["playpause","position","duration"]:this.dvrEnabled?this.settings.left=["playpause"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(t.Events.PLAYBACK_SETTINGSUPDATE)}},{key:"_onHLSJSError",value:function(e,i){var n,a={code:"".concat(i.type,"_").concat(i.details),description:"".concat(this.name," error: type: ").concat(i.type,", details: ").concat(i.details),raw:i};if(i.response&&(a.description+=", response: ".concat(JSON.stringify(i.response))),i.fatal)if(this._recoverAttemptsRemaining>0)switch(this._recoverAttemptsRemaining-=1,i.type){case r.default.ErrorTypes.NETWORK_ERROR:switch(i.details){case r.default.ErrorDetails.MANIFEST_LOAD_ERROR:case r.default.ErrorDetails.MANIFEST_LOAD_TIMEOUT:case r.default.ErrorDetails.MANIFEST_PARSING_ERROR:case r.default.ErrorDetails.LEVEL_LOAD_ERROR:case r.default.ErrorDetails.LEVEL_LOAD_TIMEOUT:t.Log.error("hlsjs: unrecoverable network fatal error.",{evt:e,data:i}),n=this.createError(a),this.trigger(t.Events.PLAYBACK_ERROR,n),this.stop();break;default:t.Log.warn("hlsjs: trying to recover from network error.",{evt:e,data:i}),a.level=t.PlayerError.Levels.WARN,this._hls.startLoad()}break;case r.default.ErrorTypes.MEDIA_ERROR:t.Log.warn("hlsjs: trying to recover from media error.",{evt:e,data:i}),a.level=t.PlayerError.Levels.WARN,this._recover(e,i,a);break;default:t.Log.error("hlsjs: could not recover from error.",{evt:e,data:i}),n=this.createError(a),this.trigger(t.Events.PLAYBACK_ERROR,n),this.stop()}else t.Log.error("hlsjs: could not recover from error after maximum number of attempts.",{evt:e,data:i}),n=this.createError(a),this.trigger(t.Events.PLAYBACK_ERROR,n),this.stop();else{if(this.options.playback.triggerFatalErrorOnResourceDenied&&this._keyIsDenied(i))return t.Log.error("hlsjs: could not load decrypt key.",{evt:e,data:i}),n=this.createError(a),this.trigger(t.Events.PLAYBACK_ERROR,n),void this.stop();a.level=t.PlayerError.Levels.WARN,t.Log.warn("hlsjs: non-fatal error occurred",{evt:e,data:i})}}},{key:"_keyIsDenied",value:function(t){return t.type===r.default.ErrorTypes.NETWORK_ERROR&&t.details===r.default.ErrorDetails.KEY_LOAD_ERROR&&t.response&&t.response.code>=400}},{key:"_onTimeUpdate",value:function(){var e={current:this.getCurrentTime(),total:this.getDuration(),firstFragDateTime:this.getProgramDateTime()};this._shouldThrottleTimeUpdate(e)||(this._lastTimeUpdate=e,this._lastTimeUpdateFiredTime=this._now,this.trigger(t.Events.PLAYBACK_TIMEUPDATE,e,this.name))}},{key:"_shouldThrottleTimeUpdate",value:function(t){var e=Math.abs(t.current-this._lastTimeUpdate.current)<this._timeUpdateFiringRate,r=Math.abs(t.total-this._lastTimeUpdate.total)<this._durationChangeMinOffset,i=t.firstFragDateTime===this._lastTimeUpdate.firstFragDateTime,n=e&&r&&i,a=this._now-this._lastTimeUpdateFiredTime<this._timeUpdateThrottleDelay;return n&&a}},{key:"_onDurationChange",value:function(){var t=this.getDuration();Math.abs(this._lastDuration-t)<this._durationChangeMinOffset||(this._lastDuration=t,d(i,"_onDurationChange",this,3)([]))}},{key:"_onProgress",value:function(){if(this.el.buffered.length){for(var e=[],r=0,i=0;i<this.el.buffered.length;i++)e=[].concat(f(e),[{start:Math.max(0,this.el.buffered.start(i)-this._playableRegionStartTime),end:Math.max(0,this.el.buffered.end(i)-this._playableRegionStartTime)}]),this.el.currentTime>=e[i].start&&this.el.currentTime<=e[i].end&&(r=i);var n={start:e[r].start,current:e[r].end,total:this.getDuration()};this.trigger(t.Events.PLAYBACK_PROGRESS,n,e)}}},{key:"load",value:function(t){this._stopTimeUpdateTimer(),this.options.src=t,this._setup()}},{key:"play",value:function(){!this._hls&&this._setup(),!this._manifestLoading&&!this.options.hlsPlayback.preload&&this._hls.loadSource(this.options.src),d(i,"play",this,3)([]),this._startTimeUpdateTimer()}},{key:"pause",value:function(){this._hls&&this.el.pause()}},{key:"stop",value:function(){this._stopTimeUpdateTimer(),this._hls&&d(i,"stop",this,3)([]),this._destroyHLSInstance()}},{key:"destroy",value:function(){this._stopTimeUpdateTimer(),this._destroyHLSInstance(),d(i,"destroy",this,3)([])}},{key:"_updatePlaybackType",value:function(e,r){this._playbackType=r.details.live?t.Playback.LIVE:t.Playback.VOD,this._onLevelUpdated(e,r),this._ccTracksUpdated&&this._playbackType===t.Playback.LIVE&&this.hasClosedCaptionsTracks&&this._onSubtitleLoaded()}},{key:"_fillLevels",value:function(){this._levels=this._hls.levels.map((function(t,e){return{id:e,level:t,label:"".concat(t.bitrate/1e3,"Kbps")}})),this.trigger(t.Events.PLAYBACK_LEVELS_AVAILABLE,this._levels)}},{key:"_onLevelUpdated",value:function(e,i){this._segmentTargetDuration=i.details.targetduration,this._playlistType=i.details.type||null;var n=!1,a=!1,o=i.details.fragments,s=this._playableRegionStartTime,l=this._playableRegionDuration;if(0!==o.length){if(o[0].rawProgramDateTime&&(this._programDateTime=o[0].rawProgramDateTime),this._playableRegionStartTime!==o[0].start&&(n=!0,this._playableRegionStartTime=o[0].start),n)if(this._localStartTimeCorrelation){var u=this._localStartTimeCorrelation,h=this._now-u.local,c=(u.remote+h)/1e3;c<o[0].start?this._localStartTimeCorrelation={local:this._now,remote:1e3*o[0].start}:c>s+this._extrapolatedWindowDuration&&(this._localStartTimeCorrelation={local:this._now,remote:1e3*Math.max(o[0].start,s+this._extrapolatedWindowDuration)})}else this._localStartTimeCorrelation={local:this._now,remote:1e3*(o[0].start+this._extrapolatedWindowDuration/2)};var _=i.details.totalduration;if(this._playbackType===t.Playback.LIVE){var d=i.details.targetduration*((this.options.playback.hlsjsConfig||{}).liveSyncDurationCount||r.default.DefaultConfig.liveSyncDurationCount);d<=_?(_-=d,this._durationExcludesAfterLiveSyncPoint=!0):this._durationExcludesAfterLiveSyncPoint=!1}_!==this._playableRegionDuration&&(a=!0,this._playableRegionDuration=_);var f=o[0].start+_,p=s+l;if(f!==p)if(this._localEndTimeCorrelation){var y=this._localEndTimeCorrelation,v=this._now-y.local,m=(y.remote+v)/1e3;m>f?this._localEndTimeCorrelation={local:this._now,remote:1e3*f}:m<f-this._extrapolatedWindowDuration?this._localEndTimeCorrelation={local:this._now,remote:1e3*(f-this._extrapolatedWindowDuration)}:m>p&&(this._localEndTimeCorrelation={local:this._now,remote:1e3*p})}else this._localEndTimeCorrelation={local:this._now,remote:1e3*f};a&&this._onDurationChange(),n&&this._onProgress()}}},{key:"_onFragmentChanged",value:function(e,r){this._currentFragment=r.frag,this.trigger(t.Events.Custom.PLAYBACK_FRAGMENT_CHANGED,r)}},{key:"_onFragmentLoaded",value:function(e,r){this.trigger(t.Events.PLAYBACK_FRAGMENT_LOADED,r)}},{key:"_onFragmentBuffered",value:function(e,r){this.trigger(t.Events.PLAYBACK_FRAGMENT_BUFFERED,r)}},{key:"_onSubtitleLoaded",value:function(){if(!this._ccIsSetup){this.trigger(t.Events.PLAYBACK_SUBTITLE_AVAILABLE);var e=this._playbackType===t.Playback.LIVE?-1:this.closedCaptionsTrackId;this.closedCaptionsTrackId=e,this._ccIsSetup=!0}}},{key:"_onLevelSwitch",value:function(e,r){this.levels.length||this._fillLevels(),this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH_END),this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH,r);var i=this._hls.levels[r.level];i&&(this.highDefinition=i.height>=720||i.bitrate/1e3>=2e3,this.trigger(t.Events.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(t.Events.PLAYBACK_BITRATE,{height:i.height,width:i.width,bandwidth:i.bitrate,bitrate:i.bitrate,level:r.level}))}},{key:"dvrEnabled",get:function(){return this._durationExcludesAfterLiveSyncPoint&&this._duration>=this._minDvrSize&&this.getPlaybackType()===t.Playback.LIVE}},{key:"getPlaybackType",value:function(){return this._playbackType}},{key:"isSeekEnabled",value:function(){return this._playbackType===t.Playback.VOD||this.dvrEnabled}}])&&a(o.prototype,s),l&&a(o,l),Object.defineProperty(o,"prototype",{writable:!1}),o;var o,s,l}(t.HTML5Video);return m.canPlay=function(t,e){var i=t.split("?")[0].match(/.*\.(.*)$/)||[],n=i.length>1&&"m3u8"===i[1].toLowerCase()||v(e,["application/vnd.apple.mpegurl","application/x-mpegURL"]);return!(!r.default.isSupported()||!n)},m}(Clappr);
1
+ var HlsjsPlayback=function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=e(Hls);function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function n(t,e,i){return e=l(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,u()?Reflect.construct(e,i||[],l(t).constructor):e.apply(t,i))}function a(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,p(r.key),r)}}function o(t,e,i){return(e=p(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function s(){return s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}(t,e);if(r){var n=Object.getOwnPropertyDescriptor(r,e);return n.get?n.get.call(arguments.length<3?t:i):n.value}},s.apply(null,arguments)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(u=function(){return!!t})()}function h(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function c(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?h(Object(i),!0).forEach((function(e){o(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):h(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function _(t,e){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_(t,e)}function d(t,e,i,r){var n=s(l(1&r?t.prototype:t),e,i);return 2&r&&"function"==typeof n?function(t){return n.apply(i,t)}:n}function f(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}var y=t.Utils.now,v=t.Utils.listContainsIgnoreCase;t.Events.register("PLAYBACK_FRAGMENT_CHANGED"),t.Events.register("PLAYBACK_FRAGMENT_PARSING_METADATA");var m=function(e){function r(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r);for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];return(t=n(this,r,[].concat(i))).options.hlsPlayback=c(c({},t.defaultOptions),t.options.hlsPlayback),t._timeUpdateThrottleDelay=200,t._timeUpdateFiringRate=.2,t._durationChangeMinOffset=.5,t._setInitialState(),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_(t,e)}(r,e),o=r,l=[{key:"HLSJS",get:function(){return i.default}}],(s=[{key:"name",get:function(){return"hls"}},{key:"supportedVersion",get:function(){return{min:"0.13.0"}}},{key:"levels",get:function(){return this._levels||[]}},{key:"currentLevel",get:function(){return null===this._currentLevel||void 0===this._currentLevel?-1:this._currentLevel},set:function(e){this._currentLevel=e,this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH_START),this.options.playback.hlsUseNextLevel?this._hls.nextLevel=this._currentLevel:this._hls.currentLevel=this._currentLevel}},{key:"isReady",get:function(){return this._isReadyState}},{key:"latency",get:function(){return this._hls.latency}},{key:"liveSyncPosition",get:function(){return this._hls.liveSyncPosition}},{key:"currentProgramDateTime",get:function(){return this._hls.playingDate}},{key:"_startTime",get:function(){return this._playbackType===t.Playback.LIVE&&"EVENT"!==this._playlistType?this._extrapolatedStartTime:this._playableRegionStartTime}},{key:"_now",get:function(){return y()}},{key:"_extrapolatedStartTime",get:function(){if(!this._localStartTimeCorrelation)return this._playableRegionStartTime;var t=this._localStartTimeCorrelation,e=this._now-t.local,i=(t.remote+e)/1e3;return Math.min(i,this._playableRegionStartTime+this._extrapolatedWindowDuration)}},{key:"_extrapolatedEndTime",get:function(){var t=this._playableRegionStartTime+this._playableRegionDuration;if(!this._localEndTimeCorrelation)return t;var e=this._localEndTimeCorrelation,i=this._now-e.local,r=(e.remote+i)/1e3;return Math.max(t-this._extrapolatedWindowDuration,Math.min(r,t))}},{key:"_duration",get:function(){return this._extrapolatedEndTime-this._startTime}},{key:"_extrapolatedWindowDuration",get:function(){return null===this._segmentTargetDuration?0:this._extrapolatedWindowNumSegments*this._segmentTargetDuration}},{key:"bandwidthEstimate",get:function(){return this._hls&&this._hls.bandwidthEstimate}},{key:"defaultOptions",get:function(){return{preload:!0}}},{key:"customListeners",get:function(){return this.options.hlsPlayback&&this.options.hlsPlayback.customListeners||[]}},{key:"sourceMedia",get:function(){return this.options.src}},{key:"currentTimestamp",get:function(){return this._currentFragment?(this._currentFragment.programDateTime+1e3*(this.el.currentTime-this._currentFragment.start))/1e3:null}},{key:"_setInitialState",value:function(){this._minDvrSize=void 0===this.options.hlsMinimumDvrSize?60:this.options.hlsMinimumDvrSize,this._extrapolatedWindowNumSegments=this.options.playback&&void 0!==this.options.playback.extrapolatedWindowNumSegments?this.options.playback.extrapolatedWindowNumSegments:2,this._playbackType=t.Playback.VOD,this._lastTimeUpdate={current:0,total:0,firstFragDateTime:0},this._lastTimeUpdateFiredTime=0,this._lastDuration=null,this._playableRegionStartTime=0,this._localStartTimeCorrelation=null,this._localEndTimeCorrelation=null,this._playableRegionDuration=0,this._programDateTime=0,this._durationExcludesAfterLiveSyncPoint=!1,this._segmentTargetDuration=null,this._playlistType=null,this._recoverAttemptsRemaining=this.options.hlsRecoverAttempts||16}},{key:"_setup",value:function(){this._destroyHLSInstance(),this._createHLSInstance(),this._listenHLSEvents(),this._attachHLSMedia()}},{key:"_destroyHLSInstance",value:function(){this._hls&&(this._manifestLoading=!1,this._ccIsSetup=!1,this._ccTracksUpdated=!1,this._setInitialState(),this._hls.destroy(),this._hls=null)}},{key:"_createHLSInstance",value:function(){var t=c({},this.options.playback.hlsjsConfig);this._hls=new i.default(t)}},{key:"_attachHLSMedia",value:function(){this._hls&&this._hls.attachMedia(this.el)}},{key:"_listenHLSEvents",value:function(){var t=this;this._hls&&(this._hls.once(i.default.Events.MEDIA_ATTACHED,(function(){t.options.hlsPlayback.preload&&t._hls.loadSource(t.options.src)})),this._hls.on(i.default.Events.MANIFEST_LOADING,(function(){t._manifestLoading=!0})),this._hls.on(i.default.Events.LEVEL_LOADED,(function(e,i){return t._updatePlaybackType(e,i)})),this._hls.on(i.default.Events.LEVEL_UPDATED,(function(e,i){return t._onLevelUpdated(e,i)})),this._hls.on(i.default.Events.LEVEL_SWITCHED,(function(e,i){return t._onLevelSwitch(e,i)})),this._hls.on(i.default.Events.FRAG_CHANGED,(function(e,i){return t._onFragmentChanged(e,i)})),this._hls.on(i.default.Events.FRAG_LOADED,(function(e,i){return t._onFragmentLoaded(e,i)})),this._hls.on(i.default.Events.FRAG_BUFFERED,(function(e,i){return t._onFragmentBuffered(e,i)})),this._hls.on(i.default.Events.FRAG_PARSING_METADATA,(function(e,i){return t._onFragmentParsingMetadata(e,i)})),this._hls.on(i.default.Events.ERROR,(function(e,i){return t._onHLSJSError(e,i)})),this._hls.on(i.default.Events.SUBTITLE_TRACK_LOADED,(function(e,i){return t._onSubtitleLoaded(e,i)})),this._hls.on(i.default.Events.SUBTITLE_TRACKS_UPDATED,(function(){return t._ccTracksUpdated=!0})),this.bindCustomListeners())}},{key:"bindCustomListeners",value:function(){var t=this;this.customListeners.forEach((function(e){var i=e.eventName,r=e.once?"once":"on";i&&t._hls["".concat(r)](i,e.callback)}))}},{key:"unbindCustomListeners",value:function(){var t=this;this.customListeners.forEach((function(e){var i=e.eventName;i&&t._hls.off(i,e.callback)}))}},{key:"_onFragmentParsingMetadata",value:function(e,i){this.trigger(t.Events.Custom.PLAYBACK_FRAGMENT_PARSING_METADATA,{evt:e,data:i})}},{key:"render",value:function(){return this._ready(),d(r,"render",this,3)([])}},{key:"_ready",value:function(){this._isReadyState||(!this._hls&&this._setup(),this._isReadyState=!0,this.trigger(t.Events.PLAYBACK_READY,this.name))}},{key:"_recover",value:function(e,i,r){if(this._recoveredDecodingError)if(this._recoveredAudioCodecError){t.Log.error("hlsjs: failed to recover",{evt:e,data:i}),r.level=t.PlayerError.Levels.FATAL;var n=this.createError(r);this.trigger(t.Events.PLAYBACK_ERROR,n),this.stop()}else this._recoveredAudioCodecError=!0,this._hls.swapAudioCodec(),this._hls.recoverMediaError(),this.play();else this._recoveredDecodingError=!0,this._hls.recoverMediaError(),this.play()}},{key:"_setupSrc",value:function(t){}},{key:"_startTimeUpdateTimer",value:function(){var t=this;this._timeUpdateTimer||(this._timeUpdateTimer=setInterval((function(){t._onDurationChange(),t._onTimeUpdate()}),100))}},{key:"_stopTimeUpdateTimer",value:function(){this._timeUpdateTimer&&(clearInterval(this._timeUpdateTimer),this._timeUpdateTimer=null)}},{key:"getProgramDateTime",value:function(){return this._programDateTime}},{key:"getDuration",value:function(){return this._duration}},{key:"getCurrentTime",value:function(){return Math.max(0,this.el.currentTime-this._startTime)}},{key:"getStartTimeOffset",value:function(){return this._startTime}},{key:"seekPercentage",value:function(t){var e=t>0?this._duration*(t/100):this._duration;this.seek(e)}},{key:"seek",value:function(e){e<0&&(t.Log.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),e=this.getDuration()),e+=this._startTime,this.el.currentTime=e}},{key:"seekToLivePoint",value:function(){this.seek(this.getDuration())}},{key:"_updateSettings",value:function(){this._playbackType===t.Playback.VOD?this.settings.left=["playpause","position","duration"]:this.dvrEnabled?this.settings.left=["playpause"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(t.Events.PLAYBACK_SETTINGSUPDATE)}},{key:"_onHLSJSError",value:function(e,r){var n,a={code:"".concat(r.type,"_").concat(r.details),description:"".concat(this.name," error: type: ").concat(r.type,", details: ").concat(r.details),raw:r};if(r.response&&(a.description+=", response: ".concat(JSON.stringify(r.response))),r.fatal)if(this._recoverAttemptsRemaining>0)switch(this._recoverAttemptsRemaining-=1,r.type){case i.default.ErrorTypes.NETWORK_ERROR:switch(r.details){case i.default.ErrorDetails.MANIFEST_LOAD_ERROR:case i.default.ErrorDetails.MANIFEST_LOAD_TIMEOUT:case i.default.ErrorDetails.MANIFEST_PARSING_ERROR:case i.default.ErrorDetails.LEVEL_LOAD_ERROR:case i.default.ErrorDetails.LEVEL_LOAD_TIMEOUT:t.Log.error("hlsjs: unrecoverable network fatal error.",{evt:e,data:r}),n=this.createError(a),this.trigger(t.Events.PLAYBACK_ERROR,n),this.stop();break;default:t.Log.warn("hlsjs: trying to recover from network error.",{evt:e,data:r}),a.level=t.PlayerError.Levels.WARN,this._hls.startLoad()}break;case i.default.ErrorTypes.MEDIA_ERROR:t.Log.warn("hlsjs: trying to recover from media error.",{evt:e,data:r}),a.level=t.PlayerError.Levels.WARN,this._recover(e,r,a);break;default:t.Log.error("hlsjs: could not recover from error.",{evt:e,data:r}),n=this.createError(a),this.trigger(t.Events.PLAYBACK_ERROR,n),this.stop()}else t.Log.error("hlsjs: could not recover from error after maximum number of attempts.",{evt:e,data:r}),n=this.createError(a),this.trigger(t.Events.PLAYBACK_ERROR,n),this.stop();else{if(this.options.playback.triggerFatalErrorOnResourceDenied&&this._keyIsDenied(r))return t.Log.error("hlsjs: could not load decrypt key.",{evt:e,data:r}),n=this.createError(a),this.trigger(t.Events.PLAYBACK_ERROR,n),void this.stop();a.level=t.PlayerError.Levels.WARN,t.Log.warn("hlsjs: non-fatal error occurred",{evt:e,data:r})}}},{key:"_keyIsDenied",value:function(t){return t.type===i.default.ErrorTypes.NETWORK_ERROR&&t.details===i.default.ErrorDetails.KEY_LOAD_ERROR&&t.response&&t.response.code>=400}},{key:"_onTimeUpdate",value:function(){var e={current:this.getCurrentTime(),total:this.getDuration(),firstFragDateTime:this.getProgramDateTime()};this._shouldThrottleTimeUpdate(e)||(this._lastTimeUpdate=e,this._lastTimeUpdateFiredTime=this._now,this.trigger(t.Events.PLAYBACK_TIMEUPDATE,e,this.name))}},{key:"_shouldThrottleTimeUpdate",value:function(t){var e=Math.abs(t.current-this._lastTimeUpdate.current)<this._timeUpdateFiringRate,i=Math.abs(t.total-this._lastTimeUpdate.total)<this._durationChangeMinOffset,r=t.firstFragDateTime===this._lastTimeUpdate.firstFragDateTime,n=e&&i&&r,a=this._now-this._lastTimeUpdateFiredTime<this._timeUpdateThrottleDelay;return n&&a}},{key:"_onDurationChange",value:function(){var t=this.getDuration();Math.abs(this._lastDuration-t)<this._durationChangeMinOffset||(this._lastDuration=t,d(r,"_onDurationChange",this,3)([]))}},{key:"_onProgress",value:function(){if(this.el.buffered.length){for(var e=[],i=0,r=0;r<this.el.buffered.length;r++)e=[].concat(f(e),[{start:Math.max(0,this.el.buffered.start(r)-this._playableRegionStartTime),end:Math.max(0,this.el.buffered.end(r)-this._playableRegionStartTime)}]),this.el.currentTime>=e[r].start&&this.el.currentTime<=e[r].end&&(i=r);var n={start:e[i].start,current:e[i].end,total:this.getDuration()};this.trigger(t.Events.PLAYBACK_PROGRESS,n,e)}}},{key:"load",value:function(t){this._stopTimeUpdateTimer(),this.options.src=t,this._setup()}},{key:"play",value:function(){!this._hls&&this._setup(),!this._manifestLoading&&!this.options.hlsPlayback.preload&&this._hls.loadSource(this.options.src),d(r,"play",this,3)([]),this._startTimeUpdateTimer()}},{key:"pause",value:function(){this._hls&&this.el.pause()}},{key:"stop",value:function(){this._stopTimeUpdateTimer(),this._hls&&d(r,"stop",this,3)([]),this._destroyHLSInstance()}},{key:"destroy",value:function(){this._stopTimeUpdateTimer(),this._destroyHLSInstance(),d(r,"destroy",this,3)([])}},{key:"_updatePlaybackType",value:function(e,i){this._playbackType=i.details.live?t.Playback.LIVE:t.Playback.VOD,this._onLevelUpdated(e,i),this._ccTracksUpdated&&this._playbackType===t.Playback.LIVE&&this.hasClosedCaptionsTracks&&this._onSubtitleLoaded()}},{key:"_fillLevels",value:function(){this._levels=this._hls.levels.map((function(t,e){return{id:e,level:t,label:"".concat(t.bitrate/1e3,"Kbps")}})),this.trigger(t.Events.PLAYBACK_LEVELS_AVAILABLE,this._levels)}},{key:"_onLevelUpdated",value:function(e,r){this._segmentTargetDuration=r.details.targetduration,this._playlistType=r.details.type||null;var n=!1,a=!1,o=r.details.fragments,s=this._playableRegionStartTime,l=this._playableRegionDuration;if(0!==o.length){if(o[0].rawProgramDateTime&&(this._programDateTime=o[0].rawProgramDateTime),this._playableRegionStartTime!==o[0].start&&(n=!0,this._playableRegionStartTime=o[0].start),n)if(this._localStartTimeCorrelation){var u=this._localStartTimeCorrelation,h=this._now-u.local,c=(u.remote+h)/1e3;c<o[0].start?this._localStartTimeCorrelation={local:this._now,remote:1e3*o[0].start}:c>s+this._extrapolatedWindowDuration&&(this._localStartTimeCorrelation={local:this._now,remote:1e3*Math.max(o[0].start,s+this._extrapolatedWindowDuration)})}else this._localStartTimeCorrelation={local:this._now,remote:1e3*(o[0].start+this._extrapolatedWindowDuration/2)};var _=r.details.totalduration;if(this._playbackType===t.Playback.LIVE){var d=r.details.targetduration*((this.options.playback.hlsjsConfig||{}).liveSyncDurationCount||i.default.DefaultConfig.liveSyncDurationCount);d<=_?(_-=d,this._durationExcludesAfterLiveSyncPoint=!0):this._durationExcludesAfterLiveSyncPoint=!1}_!==this._playableRegionDuration&&(a=!0,this._playableRegionDuration=_);var f=o[0].start+_,p=s+l;if(f!==p)if(this._localEndTimeCorrelation){var y=this._localEndTimeCorrelation,v=this._now-y.local,m=(y.remote+v)/1e3;m>f?this._localEndTimeCorrelation={local:this._now,remote:1e3*f}:m<f-this._extrapolatedWindowDuration?this._localEndTimeCorrelation={local:this._now,remote:1e3*(f-this._extrapolatedWindowDuration)}:m>p&&(this._localEndTimeCorrelation={local:this._now,remote:1e3*p})}else this._localEndTimeCorrelation={local:this._now,remote:1e3*f};a&&this._onDurationChange(),n&&this._onProgress()}}},{key:"_onFragmentChanged",value:function(e,i){this._currentFragment=i.frag,this.trigger(t.Events.Custom.PLAYBACK_FRAGMENT_CHANGED,i)}},{key:"_onFragmentLoaded",value:function(e,i){this.trigger(t.Events.PLAYBACK_FRAGMENT_LOADED,i)}},{key:"_onFragmentBuffered",value:function(e,i){this.trigger(t.Events.PLAYBACK_FRAGMENT_BUFFERED,i)}},{key:"_onSubtitleLoaded",value:function(){if(!this._ccIsSetup){this.trigger(t.Events.PLAYBACK_SUBTITLE_AVAILABLE);var e=this._playbackType===t.Playback.LIVE?-1:this.closedCaptionsTrackId;this.closedCaptionsTrackId=e,this._ccIsSetup=!0}}},{key:"_onLevelSwitch",value:function(e,i){this.levels.length||this._fillLevels(),this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH_END),this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH,i);var r=this._hls.levels[i.level];r&&(this.highDefinition=r.height>=720||r.bitrate/1e3>=2e3,this.trigger(t.Events.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(t.Events.PLAYBACK_BITRATE,{height:r.height,width:r.width,bandwidth:r.bitrate,bitrate:r.bitrate,level:i.level}))}},{key:"dvrEnabled",get:function(){return this._durationExcludesAfterLiveSyncPoint&&this._duration>=this._minDvrSize&&this.getPlaybackType()===t.Playback.LIVE}},{key:"getPlaybackType",value:function(){return this._playbackType}},{key:"isSeekEnabled",value:function(){return this._playbackType===t.Playback.VOD||this.dvrEnabled}}])&&a(o.prototype,s),l&&a(o,l),Object.defineProperty(o,"prototype",{writable:!1}),o;var o,s,l}(t.HTML5Video);return m.canPlay=function(t,e){var r=t.split("?")[0].match(/.*\.(.*)$/)||[],n=r.length>1&&"m3u8"===r[1].toLowerCase()||v(e,["application/vnd.apple.mpegurl","application/x-mpegURL"]);return!(!i.default.isSupported()||!n)},m}(Clappr);
2
2
  //# sourceMappingURL=hlsjs-playback.external.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hlsjs-playback.external.min.js","sources":["../src/hls.js"],"sourcesContent":["// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nimport { Events, HTML5Video, Log, Playback, PlayerError, Utils } from '@clappr/core'\nimport HLSJS from 'hls.js'\n\nconst { now, listContainsIgnoreCase } = Utils\nconst AUTO = -1\nconst DEFAULT_RECOVER_ATTEMPTS = 16\n\nEvents.register('PLAYBACK_FRAGMENT_CHANGED')\nEvents.register('PLAYBACK_FRAGMENT_PARSING_METADATA')\n\nexport default class HlsjsPlayback extends HTML5Video {\n get name() { return 'hls' }\n\n get supportedVersion() { return { min: CLAPPR_CORE_VERSION } }\n\n get levels() { return this._levels || [] }\n\n get currentLevel() {\n if (this._currentLevel === null || this._currentLevel === undefined)\n return AUTO\n else\n return this._currentLevel //0 is a valid level ID\n\n }\n\n get isReady() {\n return this._isReadyState\n }\n\n set currentLevel(id) {\n this._currentLevel = id\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH_START)\n if (this.options.playback.hlsUseNextLevel)\n this._hls.nextLevel = this._currentLevel\n else\n this._hls.currentLevel = this._currentLevel\n }\n\n get latency() {\n return this._hls.latency\n }\n\n get liveSyncPosition() {\n return this._hls.liveSyncPosition\n }\n\n get currentProgramDateTime() {\n return this._hls.playingDate\n }\n\n get _startTime() {\n if (this._playbackType === Playback.LIVE && this._playlistType !== 'EVENT')\n return this._extrapolatedStartTime\n\n return this._playableRegionStartTime\n }\n\n get _now() {\n return now()\n }\n\n // the time in the video element which should represent the start of the sliding window\n // extrapolated to increase in real time (instead of jumping as the early segments are removed)\n get _extrapolatedStartTime() {\n if (!this._localStartTimeCorrelation)\n return this._playableRegionStartTime\n\n let corr = this._localStartTimeCorrelation\n let timePassed = this._now - corr.local\n let extrapolatedWindowStartTime = (corr.remote + timePassed) / 1000\n // cap at the end of the extrapolated window duration\n return Math.min(extrapolatedWindowStartTime, this._playableRegionStartTime + this._extrapolatedWindowDuration)\n }\n\n // the time in the video element which should represent the end of the content\n // extrapolated to increase in real time (instead of jumping as segments are added)\n get _extrapolatedEndTime() {\n let actualEndTime = this._playableRegionStartTime + this._playableRegionDuration\n if (!this._localEndTimeCorrelation) return actualEndTime\n const correlation = this._localEndTimeCorrelation\n const timePassed = this._now - correlation.local\n const extrapolatedEndTime = (correlation.remote + timePassed) / 1000\n return Math.max(actualEndTime - this._extrapolatedWindowDuration, Math.min(extrapolatedEndTime, actualEndTime))\n }\n\n get _duration() {\n return this._extrapolatedEndTime - this._startTime\n }\n\n // Returns the duration (seconds) of the window that the extrapolated start time is allowed\n // to move in before being capped.\n // The extrapolated start time should never reach the cap at the end of the window as the\n // window should slide as chunks are removed from the start.\n // This also applies to the extrapolated end time in the same way.\n //\n // If chunks aren't being removed for some reason that the start time will reach and remain fixed at\n // playableRegionStartTime + extrapolatedWindowDuration\n //\n // <-- window duration -->\n // I.e playableRegionStartTime |-----------------------|\n // | --> . . .\n // . --> | --> . .\n // . . --> | --> .\n // . . . --> |\n // . . . .\n // extrapolatedStartTime\n get _extrapolatedWindowDuration() {\n if (this._segmentTargetDuration === null)\n return 0\n\n return this._extrapolatedWindowNumSegments * this._segmentTargetDuration\n }\n\n get bandwidthEstimate() {\n return this._hls && this._hls.bandwidthEstimate\n }\n\n get defaultOptions() {\n return { preload: true }\n }\n\n get customListeners() {\n return this.options.hlsPlayback && this.options.hlsPlayback.customListeners || []\n }\n\n get sourceMedia() {\n return this.options.src\n }\n\n get currentTimestamp() {\n if (!this._currentFragment) return null\n const startTime = this._currentFragment.programDateTime\n const playbackTime = this.el.currentTime\n const playTimeOffSet = playbackTime - this._currentFragment.start\n const currentTimestampInMs = startTime + playTimeOffSet * 1000\n return currentTimestampInMs / 1000\n }\n\n static get HLSJS() {\n return HLSJS\n }\n\n constructor(...args) {\n super(...args)\n this.options.hlsPlayback = { ...this.defaultOptions, ...this.options.hlsPlayback }\n this._timeUpdateThrottleDelay = 200\n this._timeUpdateFiringRate = 0.2\n this._durationChangeMinOffset = 0.5\n this._setInitialState()\n }\n\n _setInitialState() {\n this._minDvrSize = typeof (this.options.hlsMinimumDvrSize) === 'undefined' ? 60 : this.options.hlsMinimumDvrSize\n // The size of the start time extrapolation window measured as a multiple of segments.\n // Should be 2 or higher, or 0 to disable. Should only need to be increased above 2 if more than one segment is\n // removed from the start of the playlist at a time. E.g if the playlist is cached for 10 seconds and new chunks are\n // added/removed every 5.\n this._extrapolatedWindowNumSegments = !this.options.playback || typeof (this.options.playback.extrapolatedWindowNumSegments) === 'undefined' ? 2 : this.options.playback.extrapolatedWindowNumSegments\n\n this._playbackType = Playback.VOD\n this._lastTimeUpdate = { current: 0, total: 0, firstFragDateTime: 0 }\n this._lastTimeUpdateFiredTime = 0\n this._lastDuration = null\n // for hls streams which have dvr with a sliding window,\n // the content at the start of the playlist is removed as new\n // content is appended at the end.\n // this means the actual playable start time will increase as the\n // start content is deleted\n // For streams with dvr where the entire recording is kept from the\n // beginning this should stay as 0\n this._playableRegionStartTime = 0\n // {local, remote} remote is the time in the video element that should represent 0\n // local is the system time when the 'remote' measurment took place\n this._localStartTimeCorrelation = null\n // {local, remote} remote is the time in the video element that should represents the end\n // local is the system time when the 'remote' measurment took place\n this._localEndTimeCorrelation = null\n // if content is removed from the beginning then this empty area should\n // be ignored. \"playableRegionDuration\" excludes the empty area\n this._playableRegionDuration = 0\n // #EXT-X-PROGRAM-DATE-TIME\n this._programDateTime = 0\n // true when the actual duration is longer than hlsjs's live sync point\n // when this is false playableRegionDuration will be the actual duration\n // when this is true playableRegionDuration will exclude the time after the sync point\n this._durationExcludesAfterLiveSyncPoint = false\n // #EXT-X-TARGETDURATION\n this._segmentTargetDuration = null\n // #EXT-X-PLAYLIST-TYPE\n this._playlistType = null\n this._recoverAttemptsRemaining = this.options.hlsRecoverAttempts || DEFAULT_RECOVER_ATTEMPTS\n }\n\n _setup() {\n this._destroyHLSInstance()\n this._createHLSInstance()\n this._listenHLSEvents()\n this._attachHLSMedia()\n }\n\n _destroyHLSInstance() {\n if (!this._hls) return\n this._manifestLoading = false\n this._ccIsSetup = false\n this._ccTracksUpdated = false\n this._setInitialState()\n this._hls.destroy()\n this._hls = null\n }\n\n _createHLSInstance() {\n const config = { ...this.options.playback.hlsjsConfig }\n this._hls = new HLSJS(config)\n }\n\n _attachHLSMedia() {\n if (!this._hls) return\n this._hls.attachMedia(this.el)\n }\n\n _listenHLSEvents() {\n if (!this._hls) return\n this._hls.once(HLSJS.Events.MEDIA_ATTACHED, () => { this.options.hlsPlayback.preload && this._hls.loadSource(this.options.src) })\n this._hls.on(HLSJS.Events.MANIFEST_LOADING, () => this._manifestLoading = true)\n this._hls.on(HLSJS.Events.LEVEL_LOADED, (evt, data) => this._updatePlaybackType(evt, data))\n this._hls.on(HLSJS.Events.LEVEL_UPDATED, (evt, data) => this._onLevelUpdated(evt, data))\n this._hls.on(HLSJS.Events.LEVEL_SWITCHED, (evt,data) => this._onLevelSwitch(evt, data))\n this._hls.on(HLSJS.Events.FRAG_CHANGED, (evt, data) => this._onFragmentChanged(evt, data))\n this._hls.on(HLSJS.Events.FRAG_LOADED, (evt, data) => this._onFragmentLoaded(evt, data))\n this._hls.on(HLSJS.Events.FRAG_BUFFERED, (evt, data) => this._onFragmentBuffered(evt, data))\n this._hls.on(HLSJS.Events.FRAG_PARSING_METADATA, (evt, data) => this._onFragmentParsingMetadata(evt, data))\n this._hls.on(HLSJS.Events.ERROR, (evt, data) => this._onHLSJSError(evt, data))\n this._hls.on(HLSJS.Events.SUBTITLE_TRACK_LOADED, (evt, data) => this._onSubtitleLoaded(evt, data))\n this._hls.on(HLSJS.Events.SUBTITLE_TRACKS_UPDATED, () => this._ccTracksUpdated = true)\n this.bindCustomListeners()\n }\n\n bindCustomListeners() {\n this.customListeners.forEach(item => {\n const requestedEventName = item.eventName\n const typeOfListener = item.once ? 'once': 'on'\n requestedEventName && this._hls[`${typeOfListener}`](requestedEventName, item.callback)\n })\n }\n\n unbindCustomListeners() {\n this.customListeners.forEach(item => {\n const requestedEventName = item.eventName\n requestedEventName && this._hls.off(requestedEventName, item.callback)\n })\n }\n\n _onFragmentParsingMetadata(evt, data) {\n this.trigger(Events.Custom.PLAYBACK_FRAGMENT_PARSING_METADATA, { evt, data })\n }\n\n render() {\n this._ready()\n return super.render()\n }\n\n _ready() {\n if (this._isReadyState) return\n !this._hls && this._setup()\n this._isReadyState = true\n this.trigger(Events.PLAYBACK_READY, this.name)\n }\n\n _recover(evt, data, error) {\n if (!this._recoveredDecodingError) {\n this._recoveredDecodingError = true\n this._hls.recoverMediaError()\n this.play()\n } else if (!this._recoveredAudioCodecError) {\n this._recoveredAudioCodecError = true\n this._hls.swapAudioCodec()\n this._hls.recoverMediaError()\n this.play()\n } else {\n Log.error('hlsjs: failed to recover', { evt, data })\n error.level = PlayerError.Levels.FATAL\n const formattedError = this.createError(error)\n this.trigger(Events.PLAYBACK_ERROR, formattedError)\n this.stop()\n }\n }\n\n // override\n // this playback manages the src on the video element itself\n _setupSrc(srcUrl) {} // eslint-disable-line no-unused-vars\n\n _startTimeUpdateTimer() {\n if (this._timeUpdateTimer) return\n this._timeUpdateTimer = setInterval(() => {\n this._onDurationChange()\n this._onTimeUpdate()\n }, 100)\n }\n\n _stopTimeUpdateTimer() {\n if (!this._timeUpdateTimer) return\n clearInterval(this._timeUpdateTimer)\n this._timeUpdateTimer = null\n }\n\n getProgramDateTime() {\n return this._programDateTime\n }\n\n // the duration on the video element itself should not be used\n // as this does not necesarily represent the duration of the stream\n // https://github.com/clappr/clappr/issues/668#issuecomment-157036678\n getDuration() {\n return this._duration\n }\n\n getCurrentTime() {\n // e.g. can be < 0 if user pauses near the start\n // eventually they will then be kicked to the end by hlsjs if they run out of buffer\n // before the official start time\n return Math.max(0, this.el.currentTime - this._startTime)\n }\n\n // the time that \"0\" now represents relative to when playback started\n // for a stream with a sliding window this will increase as content is\n // removed from the beginning\n getStartTimeOffset() {\n return this._startTime\n }\n\n seekPercentage(percentage) {\n const seekTo = (percentage > 0)\n ? this._duration * (percentage / 100)\n : this._duration\n this.seek(seekTo)\n }\n\n seek(time) {\n if (time < 0) {\n Log.warn('Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point.')\n time = this.getDuration()\n }\n time += this._startTime\n this.el.currentTime = time\n }\n\n seekToLivePoint() {\n this.seek(this.getDuration())\n }\n\n _updateSettings() {\n if (this._playbackType === Playback.VOD)\n this.settings.left = ['playpause', 'position', 'duration']\n else if (this.dvrEnabled)\n this.settings.left = ['playpause']\n else\n this.settings.left = ['playstop']\n\n this.settings.seekEnabled = this.isSeekEnabled()\n this.trigger(Events.PLAYBACK_SETTINGSUPDATE)\n }\n\n _onHLSJSError(evt, data) {\n const error = {\n code: `${data.type}_${data.details}`,\n description: `${this.name} error: type: ${data.type}, details: ${data.details}`,\n raw: data,\n }\n let formattedError\n if (data.response) error.description += `, response: ${JSON.stringify(data.response)}`\n // only report/handle errors if they are fatal\n // hlsjs should automatically handle non fatal errors\n if (data.fatal) {\n if (this._recoverAttemptsRemaining > 0) {\n this._recoverAttemptsRemaining -= 1\n switch (data.type) {\n case HLSJS.ErrorTypes.NETWORK_ERROR:\n switch (data.details) {\n // The following network errors cannot be recovered with HLS.startLoad()\n // For more details, see https://github.com/video-dev/hls.js/blob/master/doc/design.md#error-detection-and-handling\n // For \"level load\" fatal errors, see https://github.com/video-dev/hls.js/issues/1138\n case HLSJS.ErrorDetails.MANIFEST_LOAD_ERROR:\n case HLSJS.ErrorDetails.MANIFEST_LOAD_TIMEOUT:\n case HLSJS.ErrorDetails.MANIFEST_PARSING_ERROR:\n case HLSJS.ErrorDetails.LEVEL_LOAD_ERROR:\n case HLSJS.ErrorDetails.LEVEL_LOAD_TIMEOUT:\n Log.error('hlsjs: unrecoverable network fatal error.', { evt, data })\n formattedError = this.createError(error)\n this.trigger(Events.PLAYBACK_ERROR, formattedError)\n this.stop()\n break\n default:\n Log.warn('hlsjs: trying to recover from network error.', { evt, data })\n error.level = PlayerError.Levels.WARN\n this._hls.startLoad()\n break\n }\n break\n case HLSJS.ErrorTypes.MEDIA_ERROR:\n Log.warn('hlsjs: trying to recover from media error.', { evt, data })\n error.level = PlayerError.Levels.WARN\n this._recover(evt, data, error)\n break\n default:\n Log.error('hlsjs: could not recover from error.', { evt, data })\n formattedError = this.createError(error)\n this.trigger(Events.PLAYBACK_ERROR, formattedError)\n this.stop()\n break\n }\n } else {\n Log.error('hlsjs: could not recover from error after maximum number of attempts.', { evt, data })\n formattedError = this.createError(error)\n this.trigger(Events.PLAYBACK_ERROR, formattedError)\n this.stop()\n }\n } else {\n // Transforms HLSJS.ErrorDetails.KEY_LOAD_ERROR non-fatal error to\n // playback fatal error if triggerFatalErrorOnResourceDenied playback\n // option is set. HLSJS.ErrorTypes.KEY_SYSTEM_ERROR are fatal errors\n // and therefore already handled.\n if (this.options.playback.triggerFatalErrorOnResourceDenied && this._keyIsDenied(data)) {\n Log.error('hlsjs: could not load decrypt key.', { evt, data })\n formattedError = this.createError(error)\n this.trigger(Events.PLAYBACK_ERROR, formattedError)\n this.stop()\n return\n }\n\n error.level = PlayerError.Levels.WARN\n Log.warn('hlsjs: non-fatal error occurred', { evt, data })\n }\n }\n\n _keyIsDenied(data) {\n return data.type === HLSJS.ErrorTypes.NETWORK_ERROR\n && data.details === HLSJS.ErrorDetails.KEY_LOAD_ERROR\n && data.response\n && data.response.code >= 400\n }\n\n _onTimeUpdate() {\n const update = { current: this.getCurrentTime(), total: this.getDuration(), firstFragDateTime: this.getProgramDateTime() }\n const shouldThrottle = this._shouldThrottleTimeUpdate(update)\n if (shouldThrottle) return\n this._lastTimeUpdate = update\n this._lastTimeUpdateFiredTime = this._now\n this.trigger(Events.PLAYBACK_TIMEUPDATE, update, this.name)\n }\n\n _shouldThrottleTimeUpdate(update) {\n const isSameTime = Math.abs(update.current - this._lastTimeUpdate.current) < this._timeUpdateFiringRate\n const isSameDuration = Math.abs(update.total - this._lastTimeUpdate.total) < this._durationChangeMinOffset\n const isSameFirstFragDateTime = update.firstFragDateTime === this._lastTimeUpdate.firstFragDateTime\n const isSameEventPayload = isSameTime && isSameDuration && isSameFirstFragDateTime\n const isThrottled = this._now - this._lastTimeUpdateFiredTime < this._timeUpdateThrottleDelay\n\n return isSameEventPayload && isThrottled\n }\n\n _onDurationChange() {\n const duration = this.getDuration()\n const isSameDuration = Math.abs(this._lastDuration - duration) < this._durationChangeMinOffset\n if (isSameDuration) return\n this._lastDuration = duration\n super._onDurationChange()\n }\n\n _onProgress() {\n if (!this.el.buffered.length) return\n let buffered = []\n let bufferedPos = 0\n for (let i = 0; i < this.el.buffered.length; i++) {\n buffered = [...buffered, {\n // for a stream with sliding window dvr something that is buffered my slide off the start of the timeline\n start: Math.max(0, this.el.buffered.start(i) - this._playableRegionStartTime),\n end: Math.max(0, this.el.buffered.end(i) - this._playableRegionStartTime)\n }]\n if (this.el.currentTime >= buffered[i].start && this.el.currentTime <= buffered[i].end)\n bufferedPos = i\n\n }\n const progress = {\n start: buffered[bufferedPos].start,\n current: buffered[bufferedPos].end,\n total: this.getDuration()\n }\n this.trigger(Events.PLAYBACK_PROGRESS, progress, buffered)\n }\n\n load(url) { \n this._stopTimeUpdateTimer()\n this.options.src = url\n this._setup()\n }\n\n play() {\n !this._hls && this._setup()\n !this._manifestLoading && !this.options.hlsPlayback.preload && this._hls.loadSource(this.options.src)\n super.play()\n this._startTimeUpdateTimer()\n }\n\n pause() {\n if (!this._hls) return\n this.el.pause()\n }\n\n stop() {\n this._stopTimeUpdateTimer()\n if (this._hls) super.stop()\n this._destroyHLSInstance()\n }\n\n destroy() {\n this._stopTimeUpdateTimer()\n this._destroyHLSInstance()\n super.destroy()\n }\n\n _updatePlaybackType(evt, data) {\n this._playbackType = data.details.live ? Playback.LIVE : Playback.VOD\n this._onLevelUpdated(evt, data)\n // Live stream subtitle tracks detection hack (may not immediately available)\n if (this._ccTracksUpdated && this._playbackType === Playback.LIVE && this.hasClosedCaptionsTracks)\n this._onSubtitleLoaded()\n\n }\n\n _fillLevels() {\n this._levels = this._hls.levels.map((level, index) => {\n return { id: index, level: level, label: `${level.bitrate/1000}Kbps` }\n })\n this.trigger(Events.PLAYBACK_LEVELS_AVAILABLE, this._levels)\n }\n\n _onLevelUpdated(evt, data) {\n this._segmentTargetDuration = data.details.targetduration\n this._playlistType = data.details.type || null\n let startTimeChanged = false\n let durationChanged = false\n let fragments = data.details.fragments\n let previousPlayableRegionStartTime = this._playableRegionStartTime\n let previousPlayableRegionDuration = this._playableRegionDuration\n if (fragments.length === 0) return\n // #EXT-X-PROGRAM-DATE-TIME\n if (fragments[0].rawProgramDateTime)\n this._programDateTime = fragments[0].rawProgramDateTime\n if (this._playableRegionStartTime !== fragments[0].start) {\n startTimeChanged = true\n this._playableRegionStartTime = fragments[0].start\n }\n\n if (startTimeChanged) {\n if (!this._localStartTimeCorrelation) {\n // set the correlation to map to middle of the extrapolation window\n this._localStartTimeCorrelation = {\n local: this._now,\n remote: (fragments[0].start + (this._extrapolatedWindowDuration/2)) * 1000\n }\n } else {\n // check if the correlation still works\n let corr = this._localStartTimeCorrelation\n let timePassed = this._now - corr.local\n // this should point to a time within the extrapolation window\n let startTime = (corr.remote + timePassed) / 1000\n if (startTime < fragments[0].start) {\n // our start time is now earlier than the first chunk\n // (maybe the chunk was removed early)\n // reset correlation so that it sits at the beginning of the first available chunk\n this._localStartTimeCorrelation = {\n local: this._now,\n remote: fragments[0].start * 1000\n }\n } else if (startTime > previousPlayableRegionStartTime + this._extrapolatedWindowDuration) {\n // start time was past the end of the old extrapolation window (so would have been capped)\n // see if now that time would be inside the window, and if it would be set the correlation\n // so that it resumes from the time it was at at the end of the old window\n // update the correlation so that the time starts counting again from the value it's on now\n this._localStartTimeCorrelation = {\n local: this._now,\n remote: Math.max(fragments[0].start, previousPlayableRegionStartTime + this._extrapolatedWindowDuration) * 1000\n }\n }\n }\n }\n \n let newDuration = data.details.totalduration\n // if it's a live stream then shorten the duration to remove access\n // to the area after hlsjs's live sync point\n // seeks to areas after this point sometimes have issues\n if (this._playbackType === Playback.LIVE) {\n let fragmentTargetDuration = data.details.targetduration\n let hlsjsConfig = this.options.playback.hlsjsConfig || {}\n let liveSyncDurationCount = hlsjsConfig.liveSyncDurationCount || HLSJS.DefaultConfig.liveSyncDurationCount\n let hiddenAreaDuration = fragmentTargetDuration * liveSyncDurationCount\n if (hiddenAreaDuration <= newDuration) {\n newDuration -= hiddenAreaDuration\n this._durationExcludesAfterLiveSyncPoint = true\n } else { this._durationExcludesAfterLiveSyncPoint = false }\n\n }\n if (newDuration !== this._playableRegionDuration) {\n durationChanged = true\n this._playableRegionDuration = newDuration\n }\n // Note the end time is not the playableRegionDuration\n // The end time will always increase even if content is removed from the beginning\n let endTime = fragments[0].start + newDuration\n let previousEndTime = previousPlayableRegionStartTime + previousPlayableRegionDuration\n let endTimeChanged = endTime !== previousEndTime\n if (endTimeChanged) {\n if (!this._localEndTimeCorrelation) {\n // set the correlation to map to the end\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: endTime * 1000\n }\n } else {\n // check if the correlation still works\n let corr = this._localEndTimeCorrelation\n let timePassed = this._now - corr.local\n // this should point to a time within the extrapolation window from the end\n let extrapolatedEndTime = (corr.remote + timePassed) / 1000\n if (extrapolatedEndTime > endTime) {\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: endTime * 1000\n }\n } else if (extrapolatedEndTime < endTime - this._extrapolatedWindowDuration) {\n // our extrapolated end time is now earlier than the extrapolation window from the actual end time\n // (maybe a chunk became available early)\n // reset correlation so that it sits at the beginning of the extrapolation window from the end time\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: (endTime - this._extrapolatedWindowDuration) * 1000\n }\n } else if (extrapolatedEndTime > previousEndTime) {\n // end time was past the old end time (so would have been capped)\n // set the correlation so that it resumes from the time it was at at the end of the old window\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: previousEndTime * 1000\n }\n }\n }\n }\n\n // now that the values have been updated call any methods that use on them so they get the updated values\n // immediately\n durationChanged && this._onDurationChange()\n startTimeChanged && this._onProgress()\n }\n\n _onFragmentChanged(evt, data) {\n this._currentFragment = data.frag\n this.trigger(Events.Custom.PLAYBACK_FRAGMENT_CHANGED, data)\n }\n\n _onFragmentLoaded(evt, data) {\n this.trigger(Events.PLAYBACK_FRAGMENT_LOADED, data)\n }\n\n _onFragmentBuffered(evt, data) {\n this.trigger(Events.PLAYBACK_FRAGMENT_BUFFERED, data)\n }\n\n _onSubtitleLoaded() {\n // This event may be triggered multiple times\n // Setup CC only once (disable CC by default)\n if (!this._ccIsSetup) {\n this.trigger(Events.PLAYBACK_SUBTITLE_AVAILABLE)\n const trackId = this._playbackType === Playback.LIVE ? -1 : this.closedCaptionsTrackId\n this.closedCaptionsTrackId = trackId\n this._ccIsSetup = true\n }\n }\n\n _onLevelSwitch(evt, data) {\n if (!this.levels.length) this._fillLevels()\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH_END)\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH, data)\n let currentLevel = this._hls.levels[data.level]\n if (currentLevel) {\n // TODO should highDefinition be private and maybe have a read only accessor if it's used somewhere\n this.highDefinition = (currentLevel.height >= 720 || (currentLevel.bitrate / 1000) >= 2000)\n this.trigger(Events.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinition)\n this.trigger(Events.PLAYBACK_BITRATE, {\n height: currentLevel.height,\n width: currentLevel.width,\n bandwidth: currentLevel.bitrate,\n bitrate: currentLevel.bitrate,\n level: data.level\n })\n }\n }\n\n get dvrEnabled() {\n // enabled when:\n // - the duration does not include content after hlsjs's live sync point\n // - the playable region duration is longer than the configured duration to enable dvr after\n // - the playback type is LIVE.\n return (this._durationExcludesAfterLiveSyncPoint && this._duration >= this._minDvrSize && this.getPlaybackType() === Playback.LIVE)\n }\n\n getPlaybackType() {\n return this._playbackType\n }\n\n isSeekEnabled() {\n return (this._playbackType === Playback.VOD || this.dvrEnabled)\n }\n}\n\nHlsjsPlayback.canPlay = function(resource, mimeType) {\n const resourceParts = resource.split('?')[0].match(/.*\\.(.*)$/) || []\n const isHls = ((resourceParts.length > 1 && resourceParts[1].toLowerCase() === 'm3u8') || listContainsIgnoreCase(mimeType, ['application/vnd.apple.mpegurl', 'application/x-mpegURL']))\n return !!(HLSJS.isSupported() && isHls)\n}\n"],"names":["now","Utils","listContainsIgnoreCase","Events","register","HlsjsPlayback","_HTML5Video","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","this","concat","options","hlsPlayback","_objectSpread","defaultOptions","_timeUpdateThrottleDelay","_timeUpdateFiringRate","_durationChangeMinOffset","_setInitialState","_inherits","key","get","HLSJS","min","_levels","_currentLevel","undefined","set","id","trigger","PLAYBACK_LEVEL_SWITCH_START","playback","hlsUseNextLevel","_hls","nextLevel","currentLevel","_isReadyState","latency","liveSyncPosition","playingDate","_playbackType","Playback","LIVE","_playlistType","_extrapolatedStartTime","_playableRegionStartTime","_localStartTimeCorrelation","corr","timePassed","_now","local","extrapolatedWindowStartTime","remote","Math","_extrapolatedWindowDuration","actualEndTime","_playableRegionDuration","_localEndTimeCorrelation","correlation","extrapolatedEndTime","max","_extrapolatedEndTime","_startTime","_segmentTargetDuration","_extrapolatedWindowNumSegments","bandwidthEstimate","preload","customListeners","src","_currentFragment","programDateTime","el","currentTime","start","value","_minDvrSize","hlsMinimumDvrSize","extrapolatedWindowNumSegments","VOD","_lastTimeUpdate","current","total","firstFragDateTime","_lastTimeUpdateFiredTime","_lastDuration","_programDateTime","_durationExcludesAfterLiveSyncPoint","_recoverAttemptsRemaining","hlsRecoverAttempts","_destroyHLSInstance","_createHLSInstance","_listenHLSEvents","_attachHLSMedia","_manifestLoading","_ccIsSetup","_ccTracksUpdated","destroy","config","hlsjsConfig","attachMedia","_this2","once","MEDIA_ATTACHED","loadSource","on","MANIFEST_LOADING","LEVEL_LOADED","evt","data","_updatePlaybackType","LEVEL_UPDATED","_onLevelUpdated","LEVEL_SWITCHED","_onLevelSwitch","FRAG_CHANGED","_onFragmentChanged","FRAG_LOADED","_onFragmentLoaded","FRAG_BUFFERED","_onFragmentBuffered","FRAG_PARSING_METADATA","_onFragmentParsingMetadata","ERROR","_onHLSJSError","SUBTITLE_TRACK_LOADED","_onSubtitleLoaded","SUBTITLE_TRACKS_UPDATED","bindCustomListeners","_this3","forEach","item","requestedEventName","eventName","typeOfListener","callback","_this4","off","Custom","PLAYBACK_FRAGMENT_PARSING_METADATA","_ready","_superPropGet","_setup","PLAYBACK_READY","name","error","_recoveredDecodingError","_recoveredAudioCodecError","Log","level","PlayerError","Levels","FATAL","formattedError","createError","PLAYBACK_ERROR","stop","swapAudioCodec","recoverMediaError","play","srcUrl","_this5","_timeUpdateTimer","setInterval","_onDurationChange","_onTimeUpdate","clearInterval","_duration","percentage","seekTo","seek","time","warn","getDuration","settings","left","dvrEnabled","seekEnabled","isSeekEnabled","PLAYBACK_SETTINGSUPDATE","code","type","details","description","raw","response","JSON","stringify","fatal","ErrorTypes","NETWORK_ERROR","ErrorDetails","MANIFEST_LOAD_ERROR","MANIFEST_LOAD_TIMEOUT","MANIFEST_PARSING_ERROR","LEVEL_LOAD_ERROR","LEVEL_LOAD_TIMEOUT","WARN","startLoad","MEDIA_ERROR","_recover","triggerFatalErrorOnResourceDenied","_keyIsDenied","KEY_LOAD_ERROR","update","getCurrentTime","getProgramDateTime","_shouldThrottleTimeUpdate","PLAYBACK_TIMEUPDATE","isSameTime","abs","isSameDuration","isSameFirstFragDateTime","isSameEventPayload","isThrottled","duration","buffered","bufferedPos","i","_toConsumableArray","end","progress","PLAYBACK_PROGRESS","url","_stopTimeUpdateTimer","_startTimeUpdateTimer","pause","live","hasClosedCaptionsTracks","levels","map","index","label","bitrate","PLAYBACK_LEVELS_AVAILABLE","targetduration","startTimeChanged","durationChanged","fragments","previousPlayableRegionStartTime","previousPlayableRegionDuration","rawProgramDateTime","startTime","newDuration","totalduration","hiddenAreaDuration","liveSyncDurationCount","DefaultConfig","endTime","previousEndTime","_onProgress","frag","PLAYBACK_FRAGMENT_CHANGED","PLAYBACK_FRAGMENT_LOADED","PLAYBACK_FRAGMENT_BUFFERED","PLAYBACK_SUBTITLE_AVAILABLE","trackId","closedCaptionsTrackId","_fillLevels","PLAYBACK_LEVEL_SWITCH_END","PLAYBACK_LEVEL_SWITCH","highDefinition","height","PLAYBACK_HIGHDEFINITIONUPDATE","PLAYBACK_BITRATE","width","bandwidth","getPlaybackType","HTML5Video","canPlay","resource","mimeType","resourceParts","split","match","isHls","toLowerCase","isSupported"],"mappings":"2tGAOA,IAAQA,EAAgCC,EAAKA,MAArCD,IAAKE,EAA2BD,EAAKA,MAAhCC,uBAIbC,EAAAA,OAAOC,SAAS,6BAChBD,EAAAA,OAAOC,SAAS,sCAEKC,IAAAA,WAAaC,GAoIhC,SAAAD,IAAqB,IAAAE,+FAAAC,MAAAH,GAAA,IAAA,IAAAI,EAAAC,UAAAC,OAANC,EAA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Q,iBAAkB,CACpCF,OAAQlO,EAAakO,OACrBG,MAAOrO,EAAaqO,MACpBC,UAAWtO,EAAaqM,QACxBA,QAASrM,EAAaqM,QACtBpF,MAAOxC,EAAKwC,QAGlB,GAAC,CAAAhI,IAAA,aAAAC,IAED,WAKE,OAAQZ,KAAK6E,qCAAuC7E,KAAK6J,WAAa7J,KAAKkE,aAAelE,KAAKiQ,oBAAsBjO,EAAAA,SAASC,IAChI,GAAC,CAAAtB,IAAA,kBAAAsD,MAED,WACE,OAAOjE,KAAK+B,aACd,GAAC,CAAApB,IAAA,gBAAAsD,MAED,WACE,OAAQjE,KAAK+B,gBAAkBC,EAAAA,SAASqC,KAAOrE,KAAKsK,UACtD,+FA3jBC,EAlIwC4F,qBAgsB3C7Q,EAAc8Q,QAAU,SAASC,EAAUC,GACzC,IAAMC,EAAgBF,EAASG,MAAM,KAAK,GAAGC,MAAM,cAAgB,GAC7DC,EAAUH,EAAc3Q,OAAS,GAAwC,SAAnC2Q,EAAc,GAAGI,eAA6BxR,EAAuBmR,EAAU,CAAC,gCAAiC,0BAC7J,SAAUxP,EAAK,QAAC8P,gBAAiBF,EACnC"}
1
+ {"version":3,"file":"hlsjs-playback.external.min.js","sources":["../src/hls.js"],"sourcesContent":["// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nimport { Events, HTML5Video, Log, Playback, PlayerError, Utils } from '@clappr/core'\nimport HLSJS from 'hls.js'\n\nconst { now, listContainsIgnoreCase } = Utils\nconst AUTO = -1\nconst DEFAULT_RECOVER_ATTEMPTS = 16\n\nEvents.register('PLAYBACK_FRAGMENT_CHANGED')\nEvents.register('PLAYBACK_FRAGMENT_PARSING_METADATA')\n\nexport default class HlsjsPlayback extends HTML5Video {\n get name() {\n return 'hls'\n }\n\n get supportedVersion() {\n return { min: CLAPPR_CORE_VERSION }\n }\n\n get levels() {\n return this._levels || []\n }\n\n get currentLevel() {\n if (this._currentLevel === null || this._currentLevel === undefined) {\n return AUTO\n } else {\n return this._currentLevel\n } // 0 is a valid level ID\n }\n\n get isReady() {\n return this._isReadyState\n }\n\n set currentLevel(id) {\n this._currentLevel = id\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH_START)\n if (this.options.playback.hlsUseNextLevel) {\n this._hls.nextLevel = this._currentLevel\n } else {\n this._hls.currentLevel = this._currentLevel\n }\n }\n\n get latency() {\n return this._hls.latency\n }\n\n get liveSyncPosition() {\n return this._hls.liveSyncPosition\n }\n\n get currentProgramDateTime() {\n return this._hls.playingDate\n }\n\n get _startTime() {\n if (this._playbackType === Playback.LIVE && this._playlistType !== 'EVENT') {\n return this._extrapolatedStartTime\n }\n\n return this._playableRegionStartTime\n }\n\n get _now() {\n return now()\n }\n\n // the time in the video element which should represent the start of the sliding window\n // extrapolated to increase in real time (instead of jumping as the early segments are removed)\n get _extrapolatedStartTime() {\n if (!this._localStartTimeCorrelation) {\n return this._playableRegionStartTime\n }\n\n const corr = this._localStartTimeCorrelation\n const timePassed = this._now - corr.local\n const extrapolatedWindowStartTime = (corr.remote + timePassed) / 1000\n // cap at the end of the extrapolated window duration\n return Math.min(\n extrapolatedWindowStartTime,\n this._playableRegionStartTime + this._extrapolatedWindowDuration\n )\n }\n\n // the time in the video element which should represent the end of the content\n // extrapolated to increase in real time (instead of jumping as segments are added)\n get _extrapolatedEndTime() {\n const actualEndTime = this._playableRegionStartTime + this._playableRegionDuration\n if (!this._localEndTimeCorrelation) return actualEndTime\n const correlation = this._localEndTimeCorrelation\n const timePassed = this._now - correlation.local\n const extrapolatedEndTime = (correlation.remote + timePassed) / 1000\n return Math.max(\n actualEndTime - this._extrapolatedWindowDuration,\n Math.min(extrapolatedEndTime, actualEndTime)\n )\n }\n\n get _duration() {\n return this._extrapolatedEndTime - this._startTime\n }\n\n // Returns the duration (seconds) of the window that the extrapolated start time is allowed\n // to move in before being capped.\n // The extrapolated start time should never reach the cap at the end of the window as the\n // window should slide as chunks are removed from the start.\n // This also applies to the extrapolated end time in the same way.\n //\n // If chunks aren't being removed for some reason that the start time will reach and remain fixed at\n // playableRegionStartTime + extrapolatedWindowDuration\n //\n // <-- window duration -->\n // I.e playableRegionStartTime |-----------------------|\n // | --> . . .\n // . --> | --> . .\n // . . --> | --> .\n // . . . --> |\n // . . . .\n // extrapolatedStartTime\n get _extrapolatedWindowDuration() {\n if (this._segmentTargetDuration === null) {\n return 0\n }\n\n return this._extrapolatedWindowNumSegments * this._segmentTargetDuration\n }\n\n get bandwidthEstimate() {\n return this._hls && this._hls.bandwidthEstimate\n }\n\n get defaultOptions() {\n return { preload: true }\n }\n\n get customListeners() {\n return (this.options.hlsPlayback && this.options.hlsPlayback.customListeners) || []\n }\n\n get sourceMedia() {\n return this.options.src\n }\n\n get currentTimestamp() {\n if (!this._currentFragment) return null\n const startTime = this._currentFragment.programDateTime\n const playbackTime = this.el.currentTime\n const playTimeOffSet = playbackTime - this._currentFragment.start\n const currentTimestampInMs = startTime + playTimeOffSet * 1000\n return currentTimestampInMs / 1000\n }\n\n static get HLSJS() {\n return HLSJS\n }\n\n constructor(...args) {\n super(...args)\n this.options.hlsPlayback = { ...this.defaultOptions, ...this.options.hlsPlayback }\n this._timeUpdateThrottleDelay = 200\n this._timeUpdateFiringRate = 0.2\n this._durationChangeMinOffset = 0.5\n this._setInitialState()\n }\n\n _setInitialState() {\n this._minDvrSize =\n typeof this.options.hlsMinimumDvrSize === 'undefined' ? 60 : this.options.hlsMinimumDvrSize\n // The size of the start time extrapolation window measured as a multiple of segments.\n // Should be 2 or higher, or 0 to disable. Should only need to be increased above 2 if more than one segment is\n // removed from the start of the playlist at a time. E.g if the playlist is cached for 10 seconds and new chunks are\n // added/removed every 5.\n this._extrapolatedWindowNumSegments =\n !this.options.playback ||\n typeof this.options.playback.extrapolatedWindowNumSegments === 'undefined'\n ? 2\n : this.options.playback.extrapolatedWindowNumSegments\n\n this._playbackType = Playback.VOD\n this._lastTimeUpdate = { current: 0, total: 0, firstFragDateTime: 0 }\n this._lastTimeUpdateFiredTime = 0\n this._lastDuration = null\n // for hls streams which have dvr with a sliding window,\n // the content at the start of the playlist is removed as new\n // content is appended at the end.\n // this means the actual playable start time will increase as the\n // start content is deleted\n // For streams with dvr where the entire recording is kept from the\n // beginning this should stay as 0\n this._playableRegionStartTime = 0\n // {local, remote} remote is the time in the video element that should represent 0\n // local is the system time when the 'remote' measurment took place\n this._localStartTimeCorrelation = null\n // {local, remote} remote is the time in the video element that should represents the end\n // local is the system time when the 'remote' measurment took place\n this._localEndTimeCorrelation = null\n // if content is removed from the beginning then this empty area should\n // be ignored. \"playableRegionDuration\" excludes the empty area\n this._playableRegionDuration = 0\n // #EXT-X-PROGRAM-DATE-TIME\n this._programDateTime = 0\n // true when the actual duration is longer than hlsjs's live sync point\n // when this is false playableRegionDuration will be the actual duration\n // when this is true playableRegionDuration will exclude the time after the sync point\n this._durationExcludesAfterLiveSyncPoint = false\n // #EXT-X-TARGETDURATION\n this._segmentTargetDuration = null\n // #EXT-X-PLAYLIST-TYPE\n this._playlistType = null\n this._recoverAttemptsRemaining = this.options.hlsRecoverAttempts || DEFAULT_RECOVER_ATTEMPTS\n }\n\n _setup() {\n this._destroyHLSInstance()\n this._createHLSInstance()\n this._listenHLSEvents()\n this._attachHLSMedia()\n }\n\n _destroyHLSInstance() {\n if (!this._hls) return\n this._manifestLoading = false\n this._ccIsSetup = false\n this._ccTracksUpdated = false\n this._setInitialState()\n this._hls.destroy()\n this._hls = null\n }\n\n _createHLSInstance() {\n const config = { ...this.options.playback.hlsjsConfig }\n this._hls = new HLSJS(config)\n }\n\n _attachHLSMedia() {\n if (!this._hls) return\n this._hls.attachMedia(this.el)\n }\n\n _listenHLSEvents() {\n if (!this._hls) return\n this._hls.once(HLSJS.Events.MEDIA_ATTACHED, () => {\n this.options.hlsPlayback.preload && this._hls.loadSource(this.options.src)\n })\n this._hls.on(HLSJS.Events.MANIFEST_LOADING, () => {\n this._manifestLoading = true\n })\n this._hls.on(HLSJS.Events.LEVEL_LOADED, (evt, data) => this._updatePlaybackType(evt, data))\n this._hls.on(HLSJS.Events.LEVEL_UPDATED, (evt, data) => this._onLevelUpdated(evt, data))\n this._hls.on(HLSJS.Events.LEVEL_SWITCHED, (evt, data) => this._onLevelSwitch(evt, data))\n this._hls.on(HLSJS.Events.FRAG_CHANGED, (evt, data) => this._onFragmentChanged(evt, data))\n this._hls.on(HLSJS.Events.FRAG_LOADED, (evt, data) => this._onFragmentLoaded(evt, data))\n this._hls.on(HLSJS.Events.FRAG_BUFFERED, (evt, data) => this._onFragmentBuffered(evt, data))\n this._hls.on(HLSJS.Events.FRAG_PARSING_METADATA, (evt, data) =>\n this._onFragmentParsingMetadata(evt, data)\n )\n this._hls.on(HLSJS.Events.ERROR, (evt, data) => this._onHLSJSError(evt, data))\n this._hls.on(HLSJS.Events.SUBTITLE_TRACK_LOADED, (evt, data) =>\n this._onSubtitleLoaded(evt, data)\n )\n this._hls.on(HLSJS.Events.SUBTITLE_TRACKS_UPDATED, () => (this._ccTracksUpdated = true))\n this.bindCustomListeners()\n }\n\n bindCustomListeners() {\n this.customListeners.forEach(item => {\n const requestedEventName = item.eventName\n const typeOfListener = item.once ? 'once' : 'on'\n requestedEventName && this._hls[`${typeOfListener}`](requestedEventName, item.callback)\n })\n }\n\n unbindCustomListeners() {\n this.customListeners.forEach(item => {\n const requestedEventName = item.eventName\n requestedEventName && this._hls.off(requestedEventName, item.callback)\n })\n }\n\n _onFragmentParsingMetadata(evt, data) {\n this.trigger(Events.Custom.PLAYBACK_FRAGMENT_PARSING_METADATA, { evt, data })\n }\n\n render() {\n this._ready()\n return super.render()\n }\n\n _ready() {\n if (this._isReadyState) return\n !this._hls && this._setup()\n this._isReadyState = true\n this.trigger(Events.PLAYBACK_READY, this.name)\n }\n\n _recover(evt, data, error) {\n if (!this._recoveredDecodingError) {\n this._recoveredDecodingError = true\n this._hls.recoverMediaError()\n this.play()\n } else if (!this._recoveredAudioCodecError) {\n this._recoveredAudioCodecError = true\n this._hls.swapAudioCodec()\n this._hls.recoverMediaError()\n this.play()\n } else {\n Log.error('hlsjs: failed to recover', { evt, data })\n error.level = PlayerError.Levels.FATAL\n const formattedError = this.createError(error)\n this.trigger(Events.PLAYBACK_ERROR, formattedError)\n this.stop()\n }\n }\n\n // override\n // this playback manages the src on the video element itself\n _setupSrc(srcUrl) {} // eslint-disable-line no-unused-vars\n\n _startTimeUpdateTimer() {\n if (this._timeUpdateTimer) return\n this._timeUpdateTimer = setInterval(() => {\n this._onDurationChange()\n this._onTimeUpdate()\n }, 100)\n }\n\n _stopTimeUpdateTimer() {\n if (!this._timeUpdateTimer) return\n clearInterval(this._timeUpdateTimer)\n this._timeUpdateTimer = null\n }\n\n getProgramDateTime() {\n return this._programDateTime\n }\n\n // the duration on the video element itself should not be used\n // as this does not necesarily represent the duration of the stream\n // https://github.com/clappr/clappr/issues/668#issuecomment-157036678\n getDuration() {\n return this._duration\n }\n\n getCurrentTime() {\n // e.g. can be < 0 if user pauses near the start\n // eventually they will then be kicked to the end by hlsjs if they run out of buffer\n // before the official start time\n return Math.max(0, this.el.currentTime - this._startTime)\n }\n\n // the time that \"0\" now represents relative to when playback started\n // for a stream with a sliding window this will increase as content is\n // removed from the beginning\n getStartTimeOffset() {\n return this._startTime\n }\n\n seekPercentage(percentage) {\n const seekTo = percentage > 0 ? this._duration * (percentage / 100) : this._duration\n this.seek(seekTo)\n }\n\n seek(time) {\n if (time < 0) {\n Log.warn(\n 'Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point.'\n )\n time = this.getDuration()\n }\n time += this._startTime\n this.el.currentTime = time\n }\n\n seekToLivePoint() {\n this.seek(this.getDuration())\n }\n\n _updateSettings() {\n if (this._playbackType === Playback.VOD) {\n this.settings.left = ['playpause', 'position', 'duration']\n } else if (this.dvrEnabled) {\n this.settings.left = ['playpause']\n } else {\n this.settings.left = ['playstop']\n }\n\n this.settings.seekEnabled = this.isSeekEnabled()\n this.trigger(Events.PLAYBACK_SETTINGSUPDATE)\n }\n\n _onHLSJSError(evt, data) {\n const error = {\n code: `${data.type}_${data.details}`,\n description: `${this.name} error: type: ${data.type}, details: ${data.details}`,\n raw: data\n }\n let formattedError\n if (data.response) error.description += `, response: ${JSON.stringify(data.response)}`\n // only report/handle errors if they are fatal\n // hlsjs should automatically handle non fatal errors\n if (data.fatal) {\n if (this._recoverAttemptsRemaining > 0) {\n this._recoverAttemptsRemaining -= 1\n switch (data.type) {\n case HLSJS.ErrorTypes.NETWORK_ERROR:\n switch (data.details) {\n // The following network errors cannot be recovered with HLS.startLoad()\n // For more details, see https://github.com/video-dev/hls.js/blob/master/doc/design.md#error-detection-and-handling\n // For \"level load\" fatal errors, see https://github.com/video-dev/hls.js/issues/1138\n case HLSJS.ErrorDetails.MANIFEST_LOAD_ERROR:\n case HLSJS.ErrorDetails.MANIFEST_LOAD_TIMEOUT:\n case HLSJS.ErrorDetails.MANIFEST_PARSING_ERROR:\n case HLSJS.ErrorDetails.LEVEL_LOAD_ERROR:\n case HLSJS.ErrorDetails.LEVEL_LOAD_TIMEOUT:\n Log.error('hlsjs: unrecoverable network fatal error.', { evt, data })\n formattedError = this.createError(error)\n this.trigger(Events.PLAYBACK_ERROR, formattedError)\n this.stop()\n break\n default:\n Log.warn('hlsjs: trying to recover from network error.', { evt, data })\n error.level = PlayerError.Levels.WARN\n this._hls.startLoad()\n break\n }\n break\n case HLSJS.ErrorTypes.MEDIA_ERROR:\n Log.warn('hlsjs: trying to recover from media error.', { evt, data })\n error.level = PlayerError.Levels.WARN\n this._recover(evt, data, error)\n break\n default:\n Log.error('hlsjs: could not recover from error.', { evt, data })\n formattedError = this.createError(error)\n this.trigger(Events.PLAYBACK_ERROR, formattedError)\n this.stop()\n break\n }\n } else {\n Log.error('hlsjs: could not recover from error after maximum number of attempts.', {\n evt,\n data\n })\n formattedError = this.createError(error)\n this.trigger(Events.PLAYBACK_ERROR, formattedError)\n this.stop()\n }\n } else {\n // Transforms HLSJS.ErrorDetails.KEY_LOAD_ERROR non-fatal error to\n // playback fatal error if triggerFatalErrorOnResourceDenied playback\n // option is set. HLSJS.ErrorTypes.KEY_SYSTEM_ERROR are fatal errors\n // and therefore already handled.\n if (this.options.playback.triggerFatalErrorOnResourceDenied && this._keyIsDenied(data)) {\n Log.error('hlsjs: could not load decrypt key.', { evt, data })\n formattedError = this.createError(error)\n this.trigger(Events.PLAYBACK_ERROR, formattedError)\n this.stop()\n return\n }\n\n error.level = PlayerError.Levels.WARN\n Log.warn('hlsjs: non-fatal error occurred', { evt, data })\n }\n }\n\n _keyIsDenied(data) {\n return (\n data.type === HLSJS.ErrorTypes.NETWORK_ERROR &&\n data.details === HLSJS.ErrorDetails.KEY_LOAD_ERROR &&\n data.response &&\n data.response.code >= 400\n )\n }\n\n _onTimeUpdate() {\n const update = {\n current: this.getCurrentTime(),\n total: this.getDuration(),\n firstFragDateTime: this.getProgramDateTime()\n }\n const shouldThrottle = this._shouldThrottleTimeUpdate(update)\n if (shouldThrottle) return\n this._lastTimeUpdate = update\n this._lastTimeUpdateFiredTime = this._now\n this.trigger(Events.PLAYBACK_TIMEUPDATE, update, this.name)\n }\n\n _shouldThrottleTimeUpdate(update) {\n const isSameTime =\n Math.abs(update.current - this._lastTimeUpdate.current) < this._timeUpdateFiringRate\n const isSameDuration =\n Math.abs(update.total - this._lastTimeUpdate.total) < this._durationChangeMinOffset\n const isSameFirstFragDateTime =\n update.firstFragDateTime === this._lastTimeUpdate.firstFragDateTime\n const isSameEventPayload = isSameTime && isSameDuration && isSameFirstFragDateTime\n const isThrottled = this._now - this._lastTimeUpdateFiredTime < this._timeUpdateThrottleDelay\n\n return isSameEventPayload && isThrottled\n }\n\n _onDurationChange() {\n const duration = this.getDuration()\n const isSameDuration = Math.abs(this._lastDuration - duration) < this._durationChangeMinOffset\n if (isSameDuration) return\n this._lastDuration = duration\n super._onDurationChange()\n }\n\n _onProgress() {\n if (!this.el.buffered.length) return\n let buffered = []\n let bufferedPos = 0\n for (let i = 0; i < this.el.buffered.length; i++) {\n buffered = [\n ...buffered,\n {\n // for a stream with sliding window dvr something that is buffered my slide off the start of the timeline\n start: Math.max(0, this.el.buffered.start(i) - this._playableRegionStartTime),\n end: Math.max(0, this.el.buffered.end(i) - this._playableRegionStartTime)\n }\n ]\n if (this.el.currentTime >= buffered[i].start && this.el.currentTime <= buffered[i].end) {\n bufferedPos = i\n }\n }\n const progress = {\n start: buffered[bufferedPos].start,\n current: buffered[bufferedPos].end,\n total: this.getDuration()\n }\n this.trigger(Events.PLAYBACK_PROGRESS, progress, buffered)\n }\n\n load(url) {\n this._stopTimeUpdateTimer()\n this.options.src = url\n this._setup()\n }\n\n play() {\n !this._hls && this._setup()\n !this._manifestLoading &&\n !this.options.hlsPlayback.preload &&\n this._hls.loadSource(this.options.src)\n super.play()\n this._startTimeUpdateTimer()\n }\n\n pause() {\n if (!this._hls) return\n this.el.pause()\n }\n\n stop() {\n this._stopTimeUpdateTimer()\n if (this._hls) super.stop()\n this._destroyHLSInstance()\n }\n\n destroy() {\n this._stopTimeUpdateTimer()\n this._destroyHLSInstance()\n super.destroy()\n }\n\n _updatePlaybackType(evt, data) {\n this._playbackType = data.details.live ? Playback.LIVE : Playback.VOD\n this._onLevelUpdated(evt, data)\n // Live stream subtitle tracks detection hack (may not immediately available)\n if (\n this._ccTracksUpdated &&\n this._playbackType === Playback.LIVE &&\n this.hasClosedCaptionsTracks\n ) {\n this._onSubtitleLoaded()\n }\n }\n\n _fillLevels() {\n this._levels = this._hls.levels.map((level, index) => {\n return { id: index, level: level, label: `${level.bitrate / 1000}Kbps` }\n })\n this.trigger(Events.PLAYBACK_LEVELS_AVAILABLE, this._levels)\n }\n\n _onLevelUpdated(evt, data) {\n this._segmentTargetDuration = data.details.targetduration\n this._playlistType = data.details.type || null\n let startTimeChanged = false\n let durationChanged = false\n const fragments = data.details.fragments\n const previousPlayableRegionStartTime = this._playableRegionStartTime\n const previousPlayableRegionDuration = this._playableRegionDuration\n if (fragments.length === 0) return\n // #EXT-X-PROGRAM-DATE-TIME\n if (fragments[0].rawProgramDateTime) {\n this._programDateTime = fragments[0].rawProgramDateTime\n }\n if (this._playableRegionStartTime !== fragments[0].start) {\n startTimeChanged = true\n this._playableRegionStartTime = fragments[0].start\n }\n\n if (startTimeChanged) {\n if (!this._localStartTimeCorrelation) {\n // set the correlation to map to middle of the extrapolation window\n this._localStartTimeCorrelation = {\n local: this._now,\n remote: (fragments[0].start + this._extrapolatedWindowDuration / 2) * 1000\n }\n } else {\n // check if the correlation still works\n const corr = this._localStartTimeCorrelation\n const timePassed = this._now - corr.local\n // this should point to a time within the extrapolation window\n const startTime = (corr.remote + timePassed) / 1000\n if (startTime < fragments[0].start) {\n // our start time is now earlier than the first chunk\n // (maybe the chunk was removed early)\n // reset correlation so that it sits at the beginning of the first available chunk\n this._localStartTimeCorrelation = {\n local: this._now,\n remote: fragments[0].start * 1000\n }\n } else if (startTime > previousPlayableRegionStartTime + this._extrapolatedWindowDuration) {\n // start time was past the end of the old extrapolation window (so would have been capped)\n // see if now that time would be inside the window, and if it would be set the correlation\n // so that it resumes from the time it was at at the end of the old window\n // update the correlation so that the time starts counting again from the value it's on now\n this._localStartTimeCorrelation = {\n local: this._now,\n remote:\n Math.max(\n fragments[0].start,\n previousPlayableRegionStartTime + this._extrapolatedWindowDuration\n ) * 1000\n }\n }\n }\n }\n\n let newDuration = data.details.totalduration\n // if it's a live stream then shorten the duration to remove access\n // to the area after hlsjs's live sync point\n // seeks to areas after this point sometimes have issues\n if (this._playbackType === Playback.LIVE) {\n const fragmentTargetDuration = data.details.targetduration\n const hlsjsConfig = this.options.playback.hlsjsConfig || {}\n const liveSyncDurationCount =\n hlsjsConfig.liveSyncDurationCount || HLSJS.DefaultConfig.liveSyncDurationCount\n const hiddenAreaDuration = fragmentTargetDuration * liveSyncDurationCount\n if (hiddenAreaDuration <= newDuration) {\n newDuration -= hiddenAreaDuration\n this._durationExcludesAfterLiveSyncPoint = true\n } else {\n this._durationExcludesAfterLiveSyncPoint = false\n }\n }\n if (newDuration !== this._playableRegionDuration) {\n durationChanged = true\n this._playableRegionDuration = newDuration\n }\n // Note the end time is not the playableRegionDuration\n // The end time will always increase even if content is removed from the beginning\n const endTime = fragments[0].start + newDuration\n const previousEndTime = previousPlayableRegionStartTime + previousPlayableRegionDuration\n const endTimeChanged = endTime !== previousEndTime\n if (endTimeChanged) {\n if (!this._localEndTimeCorrelation) {\n // set the correlation to map to the end\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: endTime * 1000\n }\n } else {\n // check if the correlation still works\n const corr = this._localEndTimeCorrelation\n const timePassed = this._now - corr.local\n // this should point to a time within the extrapolation window from the end\n const extrapolatedEndTime = (corr.remote + timePassed) / 1000\n if (extrapolatedEndTime > endTime) {\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: endTime * 1000\n }\n } else if (extrapolatedEndTime < endTime - this._extrapolatedWindowDuration) {\n // our extrapolated end time is now earlier than the extrapolation window from the actual end time\n // (maybe a chunk became available early)\n // reset correlation so that it sits at the beginning of the extrapolation window from the end time\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: (endTime - this._extrapolatedWindowDuration) * 1000\n }\n } else if (extrapolatedEndTime > previousEndTime) {\n // end time was past the old end time (so would have been capped)\n // set the correlation so that it resumes from the time it was at at the end of the old window\n this._localEndTimeCorrelation = {\n local: this._now,\n remote: previousEndTime * 1000\n }\n }\n }\n }\n\n // now that the values have been updated call any methods that use on them so they get the updated values\n // immediately\n durationChanged && this._onDurationChange()\n startTimeChanged && this._onProgress()\n }\n\n _onFragmentChanged(evt, data) {\n this._currentFragment = data.frag\n this.trigger(Events.Custom.PLAYBACK_FRAGMENT_CHANGED, data)\n }\n\n _onFragmentLoaded(evt, data) {\n this.trigger(Events.PLAYBACK_FRAGMENT_LOADED, data)\n }\n\n _onFragmentBuffered(evt, data) {\n this.trigger(Events.PLAYBACK_FRAGMENT_BUFFERED, data)\n }\n\n _onSubtitleLoaded() {\n // This event may be triggered multiple times\n // Setup CC only once (disable CC by default)\n if (!this._ccIsSetup) {\n this.trigger(Events.PLAYBACK_SUBTITLE_AVAILABLE)\n const trackId = this._playbackType === Playback.LIVE ? -1 : this.closedCaptionsTrackId\n this.closedCaptionsTrackId = trackId\n this._ccIsSetup = true\n }\n }\n\n _onLevelSwitch(evt, data) {\n if (!this.levels.length) this._fillLevels()\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH_END)\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH, data)\n const currentLevel = this._hls.levels[data.level]\n if (currentLevel) {\n // TODO should highDefinition be private and maybe have a read only accessor if it's used somewhere\n this.highDefinition = currentLevel.height >= 720 || currentLevel.bitrate / 1000 >= 2000\n this.trigger(Events.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinition)\n this.trigger(Events.PLAYBACK_BITRATE, {\n height: currentLevel.height,\n width: currentLevel.width,\n bandwidth: currentLevel.bitrate,\n bitrate: currentLevel.bitrate,\n level: data.level\n })\n }\n }\n\n get dvrEnabled() {\n // enabled when:\n // - the duration does not include content after hlsjs's live sync point\n // - the playable region duration is longer than the configured duration to enable dvr after\n // - the playback type is LIVE.\n return (\n this._durationExcludesAfterLiveSyncPoint &&\n this._duration >= this._minDvrSize &&\n this.getPlaybackType() === Playback.LIVE\n )\n }\n\n getPlaybackType() {\n return this._playbackType\n }\n\n isSeekEnabled() {\n return this._playbackType === Playback.VOD || this.dvrEnabled\n }\n}\n\nHlsjsPlayback.canPlay = function (resource, mimeType) {\n const resourceParts = resource.split('?')[0].match(/.*\\.(.*)$/) || []\n const isHls =\n (resourceParts.length > 1 && resourceParts[1].toLowerCase() === 'm3u8') ||\n listContainsIgnoreCase(mimeType, ['application/vnd.apple.mpegurl', 'application/x-mpegURL'])\n return !!(HLSJS.isSupported() && isHls)\n}\n"],"names":["now","Utils","listContainsIgnoreCase","Events","register","HlsjsPlayback","_HTML5Video","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","this","concat","options","hlsPlayback","_objectSpread","defaultOptions","_timeUpdateThrottleDelay","_timeUpdateFiringRate","_durationChangeMinOffset","_setInitialState","_inherits","key","get","HLSJS","min","_levels","_currentLevel","undefined","set","id","trigger","PLAYBACK_LEVEL_SWITCH_START","playback","hlsUseNextLevel","_hls","nextLevel","currentLevel","_isReadyState","latency","liveSyncPosition","playingDate","_playbackType","Playback","LIVE","_playlistType","_extrapolatedStartTime","_playableRegionStartTime","_localStartTimeCorrelation","corr","timePassed","_now","local","extrapolatedWindowStartTime","remote","Math","_extrapolatedWindowDuration","actualEndTime","_playableRegionDuration","_localEndTimeCorrelation","correlation","extrapolatedEndTime","max","_extrapolatedEndTime","_startTime","_segmentTargetDuration","_extrapolatedWindowNumSegments","bandwidthEstimate","preload","customListeners","src","_currentFragment","programDateTime","el","currentTime","start","value","_minDvrSize","hlsMinimumDvrSize","extrapolatedWindowNumSegments","VOD","_lastTimeUpdate","current","total","firstFragDateTime","_lastTimeUpdateFiredTime","_lastDuration","_programDateTime","_durationExcludesAfterLiveSyncPoint","_recoverAttemptsRemaining","hlsRecoverAttempts","_destroyHLSInstance","_createHLSInstance","_listenHLSEvents","_attachHLSMedia","_manifestLoading","_ccIsSetup","_ccTracksUpdated","destroy","config","hlsjsConfig","attachMedia","_this2","once","MEDIA_ATTACHED","loadSource","on","MANIFEST_LOADING","LEVEL_LOADED","evt","data","_updatePlaybackType","LEVEL_UPDATED","_onLevelUpdated","LEVEL_SWITCHED","_onLevelSwitch","FRAG_CHANGED","_onFragmentChanged","FRAG_LOADED","_onFragmentLoaded","FRAG_BUFFERED","_onFragmentBuffered","FRAG_PARSING_METADATA","_onFragmentParsingMetadata","ERROR","_onHLSJSError","SUBTITLE_TRACK_LOADED","_onSubtitleLoaded","SUBTITLE_TRACKS_UPDATED","bindCustomListeners","_this3","forEach","item","requestedEventName","eventName","typeOfListener","callback","_this4","off","Custom","PLAYBACK_FRAGMENT_PARSING_METADATA","_ready","_superPropGet","_setup","PLAYBACK_READY","name","error","_recoveredDecodingError","_recoveredAudioCodecError","Log","level","PlayerError","Levels","FATAL","formattedError","createError","PLAYBACK_ERROR","stop","swapAudioCodec","recoverMediaError","play","srcUrl","_this5","_timeUpdateTimer","setInterval","_onDurationChange","_onTimeUpdate","clearInterval","_duration","percentage","seekTo","seek","time","warn","getDuration","settings","left","dvrEnabled","seekEnabled","isSeekEnabled","PLAYBACK_SETTINGSUPDATE","code","type","details","description","raw","response","JSON","stringify","fatal","ErrorTypes","NETWORK_ERROR","ErrorDetails","MANIFEST_LOAD_ERROR","MANIFEST_LOAD_TIMEOUT","MANIFEST_PARSING_ERROR","LEVEL_LOAD_ERROR","LEVEL_LOAD_TIMEOUT","WARN","startLoad","MEDIA_ERROR","_recover","triggerFatalErrorOnResourceDenied","_keyIsDenied","KEY_LOAD_ERROR","update","getCurrentTime","getProgramDateTime","_shouldThrottleTimeUpdate","PLAYBACK_TIMEUPDATE","isSameTime","abs","isSameDuration","isSameFirstFragDateTime","isSameEventPayload","isThrottled","duration","buffered","bufferedPos","i","_toConsumableArray","end","progress","PLAYBACK_PROGRESS","url","_stopTimeUpdateTimer","_startTimeUpdateTimer","pause","live","hasClosedCaptionsTracks","levels","map","index","label","bitrate","PLAYBACK_LEVELS_AVAILABLE","targetduration","startTimeChanged","durationChanged","fragments","previousPlayableRegionStartTime","previousPlayableRegionDuration","rawProgramDateTime","startTime","newDuration","totalduration","hiddenAreaDuration","liveSyncDurationCount","DefaultConfig","endTime","previousEndTime","_onProgress","frag","PLAYBACK_FRAGMENT_CHANGED","PLAYBACK_FRAGMENT_LOADED","PLAYBACK_FRAGMENT_BUFFERED","PLAYBACK_SUBTITLE_AVAILABLE","trackId","closedCaptionsTrackId","_fillLevels","PLAYBACK_LEVEL_SWITCH_END","PLAYBACK_LEVEL_SWITCH","highDefinition","height","PLAYBACK_HIGHDEFINITIONUPDATE","PLAYBACK_BITRATE","width","bandwidth","getPlaybackType","HTML5Video","canPlay","resource","mimeType","resourceParts","split","match","isHls","toLowerCase","isSupported"],"mappings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