@clappr/hlsjs-playback 3.0.1 → 3.0.3

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.
@@ -22,20 +22,20 @@ function _classCallCheck(a, n) {
22
22
  function _defineProperties(e, r) {
23
23
  for (var t = 0; t < r.length; t++) {
24
24
  var o = r[t];
25
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
25
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
26
26
  }
27
27
  }
28
28
  function _createClass(e, r, t) {
29
29
  return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
30
- writable: !1
30
+ writable: false
31
31
  }), e;
32
32
  }
33
33
  function _defineProperty(e, r, t) {
34
34
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
35
35
  value: t,
36
- enumerable: !0,
37
- configurable: !0,
38
- writable: !0
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true
39
39
  }) : e[r] = t, e;
40
40
  }
41
41
  function _get() {
@@ -57,11 +57,11 @@ function _inherits(t, e) {
57
57
  t.prototype = Object.create(e && e.prototype, {
58
58
  constructor: {
59
59
  value: t,
60
- writable: !0,
61
- configurable: !0
60
+ writable: true,
61
+ configurable: true
62
62
  }
63
63
  }), Object.defineProperty(t, "prototype", {
64
- writable: !1
64
+ writable: false
65
65
  }), e && _setPrototypeOf(t, e);
66
66
  }
67
67
  function _isNativeReflectConstruct() {
@@ -91,7 +91,7 @@ function ownKeys(e, r) {
91
91
  function _objectSpread2(e) {
92
92
  for (var r = 1; r < arguments.length; r++) {
93
93
  var t = null != arguments[r] ? arguments[r] : {};
94
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
94
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
95
95
  _defineProperty(e, r, t[r]);
96
96
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
97
97
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
@@ -114,7 +114,7 @@ function _superPropBase(t, o) {
114
114
  return t;
115
115
  }
116
116
  function _superPropGet(t, o, e, r) {
117
- var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e);
117
+ var p = _get(_getPrototypeOf(t.prototype ), o, e);
118
118
  return 2 & r && "function" == typeof p ? function (t) {
119
119
  return p.apply(e, t);
120
120
  } : p;
@@ -126,11 +126,11 @@ function _toPrimitive(t, r) {
126
126
  if ("object" != typeof t || !t) return t;
127
127
  var e = t[Symbol.toPrimitive];
128
128
  if (void 0 !== e) {
129
- var i = e.call(t, r || "default");
129
+ var i = e.call(t, r);
130
130
  if ("object" != typeof i) return i;
131
131
  throw new TypeError("@@toPrimitive must return a primitive value.");
132
132
  }
133
- return ("string" === r ? String : Number)(t);
133
+ return (String )(t);
134
134
  }
135
135
  function _toPropertyKey(t) {
136
136
  var i = _toPrimitive(t, "string");
@@ -178,7 +178,7 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
178
178
  key: "supportedVersion",
179
179
  get: function get() {
180
180
  return {
181
- min: "0.16.1"
181
+ min: "0.16.3"
182
182
  };
183
183
  }
184
184
  }, {
@@ -518,7 +518,7 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
518
518
  // this playback manages the src on the video element itself
519
519
  }, {
520
520
  key: "_setupSrc",
521
- value: function _setupSrc(srcUrl) {} // eslint-disable-line no-unused-vars
521
+ value: function _setupSrc(srcUrl) {}
522
522
  }, {
523
523
  key: "_startTimeUpdateTimer",
524
524
  value: function _startTimeUpdateTimer() {
@@ -1 +1 @@
1
- {"version":3,"file":"hlsjs-playback.esm.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\nif (!HLSJS) {\n throw new Error('@clappr/hlsjs-playback requires hls.js (^1) to be loaded before it')\n}\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 // the frame rate should be retrieved from the HLS.js level information\n // as it is not necessarily exposed directly by the video element\n getFrameRate() {\n if (this._hls && this._hls.levels && this._hls.currentLevel >= 0) {\n const level = this._hls.levels[this._hls.currentLevel]\n return level && level.frameRate ? level.frameRate : null\n }\n return null\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 this.seek(this._duration * (percentage / 100))\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":["_objectSpread","corr","timePassed"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAI,CAAC,KAAK,EAAE;AACV,EAAA,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAA;AACvF,CAAA;AAEA,IAAQ,GAAG,GAA6B,KAAK,CAArC,GAAG;EAAE,sBAAsB,GAAK,KAAK,CAAhC,sBAAsB,CAAA;AACnC,IAAM,IAAI,GAAG,CAAC,CAAC,CAAA;AACf,IAAM,wBAAwB,GAAG,EAAE,CAAA;AAEnC,MAAM,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAA;AAC5C,MAAM,CAAC,QAAQ,CAAC,oCAAoC,CAAC,CAAA;AAAA,IAEhC,aAAa,gBAAA,UAAA,WAAA,EAAA;EAoJhC,SAAqB,aAAA,GAAA;AAAA,IAAA,IAAA,KAAA,CAAA;AAAA,IAAA,eAAA,CAAA,IAAA,EAAA,aAAA,CAAA,CAA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Aa,CAAA;AAC3B,KAAA;AAAC,GAAA,EAAA;AAAA,IAAA,GAAA,EAAA,eAAA;AAAA,IAAA,KAAA,EAED,sBAAa,GAAG;MACd,OAAO,IAAI,CAAC,aAAa,KAAK,QAAQ,CAAC,GAAG,IAAI,IAAI,CAAC,UAAU,CAAA;AAC/D,KAAA;AAAC,GAAA,CAAA,EAAA,CAAA;AAAA,IAAA,GAAA,EAAA,OAAA;AAAA,IAAA,GAAA,EApnBD,SAAmB,GAAA,GAAA;AACjB,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;AAAC,GAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAlJwC,UAAU,EAAA;AAuwBrD,aAAa,CAAC,OAAO,GAAG,UAAU,QAAQ,EAAE,QAAQ,EAAE;AACpD,EAAA,IAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,CAAA;AACrE,EAAA,IAAM,KAAK,GACR,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,IACtE,sBAAsB,CAAC,QAAQ,EAAE,CAAC,+BAA+B,EAAE,uBAAuB,CAAC,CAAC,CAAA;EAC9F,OAAO,CAAC,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,CAAA;AACzC,CAAC;;;;"}
1
+ {"version":3,"file":"hlsjs-playback.esm.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\nif (!HLSJS) {\n throw new Error('@clappr/hlsjs-playback requires hls.js (^1) to be loaded before it')\n}\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) {}\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 // the frame rate should be retrieved from the HLS.js level information\n // as it is not necessarily exposed directly by the video element\n getFrameRate() {\n if (this._hls && this._hls.levels && this._hls.currentLevel >= 0) {\n const level = this._hls.levels[this._hls.currentLevel]\n return level && level.frameRate ? level.frameRate : null\n }\n return null\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 this.seek(this._duration * (percentage / 100))\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":["_objectSpread","corr","timePassed"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAI,CAAC,KAAK,EAAE;AACV,EAAA,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAA;AACtF;AAEA,IAAQ,GAAG,GAA6B,KAAI,CAApC,GAAG;EAAE,sBAAsB,GAAK,KAAI,CAA/B,sBAAsB;AACnC,IAAM,IAAI,GAAG,EAAC;AACd,IAAM,wBAAwB,GAAG,EAAC;AAElC,MAAM,CAAC,QAAQ,CAAC,2BAA2B,CAAA;AAC3C,MAAM,CAAC,QAAQ,CAAC,oCAAoC,CAAA;AAAA,IAE/B,aAAa,gBAAA,UAAA,WAAA,EAAA;EAoJhC,SAAA,aAAA,GAAqB;AAAA,IAAA,IAAA,KAAA;AAAA,IAAA,eAAA,CAAA,IAAA,EAAA,aAAA,CAAA;AAAA,IAAA,KAAA,IAAA,IAAA,GAAA,SAAA,CAAA,MAAA,EAAN,IAAI,GAAA,IAAA,KAAA,CAAA,IAAA,CAAA,EAAA,IAAA,GAAA,CAAA,EAAA,IAAA,GAAA,IAAA,EAAA,IAAA,EAAA,EAAA;MAAJ,IAAI,CAAA,IAAA,CAAA,GAAA,SAAA,CAAA,IAAA,CAAA;AAAA,IAAA;AACjB,IAAA,KAAA,GAAA,UAAA,CAAA,IAAA,EAAA,aAA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,CAAC,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,KAAK,CAAA;AACxC,CAAA;;;;"}
@@ -25,20 +25,20 @@
25
25
  function _defineProperties(e, r) {
26
26
  for (var t = 0; t < r.length; t++) {
27
27
  var o = r[t];
28
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
28
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
29
29
  }
30
30
  }
31
31
  function _createClass(e, r, t) {
32
32
  return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
33
- writable: !1
33
+ writable: false
34
34
  }), e;
35
35
  }
36
36
  function _defineProperty(e, r, t) {
37
37
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
38
38
  value: t,
39
- enumerable: !0,
40
- configurable: !0,
41
- writable: !0
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true
42
42
  }) : e[r] = t, e;
43
43
  }
44
44
  function _get() {
@@ -60,11 +60,11 @@
60
60
  t.prototype = Object.create(e && e.prototype, {
61
61
  constructor: {
62
62
  value: t,
63
- writable: !0,
64
- configurable: !0
63
+ writable: true,
64
+ configurable: true
65
65
  }
66
66
  }), Object.defineProperty(t, "prototype", {
67
- writable: !1
67
+ writable: false
68
68
  }), e && _setPrototypeOf(t, e);
69
69
  }
70
70
  function _isNativeReflectConstruct() {
@@ -94,7 +94,7 @@
94
94
  function _objectSpread2(e) {
95
95
  for (var r = 1; r < arguments.length; r++) {
96
96
  var t = null != arguments[r] ? arguments[r] : {};
97
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
97
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
98
98
  _defineProperty(e, r, t[r]);
99
99
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
100
100
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
@@ -117,7 +117,7 @@
117
117
  return t;
118
118
  }
119
119
  function _superPropGet(t, o, e, r) {
120
- var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e);
120
+ var p = _get(_getPrototypeOf(t.prototype ), o, e);
121
121
  return 2 & r && "function" == typeof p ? function (t) {
122
122
  return p.apply(e, t);
123
123
  } : p;
@@ -129,11 +129,11 @@
129
129
  if ("object" != typeof t || !t) return t;
130
130
  var e = t[Symbol.toPrimitive];
131
131
  if (void 0 !== e) {
132
- var i = e.call(t, r || "default");
132
+ var i = e.call(t, r);
133
133
  if ("object" != typeof i) return i;
134
134
  throw new TypeError("@@toPrimitive must return a primitive value.");
135
135
  }
136
- return ("string" === r ? String : Number)(t);
136
+ return (String )(t);
137
137
  }
138
138
  function _toPropertyKey(t) {
139
139
  var i = _toPrimitive(t, "string");
@@ -181,7 +181,7 @@
181
181
  key: "supportedVersion",
182
182
  get: function get() {
183
183
  return {
184
- min: "0.16.1"
184
+ min: "0.16.3"
185
185
  };
186
186
  }
187
187
  }, {
@@ -521,7 +521,7 @@
521
521
  // this playback manages the src on the video element itself
522
522
  }, {
523
523
  key: "_setupSrc",
524
- value: function _setupSrc(srcUrl) {} // eslint-disable-line no-unused-vars
524
+ value: function _setupSrc(srcUrl) {}
525
525
  }, {
526
526
  key: "_startTimeUpdateTimer",
527
527
  value: function _startTimeUpdateTimer() {
@@ -1 +1 @@
1
- {"version":3,"file":"hlsjs-playback.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\nif (!HLSJS) {\n throw new Error('@clappr/hlsjs-playback requires hls.js (^1) to be loaded before it')\n}\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 // the frame rate should be retrieved from the HLS.js level information\n // as it is not necessarily exposed directly by the video element\n getFrameRate() {\n if (this._hls && this._hls.levels && this._hls.currentLevel >= 0) {\n const level = this._hls.levels[this._hls.currentLevel]\n return level && level.frameRate ? level.frameRate : null\n }\n return null\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 this.seek(this._duration * (percentage / 100))\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":["Utils","Events","_objectSpread","Playback","Log","PlayerError","corr","timePassed","HTML5Video"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOA,IAAI,CAAC,KAAK,EAAE;EACV,EAAA,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAA;EACvF,CAAA;EAEA,IAAQ,GAAG,GAA6BA,UAAK,CAArC,GAAG;IAAE,sBAAsB,GAAKA,UAAK,CAAhC,sBAAsB,CAAA;EACnC,IAAM,IAAI,GAAG,CAAC,CAAC,CAAA;EACf,IAAM,wBAAwB,GAAG,EAAE,CAAA;AAEnCC,aAAM,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAA;AAC5CA,aAAM,CAAC,QAAQ,CAAC,oCAAoC,CAAC,CAAA;AAAA,MAEhC,aAAa,gBAAA,UAAA,WAAA,EAAA;IAoJhC,SAAqB,aAAA,GAAA;EAAA,IAAA,IAAA,KAAA,CAAA;EAAA,IAAA,eAAA,CAAA,IAAA,EAAA,aAAA,CAAA,CAAA;EAAA,IAAA,KAAA,IAAA,IAAA,GAAA,SAAA,CAAA,MAAA,EAAN,IAAI,GAAA,IAAA,KAAA,CAAA,IAAA,CAAA,EAAA,IAAA,GAAA,CAAA,EAAA,IAAA,GAAA,IAAA,EAAA,IAAA,EA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I,CAAC,aAAa,KAAKA,aAAQ,CAAC,GAAG,IAAI,IAAI,CAAC,UAAU,CAAA;EAC/D,KAAA;EAAC,GAAA,CAAA,EAAA,CAAA;EAAA,IAAA,GAAA,EAAA,OAAA;EAAA,IAAA,GAAA,EApnBD,SAAmB,GAAA,GAAA;EACjB,MAAA,OAAO,KAAK,CAAA;EACd,KAAA;EAAC,GAAA,CAAA,CAAA,CAAA;EAAA,CAAA,CAlJwCK,eAAU,EAAA;EAuwBrD,aAAa,CAAC,OAAO,GAAG,UAAU,QAAQ,EAAE,QAAQ,EAAE;EACpD,EAAA,IAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,CAAA;EACrE,EAAA,IAAM,KAAK,GACR,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,IACtE,sBAAsB,CAAC,QAAQ,EAAE,CAAC,+BAA+B,EAAE,uBAAuB,CAAC,CAAC,CAAA;IAC9F,OAAO,CAAC,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,CAAA;EACzC,CAAC;;;;;;;;"}
1
+ {"version":3,"file":"hlsjs-playback.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\nif (!HLSJS) {\n throw new Error('@clappr/hlsjs-playback requires hls.js (^1) to be loaded before it')\n}\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) {}\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 // the frame rate should be retrieved from the HLS.js level information\n // as it is not necessarily exposed directly by the video element\n getFrameRate() {\n if (this._hls && this._hls.levels && this._hls.currentLevel >= 0) {\n const level = this._hls.levels[this._hls.currentLevel]\n return level && level.frameRate ? level.frameRate : null\n }\n return null\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 this.seek(this._duration * (percentage / 100))\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":["Utils","Events","_objectSpread","Playback","Log","PlayerError","corr","timePassed","HTML5Video"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOA,IAAI,CAAC,KAAK,EAAE;EACV,EAAA,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAA;EACtF;EAEA,IAAQ,GAAG,GAA6BA,UAAI,CAApC,GAAG;IAAE,sBAAsB,GAAKA,UAAI,CAA/B,sBAAsB;EACnC,IAAM,IAAI,GAAG,EAAC;EACd,IAAM,wBAAwB,GAAG,EAAC;AAElCC,aAAM,CAAC,QAAQ,CAAC,2BAA2B,CAAA;AAC3CA,aAAM,CAAC,QAAQ,CAAC,oCAAoC,CAAA;AAAA,MAE/B,aAAa,gBAAA,UAAA,WAAA,EAAA;IAoJhC,SAAA,aAAA,GAAqB;EAAA,IAAA,IAAA,KAAA;EAAA,IAAA,eAAA,CAAA,IAAA,EAAA,aAAA,CAAA;EAAA,IAAA,KAAA,IAAA,IAAA,GAAA,SAAA,CAAA,MAAA,EAAN,IAAI,GAAA,IAAA,KAAA,CAAA,IAAA,CAAA,EAAA,IAAA,GAAA,CAAA,EAAA,IAAA,GAAA,IAAA,EAAA,IAAA,EAAA,EAAA;QAAJ,IAAI,CAAA,IAAA,CAAA,GAAA,SAAA,CAAA,IAAA,CAAA;EAAA,IAAA;EACjB,IAAA,KAAA,GAAA,UAAA,CAAA,IAAA,EAAA,aAAA,EAAA,EAAA,CAAA,MAAA,CAAS,IAAI,CAAA,CAAA;MACb,KAAA,CAAK,OAAO,CAA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W,EAAE,IAAI,KAAK,CAAA;EACxC,CAAA;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@clappr/core"),require("hls.js")):"function"==typeof define&&define.amd?define(["@clappr/core","hls.js"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).HlsjsPlayback=e(t.Clappr,t.Hls)}(this,function(t,e){"use strict";function r(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 i(t,e,r){return e=o(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,l()?Reflect.construct(e,r||[],o(t).constructor):e.apply(t,r))}function n(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,d(i.key),i)}}function a(t,e,r){return(e=d(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=o(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 o(t){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},o(t)}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(l=function(){return!!t})()}function u(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 h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function _(t,e,r,i){var n=s(o(1&i?t.prototype:t),e,r);return 2&i&&"function"==typeof n?function(t){return n.apply(r,t)}:n}function p(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 d(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+""}if(!e)throw new Error("@clappr/hlsjs-playback requires hls.js (^1) to be loaded before it");var f=t.Utils.now,y=t.Utils.listContainsIgnoreCase;t.Events.register("PLAYBACK_FRAGMENT_CHANGED"),t.Events.register("PLAYBACK_FRAGMENT_PARSING_METADATA");var v=function(r){function a(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a);for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return(t=i(this,a,[].concat(r))).options.hlsPlayback=h(h({},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&&c(t,e)}(a,r),s=a,l=[{key:"HLSJS",get:function(){return e}}],(o=[{key:"name",get:function(){return"hls"}},{key:"supportedVersion",get:function(){return{min:"0.16.1"}}},{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 f()}},{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(){var e;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=null!==(e=this.options.hlsRecoverAttempts)&&void 0!==e?e: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=h({},this.options.playback.hlsjsConfig);this._hls=new e(t)}},{key:"_attachHLSMedia",value:function(){this._hls&&this._hls.attachMedia(this.el)}},{key:"_listenHLSEvents",value:function(){var t=this;this._hls&&(this._hls.once(e.Events.MEDIA_ATTACHED,function(){t.options.hlsPlayback.preload&&t._hls.loadSource(t.options.src)}),this._hls.on(e.Events.MANIFEST_LOADING,function(){t._manifestLoading=!0}),this._hls.on(e.Events.LEVEL_LOADED,function(e,r){return t._updatePlaybackType(e,r)}),this._hls.on(e.Events.LEVEL_UPDATED,function(e,r){return t._onLevelUpdated(e,r)}),this._hls.on(e.Events.LEVEL_SWITCHED,function(e,r){return t._onLevelSwitch(e,r)}),this._hls.on(e.Events.FRAG_CHANGED,function(e,r){return t._onFragmentChanged(e,r)}),this._hls.on(e.Events.FRAG_LOADED,function(e,r){return t._onFragmentLoaded(e,r)}),this._hls.on(e.Events.FRAG_BUFFERED,function(e,r){return t._onFragmentBuffered(e,r)}),this._hls.on(e.Events.FRAG_PARSING_METADATA,function(e,r){return t._onFragmentParsingMetadata(e,r)}),this._hls.on(e.Events.ERROR,function(e,r){return t._onHLSJSError(e,r)}),this._hls.on(e.Events.SUBTITLE_TRACK_LOADED,function(e,r){return t._onSubtitleLoaded(e,r)}),this._hls.on(e.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(),_(a,"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:"getFrameRate",value:function(){if(this._hls&&this._hls.levels&&this._hls.currentLevel>=0){var t=this._hls.levels[this._hls.currentLevel];return t&&t.frameRate?t.frameRate:null}return null}},{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){this.seek(this._duration*(t/100))}},{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(r,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 e.ErrorTypes.NETWORK_ERROR:switch(i.details){case e.ErrorDetails.MANIFEST_LOAD_ERROR:case e.ErrorDetails.MANIFEST_LOAD_TIMEOUT:case e.ErrorDetails.MANIFEST_PARSING_ERROR:case e.ErrorDetails.LEVEL_LOAD_ERROR:case e.ErrorDetails.LEVEL_LOAD_TIMEOUT:t.Log.error("hlsjs: unrecoverable network fatal error.",{evt:r,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:r,data:i}),a.level=t.PlayerError.Levels.WARN,this._hls.startLoad()}break;case e.ErrorTypes.MEDIA_ERROR:t.Log.warn("hlsjs: trying to recover from media error.",{evt:r,data:i}),a.level=t.PlayerError.Levels.WARN,this._recover(r,i,a);break;default:t.Log.error("hlsjs: could not recover from error.",{evt:r,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:r,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:r,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:r,data:i})}}},{key:"_keyIsDenied",value:function(t){return t.type===e.ErrorTypes.NETWORK_ERROR&&t.details===e.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,_(a,"_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(p(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),_(a,"play",this,3)([]),this._startTimeUpdateTimer()}},{key:"pause",value:function(){this._hls&&this.el.pause()}},{key:"stop",value:function(){this._stopTimeUpdateTimer(),this._hls&&_(a,"stop",this,3)([]),this._destroyHLSInstance()}},{key:"destroy",value:function(){this._stopTimeUpdateTimer(),this._destroyHLSInstance(),_(a,"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(r,i){this._segmentTargetDuration=i.details.targetduration,this._playlistType=i.details.type||null;var n=!1,a=!1,s=i.details.fragments,o=this._playableRegionStartTime,l=this._playableRegionDuration;if(0!==s.length){if(s[0].rawProgramDateTime&&(this._programDateTime=s[0].rawProgramDateTime),this._playableRegionStartTime!==s[0].start&&(n=!0,this._playableRegionStartTime=s[0].start),n)if(this._localStartTimeCorrelation){var u=this._localStartTimeCorrelation,h=this._now-u.local,c=(u.remote+h)/1e3;c<s[0].start?this._localStartTimeCorrelation={local:this._now,remote:1e3*s[0].start}:c>o+this._extrapolatedWindowDuration&&(this._localStartTimeCorrelation={local:this._now,remote:1e3*Math.max(s[0].start,o+this._extrapolatedWindowDuration)})}else this._localStartTimeCorrelation={local:this._now,remote:1e3*(s[0].start+this._extrapolatedWindowDuration/2)};var _=i.details.totalduration;if(this._playbackType===t.Playback.LIVE){var p=i.details.targetduration*((this.options.playback.hlsjsConfig||{}).liveSyncDurationCount||e.DefaultConfig.liveSyncDurationCount);p<=_?(_-=p,this._durationExcludesAfterLiveSyncPoint=!0):this._durationExcludesAfterLiveSyncPoint=!1}_!==this._playableRegionDuration&&(a=!0,this._playableRegionDuration=_);var d=s[0].start+_,f=o+l;if(d!==f)if(this._localEndTimeCorrelation){var y=this._localEndTimeCorrelation,v=this._now-y.local,m=(y.remote+v)/1e3;m>d?this._localEndTimeCorrelation={local:this._now,remote:1e3*d}:m<d-this._extrapolatedWindowDuration?this._localEndTimeCorrelation={local:this._now,remote:1e3*(d-this._extrapolatedWindowDuration)}:m>f&&(this._localEndTimeCorrelation={local:this._now,remote:1e3*f})}else this._localEndTimeCorrelation={local:this._now,remote:1e3*d};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}}])&&n(s.prototype,o),l&&n(s,l),Object.defineProperty(s,"prototype",{writable:!1}),s;var s,o,l}(t.HTML5Video);return v.canPlay=function(t,r){var i=t.split("?")[0].match(/.*\.(.*)$/)||[],n=i.length>1&&"m3u8"===i[1].toLowerCase()||y(r,["application/vnd.apple.mpegurl","application/x-mpegURL"]);return!(!e.isSupported()||!n)},v});
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@clappr/core"),require("hls.js")):"function"==typeof define&&define.amd?define(["@clappr/core","hls.js"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).HlsjsPlayback=e(t.Clappr,t.Hls)}(this,function(t,e){"use strict";function r(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 i(t,e,r){return e=o(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,l()?Reflect.construct(e,r||[],o(t).constructor):e.apply(t,r))}function n(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,d(i.key),i)}}function a(t,e,r){return(e=d(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=o(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 o(t){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},o(t)}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(l=function(){return!!t})()}function u(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 h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function _(t,e,r,i){var n=s(o(t.prototype),e,r);return 2&i&&"function"==typeof n?function(t){return n.apply(r,t)}:n}function p(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 d(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);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}if(!e)throw new Error("@clappr/hlsjs-playback requires hls.js (^1) to be loaded before it");var f=t.Utils.now,y=t.Utils.listContainsIgnoreCase;t.Events.register("PLAYBACK_FRAGMENT_CHANGED"),t.Events.register("PLAYBACK_FRAGMENT_PARSING_METADATA");var v=function(r){function a(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a);for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return(t=i(this,a,[].concat(r))).options.hlsPlayback=h(h({},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&&c(t,e)}(a,r),s=a,l=[{key:"HLSJS",get:function(){return e}}],(o=[{key:"name",get:function(){return"hls"}},{key:"supportedVersion",get:function(){return{min:"0.16.3"}}},{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 f()}},{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(){var e;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=null!==(e=this.options.hlsRecoverAttempts)&&void 0!==e?e: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=h({},this.options.playback.hlsjsConfig);this._hls=new e(t)}},{key:"_attachHLSMedia",value:function(){this._hls&&this._hls.attachMedia(this.el)}},{key:"_listenHLSEvents",value:function(){var t=this;this._hls&&(this._hls.once(e.Events.MEDIA_ATTACHED,function(){t.options.hlsPlayback.preload&&t._hls.loadSource(t.options.src)}),this._hls.on(e.Events.MANIFEST_LOADING,function(){t._manifestLoading=!0}),this._hls.on(e.Events.LEVEL_LOADED,function(e,r){return t._updatePlaybackType(e,r)}),this._hls.on(e.Events.LEVEL_UPDATED,function(e,r){return t._onLevelUpdated(e,r)}),this._hls.on(e.Events.LEVEL_SWITCHED,function(e,r){return t._onLevelSwitch(e,r)}),this._hls.on(e.Events.FRAG_CHANGED,function(e,r){return t._onFragmentChanged(e,r)}),this._hls.on(e.Events.FRAG_LOADED,function(e,r){return t._onFragmentLoaded(e,r)}),this._hls.on(e.Events.FRAG_BUFFERED,function(e,r){return t._onFragmentBuffered(e,r)}),this._hls.on(e.Events.FRAG_PARSING_METADATA,function(e,r){return t._onFragmentParsingMetadata(e,r)}),this._hls.on(e.Events.ERROR,function(e,r){return t._onHLSJSError(e,r)}),this._hls.on(e.Events.SUBTITLE_TRACK_LOADED,function(e,r){return t._onSubtitleLoaded(e,r)}),this._hls.on(e.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(),_(a,"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:"getFrameRate",value:function(){if(this._hls&&this._hls.levels&&this._hls.currentLevel>=0){var t=this._hls.levels[this._hls.currentLevel];return t&&t.frameRate?t.frameRate:null}return null}},{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){this.seek(this._duration*(t/100))}},{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(r,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 e.ErrorTypes.NETWORK_ERROR:switch(i.details){case e.ErrorDetails.MANIFEST_LOAD_ERROR:case e.ErrorDetails.MANIFEST_LOAD_TIMEOUT:case e.ErrorDetails.MANIFEST_PARSING_ERROR:case e.ErrorDetails.LEVEL_LOAD_ERROR:case e.ErrorDetails.LEVEL_LOAD_TIMEOUT:t.Log.error("hlsjs: unrecoverable network fatal error.",{evt:r,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:r,data:i}),a.level=t.PlayerError.Levels.WARN,this._hls.startLoad()}break;case e.ErrorTypes.MEDIA_ERROR:t.Log.warn("hlsjs: trying to recover from media error.",{evt:r,data:i}),a.level=t.PlayerError.Levels.WARN,this._recover(r,i,a);break;default:t.Log.error("hlsjs: could not recover from error.",{evt:r,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:r,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:r,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:r,data:i})}}},{key:"_keyIsDenied",value:function(t){return t.type===e.ErrorTypes.NETWORK_ERROR&&t.details===e.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,_(a,"_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(p(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),_(a,"play",this,3)([]),this._startTimeUpdateTimer()}},{key:"pause",value:function(){this._hls&&this.el.pause()}},{key:"stop",value:function(){this._stopTimeUpdateTimer(),this._hls&&_(a,"stop",this,3)([]),this._destroyHLSInstance()}},{key:"destroy",value:function(){this._stopTimeUpdateTimer(),this._destroyHLSInstance(),_(a,"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(r,i){this._segmentTargetDuration=i.details.targetduration,this._playlistType=i.details.type||null;var n=!1,a=!1,s=i.details.fragments,o=this._playableRegionStartTime,l=this._playableRegionDuration;if(0!==s.length){if(s[0].rawProgramDateTime&&(this._programDateTime=s[0].rawProgramDateTime),this._playableRegionStartTime!==s[0].start&&(n=!0,this._playableRegionStartTime=s[0].start),n)if(this._localStartTimeCorrelation){var u=this._localStartTimeCorrelation,h=this._now-u.local,c=(u.remote+h)/1e3;c<s[0].start?this._localStartTimeCorrelation={local:this._now,remote:1e3*s[0].start}:c>o+this._extrapolatedWindowDuration&&(this._localStartTimeCorrelation={local:this._now,remote:1e3*Math.max(s[0].start,o+this._extrapolatedWindowDuration)})}else this._localStartTimeCorrelation={local:this._now,remote:1e3*(s[0].start+this._extrapolatedWindowDuration/2)};var _=i.details.totalduration;if(this._playbackType===t.Playback.LIVE){var p=i.details.targetduration*((this.options.playback.hlsjsConfig||{}).liveSyncDurationCount||e.DefaultConfig.liveSyncDurationCount);p<=_?(_-=p,this._durationExcludesAfterLiveSyncPoint=!0):this._durationExcludesAfterLiveSyncPoint=!1}_!==this._playableRegionDuration&&(a=!0,this._playableRegionDuration=_);var d=s[0].start+_,f=o+l;if(d!==f)if(this._localEndTimeCorrelation){var y=this._localEndTimeCorrelation,v=this._now-y.local,m=(y.remote+v)/1e3;m>d?this._localEndTimeCorrelation={local:this._now,remote:1e3*d}:m<d-this._extrapolatedWindowDuration?this._localEndTimeCorrelation={local:this._now,remote:1e3*(d-this._extrapolatedWindowDuration)}:m>f&&(this._localEndTimeCorrelation={local:this._now,remote:1e3*f})}else this._localEndTimeCorrelation={local:this._now,remote:1e3*d};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}}])&&n(s.prototype,o),l&&n(s,l),Object.defineProperty(s,"prototype",{writable:!1}),s;var s,o,l}(t.HTML5Video);return v.canPlay=function(t,r){var i=t.split("?")[0].match(/.*\.(.*)$/)||[],n=i.length>1&&"m3u8"===i[1].toLowerCase()||y(r,["application/vnd.apple.mpegurl","application/x-mpegURL"]);return!(!e.isSupported()||!n)},v});
2
2
  //# sourceMappingURL=hlsjs-playback.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hlsjs-playback.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\nif (!HLSJS) {\n throw new Error('@clappr/hlsjs-playback requires hls.js (^1) to be loaded before it')\n}\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 // the frame rate should be retrieved from the HLS.js level information\n // as it is not necessarily exposed directly by the video element\n getFrameRate() {\n if (this._hls && this._hls.levels && this._hls.currentLevel >= 0) {\n const level = this._hls.levels[this._hls.currentLevel]\n return level && level.frameRate ? level.frameRate : null\n }\n return null\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 this.seek(this._duration * (percentage / 100))\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":["HLSJS","Error","now","Utils","listContainsIgnoreCase","Events","register","HlsjsPlayback","_HTML5Video","_this","_classCallCheck","this","_len","arguments","length","args","Array","_key","_callSuper","concat","options","hlsPlayback","_objectSpread","defaultOptions","_timeUpdateThrottleDelay","_timeUpdateFiringRate","_durationChangeMinOffset","_setInitialState","_inherits","key","get","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","_this$options$hlsReco","_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","requestedEventName","item","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","levels","frameRate","percentage","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","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":"o5GAOA,IAAKA,EACH,MAAM,IAA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lK,QAAQH,KAAK+P,cAC9B/P,KAAK0B,QAAQhC,SAAOsQ,2BACpBhQ,KAAK0B,QAAQhC,EAAAA,OAAOuQ,sBAAuBvJ,GAC3C,IAAM1E,EAAehC,KAAK8B,KAAKuI,OAAO3D,EAAKwC,OACvClH,IAEFhC,KAAKkQ,eAAiBlO,EAAamO,QAAU,KAAOnO,EAAasM,QAAU,KAAQ,IACnFtO,KAAK0B,QAAQhC,EAAMA,OAAC0Q,8BAA+BpQ,KAAKkQ,gBACxDlQ,KAAK0B,QAAQhC,EAAMA,OAAC2Q,iBAAkB,CACpCF,OAAQnO,EAAamO,OACrBG,MAAOtO,EAAasO,MACpBC,UAAWvO,EAAasM,QACxBA,QAAStM,EAAasM,QACtBpF,MAAOxC,EAAKwC,QAGlB,GAAC,CAAAhI,IAAA,aAAAC,IAED,WAKE,OACEnB,KAAKoF,qCACLpF,KAAKoK,WAAapK,KAAKyE,aACvBzE,KAAKwQ,oBAAsBlO,EAAAA,SAASC,IAExC,GAAC,CAAArB,IAAA,kBAAAqD,MAED,WACE,OAAOvE,KAAKqC,aACd,GAAC,CAAAnB,IAAA,gBAAAqD,MAED,WACE,OAAOvE,KAAKqC,gBAAkBC,EAAAA,SAASsC,KAAO5E,KAAK8K,UACrD,+FAlnBC,CAlJ+B,CAAS2F,qBAuwB3C7Q,EAAc8Q,QAAU,SAAUC,EAAUC,GAC1C,IAAMC,EAAgBF,EAASG,MAAM,KAAK,GAAGC,MAAM,cAAgB,GAC7DC,EACHH,EAAc1Q,OAAS,GAAwC,SAAnC0Q,EAAc,GAAGI,eAC9CxR,EAAuBmR,EAAU,CAAC,gCAAiC,0BACrE,SAAUvR,EAAM6R,gBAAiBF,EACnC"}
1
+ {"version":3,"file":"hlsjs-playback.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\nif (!HLSJS) {\n throw new Error('@clappr/hlsjs-playback requires hls.js (^1) to be loaded before it')\n}\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) {}\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 // the frame rate should be retrieved from the HLS.js level information\n // as it is not necessarily exposed directly by the video element\n getFrameRate() {\n if (this._hls && this._hls.levels && this._hls.currentLevel >= 0) {\n const level = this._hls.levels[this._hls.currentLevel]\n return level && level.frameRate ? level.frameRate : null\n }\n return null\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 this.seek(this._duration * (percentage / 100))\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":["HLSJS","Error","now","Utils","listContainsIgnoreCase","Events","register","HlsjsPlayback","_HTML5Video","_this","_classCallCheck","this","_len","arguments","length","args","Array","_key","_callSuper","concat","options","hlsPlayback","_objectSpread","defaultOptions","_timeUpdateThrottleDelay","_timeUpdateFiringRate","_durationChangeMinOffset","_setInitialState","_inherits","key","get","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","_this$options$hlsReco","_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","requestedEventName","item","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","levels","frameRate","percentage","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","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":"82GAOA,IAAKA,EACH,MAAM,IAAIC,MAAM,sEAGlB,IAAQC,EAAgCC,EAAAA,MAAhCD,IAAKE,EAA2BD,EAAAA,MAA3BC,uBAIbC,EAAAA,OAAOC,SAAS,6BAChBD,EAAAA,OAAOC,SAAS,sCAAoC,IAE/BC,EAAa,SAAAC,GAoJhC,SAAAD,IAAqB,IAAAE,+FAAAC,CAAAC,KAAAJ,GAAA,IAAA,IAAAK,EAAAC,UAAAC,OAANC,EAAI,IAAAC,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAJF,EAAIE,GAAAJ,UAAAI,GAMK,OALtBR,EAAAS,EAAAP,KAAAJ,EAAA,GAAAY,OAASJ,KACJK,QAAQC,YAAWC,EAAAA,EAAA,CAAA,EAAQb,EAAKc,gBAAmBd,EAAKW,QAAQC,aACrEZ,EAAKe,yBAA2B,IAChCf,EAAKgB,sBAAwB,GAC7BhB,EAAKiB,yBAA2B,GAChCjB,EAAKkB,mBAAiBlB,CACxB,CAAA,4RAAAmB,CAAArB,EAAAC,KAAAD,IAymBA,CAAA,CAAAsB,I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oK,WAAapK,KAAKyE,aACvBzE,KAAKwQ,oBAAsBlO,EAAAA,SAASC,IAExC,GAAA,CAAArB,IAAA,kBAAAqD,MAEA,WACE,OAAOvE,KAAKqC,aACd,GAAA,CAAAnB,IAAA,gBAAAqD,MAEA,WACE,OAAOvE,KAAKqC,gBAAkBC,EAAAA,SAASsC,KAAO5E,KAAK8K,UACrD,+FAlnBA,CAlJgC,CAAS2F,EAAAA,mBAuwB3C7Q,EAAc8Q,QAAU,SAAUC,EAAUC,GAC1C,IAAMC,EAAgBF,EAASG,MAAM,KAAK,GAAGC,MAAM,cAAgB,GAC7DC,EACHH,EAAc1Q,OAAS,GAAwC,SAAnC0Q,EAAc,GAAGI,eAC9CxR,EAAuBmR,EAAU,CAAC,gCAAiC,0BACrE,SAAUvR,EAAM6R,gBAAiBF,EACnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clappr/hlsjs-playback",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "HLS Playback based on hls.js",
5
5
  "main": "./dist/hlsjs-playback.js",
6
6
  "module": "./dist/hlsjs-playback.esm.js",
@@ -41,9 +41,7 @@
41
41
  "hls.js": "^1"
42
42
  },
43
43
  "devDependencies": {
44
- "@clappr/core": "^0.16.1",
45
- "@rollup/plugin-replace": "^2.4.2",
46
- "hls.js": "~1.6.17",
47
- "rollup-plugin-serve": "^1.1.0"
44
+ "@clappr/core": "^0.16.3",
45
+ "hls.js": "^1"
48
46
  }
49
47
  }
package/src/hls.js CHANGED
@@ -324,7 +324,7 @@ export default class HlsjsPlayback extends HTML5Video {
324
324
 
325
325
  // override
326
326
  // this playback manages the src on the video element itself
327
- _setupSrc(srcUrl) {} // eslint-disable-line no-unused-vars
327
+ _setupSrc(srcUrl) {}
328
328
 
329
329
  _startTimeUpdateTimer() {
330
330
  if (this._timeUpdateTimer) return
package/src/hls.test.js CHANGED
@@ -442,9 +442,7 @@ describe('HlsjsPlayback', () => {
442
442
  }
443
443
  const playback = new HlsjsPlayback({ src: 'http://clappr.io/foo.m3u8' })
444
444
  playback.el.currentTime = 5
445
- playback._setup()
446
- playback.unbindCustomListeners()
447
- playback._hls.trigger(HLSJS.Events.FRAG_CHANGED, fragmentMock)
445
+ playback._onFragmentChanged(HLSJS.Events.FRAG_CHANGED, fragmentMock)
448
446
  expect(playback.currentTimestamp).toBe(1556663045) // 'Tue Apr 30 2019 19:24:05'
449
447
  })
450
448
 
@@ -455,6 +453,46 @@ describe('HlsjsPlayback', () => {
455
453
  })
456
454
  })
457
455
 
456
+ describe('level and fragment events', () => {
457
+ test('_onLevelSwitch fills levels and reports bitrate', () => {
458
+ const playback = createPlayback()
459
+ playback._hls = {
460
+ levels: [{ height: 1080, width: 1920, bitrate: 4000000 }]
461
+ }
462
+ const onSwitch = jest.fn()
463
+ const onHd = jest.fn()
464
+ const onBitrate = jest.fn()
465
+ playback.on(Events.PLAYBACK_LEVEL_SWITCH, onSwitch)
466
+ playback.on(Events.PLAYBACK_HIGHDEFINITIONUPDATE, onHd)
467
+ playback.on(Events.PLAYBACK_BITRATE, onBitrate)
468
+
469
+ playback._onLevelSwitch(HLSJS.Events.LEVEL_SWITCHED, { level: 0 })
470
+
471
+ expect(playback.levels).toHaveLength(1)
472
+ expect(playback.highDefinition).toBe(true)
473
+ expect(onSwitch).toHaveBeenCalled()
474
+ expect(onHd).toHaveBeenCalledWith(true)
475
+ expect(onBitrate).toHaveBeenCalledWith(
476
+ expect.objectContaining({ height: 1080, bitrate: 4000000, level: 0 })
477
+ )
478
+ })
479
+
480
+ test('_onFragmentLoaded and _onFragmentBuffered forward playback events', () => {
481
+ const playback = createPlayback()
482
+ const onLoaded = jest.fn()
483
+ const onBuffered = jest.fn()
484
+ playback.on(Events.PLAYBACK_FRAGMENT_LOADED, onLoaded)
485
+ playback.on(Events.PLAYBACK_FRAGMENT_BUFFERED, onBuffered)
486
+ const data = { frag: { sn: 1 } }
487
+
488
+ playback._onFragmentLoaded(HLSJS.Events.FRAG_LOADED, data)
489
+ playback._onFragmentBuffered(HLSJS.Events.FRAG_BUFFERED, data)
490
+
491
+ expect(onLoaded).toHaveBeenCalledWith(data)
492
+ expect(onBuffered).toHaveBeenCalledWith(data)
493
+ })
494
+ })
495
+
458
496
  describe('DVR time model', () => {
459
497
  test('without correlation duration equals playable region duration', () => {
460
498
  const playback = createPlayback()