@gcorevideo/player 2.0.0 → 2.0.2

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.
package/dist/index.js CHANGED
@@ -11501,7 +11501,7 @@ function isUndefined(arg) {
11501
11501
  }
11502
11502
 
11503
11503
  function isRegExp(re) {
11504
- return isObject(re) && objectToString(re) === '[object RegExp]';
11504
+ return isObject(re) && objectToString$1(re) === '[object RegExp]';
11505
11505
  }
11506
11506
 
11507
11507
  function isObject(arg) {
@@ -11509,12 +11509,12 @@ function isObject(arg) {
11509
11509
  }
11510
11510
 
11511
11511
  function isDate(d) {
11512
- return isObject(d) && objectToString(d) === '[object Date]';
11512
+ return isObject(d) && objectToString$1(d) === '[object Date]';
11513
11513
  }
11514
11514
 
11515
11515
  function isError(e) {
11516
11516
  return isObject(e) &&
11517
- (objectToString(e) === '[object Error]' || e instanceof Error);
11517
+ (objectToString$1(e) === '[object Error]' || e instanceof Error);
11518
11518
  }
11519
11519
 
11520
11520
  function isFunction(arg) {
@@ -11530,7 +11530,7 @@ function isPrimitive(arg) {
11530
11530
  typeof arg === 'undefined';
11531
11531
  }
11532
11532
 
11533
- function objectToString(o) {
11533
+ function objectToString$1(o) {
11534
11534
  return Object.prototype.toString.call(o);
11535
11535
  }
11536
11536
 
@@ -13313,7 +13313,7 @@ function enableLogs(debugConfig, id) {
13313
13313
  exportedLogger = fakeLogger;
13314
13314
  }
13315
13315
  }
13316
- const logger = exportedLogger;
13316
+ const logger$1 = exportedLogger;
13317
13317
 
13318
13318
  const DECIMAL_RESOLUTION_REGEX = /^(\d+)x(\d+)$/;
13319
13319
  const ATTR_LIST_REGEX = /(.+?)=(".*?"|.*?)(?:,|$)/g;
@@ -13414,7 +13414,7 @@ class DateRange {
13414
13414
  const previousAttr = dateRangeWithSameId.attr;
13415
13415
  for (const key in previousAttr) {
13416
13416
  if (Object.prototype.hasOwnProperty.call(dateRangeAttr, key) && dateRangeAttr[key] !== previousAttr[key]) {
13417
- logger.warn(`DATERANGE tag attribute: "${key}" does not match for tags with ID: "${dateRangeAttr.ID}"`);
13417
+ logger$1.warn(`DATERANGE tag attribute: "${key}" does not match for tags with ID: "${dateRangeAttr.ID}"`);
13418
13418
  this._badValueForSameId = key;
13419
13419
  break;
13420
13420
  }
@@ -14540,7 +14540,7 @@ function parseSegmentIndex(sidx) {
14540
14540
  const referenceSize = referenceInfo & 0x7fffffff;
14541
14541
  const referenceType = (referenceInfo & 0x80000000) >>> 31;
14542
14542
  if (referenceType === 1) {
14543
- logger.warn('SIDX has hierarchical references (not supported)');
14543
+ logger$1.warn('SIDX has hierarchical references (not supported)');
14544
14544
  return null;
14545
14545
  }
14546
14546
  const subsegmentDuration = readUint32(sidx, referenceIndex);
@@ -14832,7 +14832,7 @@ function patchEncyptionData(initSegment, decryptdata) {
14832
14832
  // Look for default key id (keyID offset is always 8 within the tenc box):
14833
14833
  const tencKeyId = tenc.subarray(8, 24);
14834
14834
  if (!tencKeyId.some(b => b !== 0)) {
14835
- logger.log(`[eme] Patching keyId in 'enc${isAudio ? 'a' : 'v'}>sinf>>tenc' box: ${Hex.hexDump(tencKeyId)} -> ${Hex.hexDump(keyId)}`);
14835
+ logger$1.log(`[eme] Patching keyId in 'enc${isAudio ? 'a' : 'v'}>sinf>>tenc' box: ${Hex.hexDump(tencKeyId)} -> ${Hex.hexDump(keyId)}`);
14836
14836
  tenc.set(keyId, 8);
14837
14837
  }
14838
14838
  }
@@ -14886,7 +14886,7 @@ function getStartDTS(initData, fmp4) {
14886
14886
  // This prevents large values from being used for initPTS, which can cause playlist sync issues.
14887
14887
  // https://github.com/video-dev/hls.js/issues/5303
14888
14888
  if (baseTime === UINT32_MAX$1) {
14889
- logger.warn(`[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time`);
14889
+ logger$1.warn(`[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time`);
14890
14890
  return result;
14891
14891
  }
14892
14892
  baseTime *= UINT32_MAX$1 + 1;
@@ -15293,7 +15293,7 @@ function parseSEIMessageFromNALu(unescapedData, headerSize, pts, samples) {
15293
15293
  seiPtr += payloadSize;
15294
15294
  } else if (payloadSize > leftOver) {
15295
15295
  // Some type of corruption has happened?
15296
- logger.error(`Malformed SEI payload. ${payloadSize} is too small, only ${leftOver} bytes left to parse.`);
15296
+ logger$1.error(`Malformed SEI payload. ${payloadSize} is too small, only ${leftOver} bytes left to parse.`);
15297
15297
  // We might be able to parse some data, but let's be safe and ignore it.
15298
15298
  break;
15299
15299
  }
@@ -15436,7 +15436,7 @@ function parseEmsg(data) {
15436
15436
  presentationTime = 2 ** 32 * leftPresentationTime + rightPresentationTime;
15437
15437
  if (!isSafeInteger(presentationTime)) {
15438
15438
  presentationTime = Number.MAX_SAFE_INTEGER;
15439
- logger.warn('Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box');
15439
+ logger$1.warn('Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box');
15440
15440
  }
15441
15441
  eventDuration = readUint32(data, offset);
15442
15442
  offset += 4;
@@ -15642,7 +15642,7 @@ class LevelKey {
15642
15642
  // If the segment was encrypted with AES-128
15643
15643
  // It must have an IV defined. We cannot substitute the Segment Number in.
15644
15644
  if (this.method === 'AES-128' && !this.iv) {
15645
- logger.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`);
15645
+ logger$1.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`);
15646
15646
  }
15647
15647
  // Explicitly set sn to resulting value from implicit conversions 'initSegment' values for IV generation.
15648
15648
  sn = 0;
@@ -16071,7 +16071,7 @@ class M3U8Parser {
16071
16071
  }
16072
16072
  parsed.sessionKeys.push(sessionKey);
16073
16073
  } else {
16074
- logger.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${attributes}"`);
16074
+ logger$1.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${attributes}"`);
16075
16075
  }
16076
16076
  break;
16077
16077
  }
@@ -16272,7 +16272,7 @@ class M3U8Parser {
16272
16272
  } else {
16273
16273
  result = result[0].match(LEVEL_PLAYLIST_REGEX_SLOW);
16274
16274
  if (!result) {
16275
- logger.warn('No matches on slow regex match for level playlist!');
16275
+ logger$1.warn('No matches on slow regex match for level playlist!');
16276
16276
  continue;
16277
16277
  }
16278
16278
  for (i = 1; i < result.length; i++) {
@@ -16352,7 +16352,7 @@ class M3U8Parser {
16352
16352
  if (dateRange.isValid || level.skippedSegments) {
16353
16353
  level.dateRanges[dateRange.id] = dateRange;
16354
16354
  } else {
16355
- logger.warn(`Ignoring invalid DATERANGE tag: "${value1}"`);
16355
+ logger$1.warn(`Ignoring invalid DATERANGE tag: "${value1}"`);
16356
16356
  }
16357
16357
  // Add to fragment tag list for backwards compatibility (< v1.2.0)
16358
16358
  frag.tagList.push(['EXT-X-DATERANGE', value1]);
@@ -16390,7 +16390,7 @@ class M3U8Parser {
16390
16390
  }
16391
16391
  levelkeys[levelKey.keyFormat] = levelKey;
16392
16392
  } else {
16393
- logger.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${value1}"`);
16393
+ logger$1.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${value1}"`);
16394
16394
  }
16395
16395
  break;
16396
16396
  }
@@ -16483,7 +16483,7 @@ class M3U8Parser {
16483
16483
  break;
16484
16484
  }
16485
16485
  default:
16486
- logger.warn(`line parsed but not handled: ${result}`);
16486
+ logger$1.warn(`line parsed but not handled: ${result}`);
16487
16487
  break;
16488
16488
  }
16489
16489
  }
@@ -16555,7 +16555,7 @@ function parseKey(keyTagAttributes, baseurl, parsed) {
16555
16555
  // From RFC: This attribute is OPTIONAL; its absence indicates an implicit value of "identity".
16556
16556
  const decryptkeyformat = (_keyAttrs$KEYFORMAT = keyAttrs.KEYFORMAT) != null ? _keyAttrs$KEYFORMAT : 'identity';
16557
16557
  if (decrypturi && keyAttrs.IV && !decryptiv) {
16558
- logger.error(`Invalid IV: ${keyAttrs.IV}`);
16558
+ logger$1.error(`Invalid IV: ${keyAttrs.IV}`);
16559
16559
  }
16560
16560
  // If decrypturi is a URI with a scheme, then baseurl will be ignored
16561
16561
  // No uri is allowed when METHOD is NONE
@@ -16817,10 +16817,10 @@ class PlaylistLoader {
16817
16817
  const loaderContext = loader.context;
16818
16818
  if (loaderContext && loaderContext.url === context.url && loaderContext.level === context.level) {
16819
16819
  // same URL can't overlap
16820
- logger.trace('[playlist-loader]: playlist request ongoing');
16820
+ logger$1.trace('[playlist-loader]: playlist request ongoing');
16821
16821
  return;
16822
16822
  }
16823
- logger.log(`[playlist-loader]: aborting previous loader for type: ${context.type}`);
16823
+ logger$1.log(`[playlist-loader]: aborting previous loader for type: ${context.type}`);
16824
16824
  loader.abort();
16825
16825
  }
16826
16826
 
@@ -16930,7 +16930,7 @@ class PlaylistLoader {
16930
16930
  // alt audio rendition in which quality levels (main)
16931
16931
  // contains both audio+video. but with mixed audio track not signaled
16932
16932
  if (!embeddedAudioFound && levels[0].audioCodec && !levels[0].attrs.AUDIO) {
16933
- logger.log('[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one');
16933
+ logger$1.log('[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one');
16934
16934
  audioTracks.unshift({
16935
16935
  type: 'main',
16936
16936
  name: 'main',
@@ -17029,7 +17029,7 @@ class PlaylistLoader {
17029
17029
  message += ` id: ${context.id} group-id: "${context.groupId}"`;
17030
17030
  }
17031
17031
  const error = new Error(message);
17032
- logger.warn(`[playlist-loader]: ${message}`);
17032
+ logger$1.warn(`[playlist-loader]: ${message}`);
17033
17033
  let details = ErrorDetails.UNKNOWN;
17034
17034
  let fatal = false;
17035
17035
  const loader = this.getInternalLoader(context);
@@ -17196,13 +17196,13 @@ function addCueToTrack(track, cue) {
17196
17196
  throw new Error(`addCue is failed for: ${cue}`);
17197
17197
  }
17198
17198
  } catch (err) {
17199
- logger.debug(`[texttrack-utils]: ${err}`);
17199
+ logger$1.debug(`[texttrack-utils]: ${err}`);
17200
17200
  try {
17201
17201
  const textTrackCue = new self.TextTrackCue(cue.startTime, cue.endTime, cue.text);
17202
17202
  textTrackCue.id = cue.id;
17203
17203
  track.addCue(textTrackCue);
17204
17204
  } catch (err2) {
17205
- logger.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${err2}`);
17205
+ logger$1.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${err2}`);
17206
17206
  }
17207
17207
  }
17208
17208
  }
@@ -17775,7 +17775,7 @@ class LatencyController {
17775
17775
  }
17776
17776
  this.stallCount++;
17777
17777
  if ((_this$levelDetails = this.levelDetails) != null && _this$levelDetails.live) {
17778
- logger.warn('[playback-rate-controller]: Stall detected, adjusting target latency');
17778
+ logger$1.warn('[playback-rate-controller]: Stall detected, adjusting target latency');
17779
17779
  }
17780
17780
  }
17781
17781
  timeupdate() {
@@ -18055,7 +18055,7 @@ function updateFromToPTS(fragFrom, fragTo) {
18055
18055
  function updateFragPTSDTS(details, frag, startPTS, endPTS, startDTS, endDTS) {
18056
18056
  const parsedMediaDuration = endPTS - startPTS;
18057
18057
  if (parsedMediaDuration <= 0) {
18058
- logger.warn('Fragment should have a positive duration', frag);
18058
+ logger$1.warn('Fragment should have a positive duration', frag);
18059
18059
  endPTS = startPTS + frag.duration;
18060
18060
  endDTS = startDTS + frag.duration;
18061
18061
  }
@@ -18179,7 +18179,7 @@ function mergeDetails(oldDetails, newDetails) {
18179
18179
  if (newDetails.skippedSegments) {
18180
18180
  newDetails.deltaUpdateFailed = newDetails.fragments.some(frag => !frag);
18181
18181
  if (newDetails.deltaUpdateFailed) {
18182
- logger.warn('[level-helper] Previous playlist missing segments skipped in delta playlist');
18182
+ logger$1.warn('[level-helper] Previous playlist missing segments skipped in delta playlist');
18183
18183
  for (let i = newDetails.skippedSegments; i--;) {
18184
18184
  newDetails.fragments.shift();
18185
18185
  }
@@ -18191,7 +18191,7 @@ function mergeDetails(oldDetails, newDetails) {
18191
18191
  }
18192
18192
  const newFragments = newDetails.fragments;
18193
18193
  if (ccOffset) {
18194
- logger.warn('discontinuity sliding from playlist, take drift into account');
18194
+ logger$1.warn('discontinuity sliding from playlist, take drift into account');
18195
18195
  for (let i = 0; i < newFragments.length; i++) {
18196
18196
  newFragments[i].cc += ccOffset;
18197
18197
  }
@@ -18247,7 +18247,7 @@ function mergeDateRanges(oldDateRanges, deltaDateRanges, recentlyRemovedDaterang
18247
18247
  if (dateRange.isValid) {
18248
18248
  dateRanges[id] = dateRange;
18249
18249
  } else {
18250
- logger.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(deltaDateRanges[id].attr)}"`);
18250
+ logger$1.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(deltaDateRanges[id].attr)}"`);
18251
18251
  }
18252
18252
  });
18253
18253
  return dateRanges;
@@ -18612,9 +18612,9 @@ class ErrorController {
18612
18612
  this.warn = void 0;
18613
18613
  this.error = void 0;
18614
18614
  this.hls = hls;
18615
- this.log = logger.log.bind(logger, `[info]:`);
18616
- this.warn = logger.warn.bind(logger, `[warning]:`);
18617
- this.error = logger.error.bind(logger, `[error]:`);
18615
+ this.log = logger$1.log.bind(logger$1, `[info]:`);
18616
+ this.warn = logger$1.warn.bind(logger$1, `[warning]:`);
18617
+ this.error = logger$1.error.bind(logger$1, `[error]:`);
18618
18618
  this.registerListeners();
18619
18619
  }
18620
18620
  registerListeners() {
@@ -18971,8 +18971,8 @@ class BasePlaylistController {
18971
18971
  this.canLoad = false;
18972
18972
  this.log = void 0;
18973
18973
  this.warn = void 0;
18974
- this.log = logger.log.bind(logger, `${logPrefix}:`);
18975
- this.warn = logger.warn.bind(logger, `${logPrefix}:`);
18974
+ this.log = logger$1.log.bind(logger$1, `${logPrefix}:`);
18975
+ this.warn = logger$1.warn.bind(logger$1, `${logPrefix}:`);
18976
18976
  this.hls = hls;
18977
18977
  }
18978
18978
  destroy() {
@@ -19005,7 +19005,7 @@ class BasePlaylistController {
19005
19005
  try {
19006
19006
  uri = new self.URL(attr.URI, previous.url).href;
19007
19007
  } catch (error) {
19008
- logger.warn(`Could not construct new URL for Rendition Report: ${error}`);
19008
+ logger$1.warn(`Could not construct new URL for Rendition Report: ${error}`);
19009
19009
  uri = attr.URI || '';
19010
19010
  }
19011
19011
  // Use exact match. Otherwise, the last partial match, if any, will be used
@@ -19597,7 +19597,7 @@ function getStartCodecTier(codecTiers, currentVideoRange, currentBw, audioPrefer
19597
19597
  };
19598
19598
  }
19599
19599
  function logStartCodecCandidateIgnored(codeSet, reason) {
19600
- logger.log(`[abr] start candidates with "${codeSet}" ignored because ${reason}`);
19600
+ logger$1.log(`[abr] start candidates with "${codeSet}" ignored because ${reason}`);
19601
19601
  }
19602
19602
  function getAudioTracksByGroup(allAudioTracks) {
19603
19603
  return allAudioTracks.reduce((audioTracksByGroup, track) => {
@@ -19883,7 +19883,7 @@ class AbrController {
19883
19883
  this.resetEstimator(nextLoadLevelBitrate);
19884
19884
  }
19885
19885
  this.clearTimer();
19886
- logger.warn(`[abr] Fragment ${frag.sn}${part ? ' part ' + part.index : ''} of level ${frag.level} is loading too slowly;
19886
+ logger$1.warn(`[abr] Fragment ${frag.sn}${part ? ' part ' + part.index : ''} of level ${frag.level} is loading too slowly;
19887
19887
  Time to underbuffer: ${bufferStarvationDelay.toFixed(3)} s
19888
19888
  Estimated load time for current fragment: ${fragLoadedDelay.toFixed(3)} s
19889
19889
  Estimated load time for down switch fragment: ${fragLevelNextLoadedDelay.toFixed(3)} s
@@ -19903,7 +19903,7 @@ class AbrController {
19903
19903
  }
19904
19904
  resetEstimator(abrEwmaDefaultEstimate) {
19905
19905
  if (abrEwmaDefaultEstimate) {
19906
- logger.log(`setting initial bwe to ${abrEwmaDefaultEstimate}`);
19906
+ logger$1.log(`setting initial bwe to ${abrEwmaDefaultEstimate}`);
19907
19907
  this.hls.config.abrEwmaDefaultEstimate = abrEwmaDefaultEstimate;
19908
19908
  }
19909
19909
  this.firstSelection = -1;
@@ -20135,7 +20135,7 @@ class AbrController {
20135
20135
  }
20136
20136
  const firstLevel = this.hls.firstLevel;
20137
20137
  const clamped = Math.min(Math.max(firstLevel, minAutoLevel), maxAutoLevel);
20138
- logger.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${firstLevel} clamped to ${clamped}`);
20138
+ logger$1.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${firstLevel} clamped to ${clamped}`);
20139
20139
  return clamped;
20140
20140
  }
20141
20141
  get forcedAutoLevel() {
@@ -20213,13 +20213,13 @@ class AbrController {
20213
20213
  // cap maxLoadingDelay and ensure it is not bigger 'than bitrate test' frag duration
20214
20214
  const maxLoadingDelay = currentFragDuration ? Math.min(currentFragDuration, config.maxLoadingDelay) : config.maxLoadingDelay;
20215
20215
  maxStarvationDelay = maxLoadingDelay - bitrateTestDelay;
20216
- logger.info(`[abr] bitrate test took ${Math.round(1000 * bitrateTestDelay)}ms, set first fragment max fetchDuration to ${Math.round(1000 * maxStarvationDelay)} ms`);
20216
+ logger$1.info(`[abr] bitrate test took ${Math.round(1000 * bitrateTestDelay)}ms, set first fragment max fetchDuration to ${Math.round(1000 * maxStarvationDelay)} ms`);
20217
20217
  // don't use conservative factor on bitrate test
20218
20218
  bwFactor = bwUpFactor = 1;
20219
20219
  }
20220
20220
  }
20221
20221
  const bestLevel = this.findBestLevel(avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay, maxStarvationDelay, bwFactor, bwUpFactor);
20222
- logger.info(`[abr] ${bufferStarvationDelay ? 'rebuffering expected' : 'buffer is empty'}, optimal quality level ${bestLevel}`);
20222
+ logger$1.info(`[abr] ${bufferStarvationDelay ? 'rebuffering expected' : 'buffer is empty'}, optimal quality level ${bestLevel}`);
20223
20223
  if (bestLevel > -1) {
20224
20224
  return bestLevel;
20225
20225
  }
@@ -20293,7 +20293,7 @@ class AbrController {
20293
20293
  currentVideoRange = preferHDR ? videoRanges[videoRanges.length - 1] : videoRanges[0];
20294
20294
  currentFrameRate = minFramerate;
20295
20295
  currentBw = Math.max(currentBw, minBitrate);
20296
- logger.log(`[abr] picked start tier ${JSON.stringify(startTier)}`);
20296
+ logger$1.log(`[abr] picked start tier ${JSON.stringify(startTier)}`);
20297
20297
  } else {
20298
20298
  currentCodecSet = level == null ? void 0 : level.codecSet;
20299
20299
  currentVideoRange = level == null ? void 0 : level.videoRange;
@@ -20320,11 +20320,11 @@ class AbrController {
20320
20320
  const levels = this.hls.levels;
20321
20321
  const index = levels.indexOf(levelInfo);
20322
20322
  if (decodingInfo.error) {
20323
- logger.warn(`[abr] MediaCapabilities decodingInfo error: "${decodingInfo.error}" for level ${index} ${JSON.stringify(decodingInfo)}`);
20323
+ logger$1.warn(`[abr] MediaCapabilities decodingInfo error: "${decodingInfo.error}" for level ${index} ${JSON.stringify(decodingInfo)}`);
20324
20324
  } else if (!decodingInfo.supported) {
20325
- logger.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${index} ${JSON.stringify(decodingInfo)}`);
20325
+ logger$1.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${index} ${JSON.stringify(decodingInfo)}`);
20326
20326
  if (index > -1 && levels.length > 1) {
20327
- logger.log(`[abr] Removing unsupported level ${index}`);
20327
+ logger$1.log(`[abr] Removing unsupported level ${index}`);
20328
20328
  this.hls.removeLevel(index);
20329
20329
  }
20330
20330
  }
@@ -20371,9 +20371,9 @@ class AbrController {
20371
20371
  const forcedAutoLevel = this.forcedAutoLevel;
20372
20372
  if (i !== loadLevel && (forcedAutoLevel === -1 || forcedAutoLevel !== loadLevel)) {
20373
20373
  if (levelsSkipped.length) {
20374
- logger.trace(`[abr] Skipped level(s) ${levelsSkipped.join(',')} of ${maxAutoLevel} max with CODECS and VIDEO-RANGE:"${levels[levelsSkipped[0]].codecs}" ${levels[levelsSkipped[0]].videoRange}; not compatible with "${level.codecs}" ${currentVideoRange}`);
20374
+ logger$1.trace(`[abr] Skipped level(s) ${levelsSkipped.join(',')} of ${maxAutoLevel} max with CODECS and VIDEO-RANGE:"${levels[levelsSkipped[0]].codecs}" ${levels[levelsSkipped[0]].videoRange}; not compatible with "${level.codecs}" ${currentVideoRange}`);
20375
20375
  }
20376
- logger.info(`[abr] switch candidate:${selectionBaseLevel}->${i} adjustedbw(${Math.round(adjustedbw)})-bitrate=${Math.round(adjustedbw - bitrate)} ttfb:${ttfbEstimateSec.toFixed(1)} avgDuration:${avgDuration.toFixed(1)} maxFetchDuration:${maxFetchDuration.toFixed(1)} fetchDuration:${fetchDuration.toFixed(1)} firstSelection:${firstSelection} codecSet:${currentCodecSet} videoRange:${currentVideoRange} hls.loadLevel:${loadLevel}`);
20376
+ logger$1.info(`[abr] switch candidate:${selectionBaseLevel}->${i} adjustedbw(${Math.round(adjustedbw)})-bitrate=${Math.round(adjustedbw - bitrate)} ttfb:${ttfbEstimateSec.toFixed(1)} avgDuration:${avgDuration.toFixed(1)} maxFetchDuration:${maxFetchDuration.toFixed(1)} fetchDuration:${fetchDuration.toFixed(1)} firstSelection:${firstSelection} codecSet:${currentCodecSet} videoRange:${currentVideoRange} hls.loadLevel:${loadLevel}`);
20377
20377
  }
20378
20378
  if (firstSelection) {
20379
20379
  this.firstSelection = i;
@@ -21068,7 +21068,7 @@ class BufferHelper {
21068
21068
  try {
21069
21069
  return media.buffered;
21070
21070
  } catch (e) {
21071
- logger.log('failed to get media.buffered', e);
21071
+ logger$1.log('failed to get media.buffered', e);
21072
21072
  return noopBuffered;
21073
21073
  }
21074
21074
  }
@@ -21128,12 +21128,12 @@ function findDiscontinuousReferenceFrag(prevDetails, curDetails) {
21128
21128
  const prevFrags = prevDetails.fragments;
21129
21129
  const curFrags = curDetails.fragments;
21130
21130
  if (!curFrags.length || !prevFrags.length) {
21131
- logger.log('No fragments to align');
21131
+ logger$1.log('No fragments to align');
21132
21132
  return;
21133
21133
  }
21134
21134
  const prevStartFrag = findFirstFragWithCC(prevFrags, curFrags[0].cc);
21135
21135
  if (!prevStartFrag || prevStartFrag && !prevStartFrag.startPTS) {
21136
- logger.log('No frag in previous level to align on');
21136
+ logger$1.log('No frag in previous level to align on');
21137
21137
  return;
21138
21138
  }
21139
21139
  return prevStartFrag;
@@ -21198,7 +21198,7 @@ function alignDiscontinuities(lastFrag, details, switchDetails) {
21198
21198
  if (shouldAlignOnDiscontinuities(lastFrag, switchDetails, details)) {
21199
21199
  const referenceFrag = findDiscontinuousReferenceFrag(switchDetails, details);
21200
21200
  if (referenceFrag && isFiniteNumber(referenceFrag.start)) {
21201
- logger.log(`Adjusting PTS using last level due to CC increase within current level ${details.url}`);
21201
+ logger$1.log(`Adjusting PTS using last level due to CC increase within current level ${details.url}`);
21202
21202
  adjustSlidingStart(referenceFrag.start, details);
21203
21203
  }
21204
21204
  }
@@ -21961,7 +21961,7 @@ class Decrypter {
21961
21961
  const crypto = new AESCrypto(this.subtle, new Uint8Array(iv));
21962
21962
  return crypto.decrypt(data.buffer, aesKey);
21963
21963
  }).catch(err => {
21964
- logger.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${err.name}: ${err.message}`);
21964
+ logger$1.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${err.name}: ${err.message}`);
21965
21965
  return this.onWebCryptoError(data, key, iv);
21966
21966
  });
21967
21967
  }
@@ -21988,7 +21988,7 @@ class Decrypter {
21988
21988
  if (!this.logEnabled) {
21989
21989
  return;
21990
21990
  }
21991
- logger.log(`[decrypter]: ${msg}`);
21991
+ logger$1.log(`[decrypter]: ${msg}`);
21992
21992
  this.logEnabled = false;
21993
21993
  }
21994
21994
  }
@@ -22056,8 +22056,8 @@ class BaseStreamController extends TaskLoop {
22056
22056
  this.warn = void 0;
22057
22057
  this.playlistType = playlistType;
22058
22058
  this.logPrefix = logPrefix;
22059
- this.log = logger.log.bind(logger, `${logPrefix}:`);
22060
- this.warn = logger.warn.bind(logger, `${logPrefix}:`);
22059
+ this.log = logger$1.log.bind(logger$1, `${logPrefix}:`);
22060
+ this.warn = logger$1.warn.bind(logger$1, `${logPrefix}:`);
22061
22061
  this.hls = hls;
22062
22062
  this.fragmentLoader = new FragmentLoader(hls.config);
22063
22063
  this.keyLoader = keyLoader;
@@ -23104,7 +23104,7 @@ class BaseStreamController extends TaskLoop {
23104
23104
  errorAction.resolved = true;
23105
23105
  }
23106
23106
  } else {
23107
- logger.warn(`${data.details} reached or exceeded max retry (${retryCount})`);
23107
+ logger$1.warn(`${data.details} reached or exceeded max retry (${retryCount})`);
23108
23108
  return;
23109
23109
  }
23110
23110
  } else if ((errorAction == null ? void 0 : errorAction.action) === NetworkErrorAction.SendAlternateToPenaltyBox) {
@@ -23537,7 +23537,7 @@ function getAudioConfig(observer, data, offset, audioCodec) {
23537
23537
  adtsChannelConfig = (data[offset + 2] & 0x01) << 2;
23538
23538
  // byte 3
23539
23539
  adtsChannelConfig |= (data[offset + 3] & 0xc0) >>> 6;
23540
- logger.log(`manifest codec:${audioCodec}, ADTS type:${adtsObjectType}, samplingIndex:${adtsSamplingIndex}`);
23540
+ logger$1.log(`manifest codec:${audioCodec}, ADTS type:${adtsObjectType}, samplingIndex:${adtsSamplingIndex}`);
23541
23541
  // firefox: freq less than 24kHz = AAC SBR (HE-AAC)
23542
23542
  if (/firefox/i.test(userAgent)) {
23543
23543
  if (adtsSamplingIndex >= 6) {
@@ -23687,7 +23687,7 @@ function initTrackConfig(track, observer, data, offset, audioCodec) {
23687
23687
  track.channelCount = config.channelCount;
23688
23688
  track.codec = config.codec;
23689
23689
  track.manifestCodec = config.manifestCodec;
23690
- logger.log(`parsed codec:${track.codec}, rate:${config.samplerate}, channels:${config.channelCount}`);
23690
+ logger$1.log(`parsed codec:${track.codec}, rate:${config.samplerate}, channels:${config.channelCount}`);
23691
23691
  }
23692
23692
  }
23693
23693
  function getFrameDuration(samplerate) {
@@ -23943,7 +23943,7 @@ class AACDemuxer extends BaseAudioDemuxer {
23943
23943
  }
23944
23944
  for (let length = data.length; offset < length; offset++) {
23945
23945
  if (probe$1(data, offset)) {
23946
- logger.log('ADTS sync word found !');
23946
+ logger$1.log('ADTS sync word found !');
23947
23947
  return true;
23948
23948
  }
23949
23949
  }
@@ -24275,7 +24275,7 @@ class BaseVideoParser {
24275
24275
  videoTrack.samples.push(VideoSample);
24276
24276
  }
24277
24277
  if (VideoSample.debug.length) {
24278
- logger.log(VideoSample.pts + '/' + VideoSample.dts + ':' + VideoSample.debug);
24278
+ logger$1.log(VideoSample.pts + '/' + VideoSample.dts + ':' + VideoSample.debug);
24279
24279
  }
24280
24280
  }
24281
24281
  }
@@ -24339,7 +24339,7 @@ class ExpGolomb {
24339
24339
  let bits = Math.min(this.bitsAvailable, size); // :uint
24340
24340
  const valu = this.word >>> 32 - bits; // :uint
24341
24341
  if (size > 32) {
24342
- logger.error('Cannot read more than 32 bits at a time');
24342
+ logger$1.error('Cannot read more than 32 bits at a time');
24343
24343
  }
24344
24344
  this.bitsAvailable -= bits;
24345
24345
  if (this.bitsAvailable > 0) {
@@ -24982,7 +24982,7 @@ class TSDemuxer {
24982
24982
  static probe(data) {
24983
24983
  const syncOffset = TSDemuxer.syncOffset(data);
24984
24984
  if (syncOffset > 0) {
24985
- logger.warn(`MPEG2-TS detected but first sync word found @ offset ${syncOffset}`);
24985
+ logger$1.warn(`MPEG2-TS detected but first sync word found @ offset ${syncOffset}`);
24986
24986
  }
24987
24987
  return syncOffset !== -1;
24988
24988
  }
@@ -25231,7 +25231,7 @@ class TSDemuxer {
25231
25231
  id3Track.pid = id3Pid;
25232
25232
  }
25233
25233
  if (unknownPID !== null && !pmtParsed) {
25234
- logger.warn(`MPEG-TS PMT found at ${start} after unknown PID '${unknownPID}'. Backtracking to sync byte @${syncOffset} to parse all TS packets.`);
25234
+ logger$1.warn(`MPEG-TS PMT found at ${start} after unknown PID '${unknownPID}'. Backtracking to sync byte @${syncOffset} to parse all TS packets.`);
25235
25235
  unknownPID = null;
25236
25236
  // we set it to -188, the += 188 in the for loop will reset start to 0
25237
25237
  start = syncOffset - 188;
@@ -25325,7 +25325,7 @@ class TSDemuxer {
25325
25325
  audioTrack.pesData = null;
25326
25326
  } else {
25327
25327
  if (audioData != null && audioData.size) {
25328
- logger.log('last AAC PES packet truncated,might overlap between fragments');
25328
+ logger$1.log('last AAC PES packet truncated,might overlap between fragments');
25329
25329
  }
25330
25330
 
25331
25331
  // either audioData null or PES truncated, keep it for next frag parsing
@@ -25420,7 +25420,7 @@ class TSDemuxer {
25420
25420
  const frameDuration = getFrameDuration(track.samplerate);
25421
25421
  pts = aacOverFlow.sample.pts + frameDuration;
25422
25422
  } else {
25423
- logger.warn('[tsdemuxer]: AAC PES unknown PTS');
25423
+ logger$1.warn('[tsdemuxer]: AAC PES unknown PTS');
25424
25424
  return;
25425
25425
  }
25426
25426
 
@@ -25450,7 +25450,7 @@ class TSDemuxer {
25450
25450
  let offset = 0;
25451
25451
  const pts = pes.pts;
25452
25452
  if (pts === undefined) {
25453
- logger.warn('[tsdemuxer]: MPEG PES unknown PTS');
25453
+ logger$1.warn('[tsdemuxer]: MPEG PES unknown PTS');
25454
25454
  return;
25455
25455
  }
25456
25456
  while (offset < length) {
@@ -25474,7 +25474,7 @@ class TSDemuxer {
25474
25474
  const data = pes.data;
25475
25475
  const pts = pes.pts;
25476
25476
  if (pts === undefined) {
25477
- logger.warn('[tsdemuxer]: AC3 PES unknown PTS');
25477
+ logger$1.warn('[tsdemuxer]: AC3 PES unknown PTS');
25478
25478
  return;
25479
25479
  }
25480
25480
  const length = data.length;
@@ -25488,7 +25488,7 @@ class TSDemuxer {
25488
25488
  }
25489
25489
  parseID3PES(id3Track, pes) {
25490
25490
  if (pes.pts === undefined) {
25491
- logger.warn('[tsdemuxer]: ID3 PES unknown PTS');
25491
+ logger$1.warn('[tsdemuxer]: ID3 PES unknown PTS');
25492
25492
  return;
25493
25493
  }
25494
25494
  const id3Sample = _extends({}, pes, {
@@ -25569,7 +25569,7 @@ function parsePMT(data, offset, typeSupported, isSampleAes, observer) {
25569
25569
  case 0x04:
25570
25570
  // logger.log('MPEG PID:' + pid);
25571
25571
  if (!typeSupported.mpeg && !typeSupported.mp3) {
25572
- logger.log('MPEG audio found, not supported in this browser');
25572
+ logger$1.log('MPEG audio found, not supported in this browser');
25573
25573
  } else if (result.audioPid === -1) {
25574
25574
  result.audioPid = pid;
25575
25575
  result.segmentAudioCodec = 'mp3';
@@ -25585,7 +25585,7 @@ function parsePMT(data, offset, typeSupported, isSampleAes, observer) {
25585
25585
  case 0x81:
25586
25586
  {
25587
25587
  if (!typeSupported.ac3) {
25588
- logger.log('AC-3 audio found, not supported in this browser');
25588
+ logger$1.log('AC-3 audio found, not supported in this browser');
25589
25589
  } else if (result.audioPid === -1) {
25590
25590
  result.audioPid = pid;
25591
25591
  result.segmentAudioCodec = 'ac3';
@@ -25607,7 +25607,7 @@ function parsePMT(data, offset, typeSupported, isSampleAes, observer) {
25607
25607
  // DVB Descriptor for AC-3
25608
25608
  {
25609
25609
  if (typeSupported.ac3 !== true) {
25610
- logger.log('AC-3 audio found, not supported in this browser for now');
25610
+ logger$1.log('AC-3 audio found, not supported in this browser for now');
25611
25611
  } else {
25612
25612
  result.audioPid = pid;
25613
25613
  result.segmentAudioCodec = 'ac3';
@@ -25637,7 +25637,7 @@ function parsePMT(data, offset, typeSupported, isSampleAes, observer) {
25637
25637
  return result;
25638
25638
  }
25639
25639
  function emitParsingError(observer, error, levelRetry) {
25640
- logger.warn(`parsing error: ${error.message}`);
25640
+ logger$1.warn(`parsing error: ${error.message}`);
25641
25641
  observer.emit(Events.ERROR, Events.ERROR, {
25642
25642
  type: ErrorTypes.MEDIA_ERROR,
25643
25643
  details: ErrorDetails.FRAG_PARSING_ERROR,
@@ -25648,7 +25648,7 @@ function emitParsingError(observer, error, levelRetry) {
25648
25648
  });
25649
25649
  }
25650
25650
  function logEncryptedSamplesFoundInUnencryptedStream(type) {
25651
- logger.log(`${type} with AES-128-CBC encryption found in unencrypted stream`);
25651
+ logger$1.log(`${type} with AES-128-CBC encryption found in unencrypted stream`);
25652
25652
  }
25653
25653
  function parsePES(stream) {
25654
25654
  let i = 0;
@@ -25705,7 +25705,7 @@ function parsePES(stream) {
25705
25705
  // 1 << 7
25706
25706
  (frag[18] & 0xfe) / 2;
25707
25707
  if (pesPts - pesDts > 60 * 90000) {
25708
- logger.warn(`${Math.round((pesPts - pesDts) / 90000)}s delta between PTS and DTS, align them`);
25708
+ logger$1.warn(`${Math.round((pesPts - pesDts) / 90000)}s delta between PTS and DTS, align them`);
25709
25709
  pesPts = pesDts;
25710
25710
  }
25711
25711
  } else {
@@ -25793,7 +25793,7 @@ class MP3Demuxer extends BaseAudioDemuxer {
25793
25793
  }
25794
25794
  for (let length = data.length; offset < length; offset++) {
25795
25795
  if (probe(data, offset)) {
25796
- logger.log('MPEG Audio sync word found !');
25796
+ logger$1.log('MPEG Audio sync word found !');
25797
25797
  return true;
25798
25798
  }
25799
25799
  }
@@ -26491,16 +26491,16 @@ class MP4Remuxer {
26491
26491
  this.config = this.videoTrackConfig = this._initPTS = this._initDTS = null;
26492
26492
  }
26493
26493
  resetTimeStamp(defaultTimeStamp) {
26494
- logger.log('[mp4-remuxer]: initPTS & initDTS reset');
26494
+ logger$1.log('[mp4-remuxer]: initPTS & initDTS reset');
26495
26495
  this._initPTS = this._initDTS = defaultTimeStamp;
26496
26496
  }
26497
26497
  resetNextTimestamp() {
26498
- logger.log('[mp4-remuxer]: reset next timestamp');
26498
+ logger$1.log('[mp4-remuxer]: reset next timestamp');
26499
26499
  this.isVideoContiguous = false;
26500
26500
  this.isAudioContiguous = false;
26501
26501
  }
26502
26502
  resetInitSegment() {
26503
- logger.log('[mp4-remuxer]: ISGenerated flag reset');
26503
+ logger$1.log('[mp4-remuxer]: ISGenerated flag reset');
26504
26504
  this.ISGenerated = false;
26505
26505
  this.videoTrackConfig = undefined;
26506
26506
  }
@@ -26519,7 +26519,7 @@ class MP4Remuxer {
26519
26519
  }
26520
26520
  }, videoSamples[0].pts);
26521
26521
  if (rolloverDetected) {
26522
- logger.debug('PTS rollover detected');
26522
+ logger$1.debug('PTS rollover detected');
26523
26523
  }
26524
26524
  return startPTS;
26525
26525
  }
@@ -26562,14 +26562,14 @@ class MP4Remuxer {
26562
26562
  if (!isVideoContiguous && this.config.forceKeyFrameOnDiscontinuity) {
26563
26563
  independent = true;
26564
26564
  if (firstKeyFrameIndex > 0) {
26565
- logger.warn(`[mp4-remuxer]: Dropped ${firstKeyFrameIndex} out of ${length} video samples due to a missing keyframe`);
26565
+ logger$1.warn(`[mp4-remuxer]: Dropped ${firstKeyFrameIndex} out of ${length} video samples due to a missing keyframe`);
26566
26566
  const startPTS = this.getVideoStartPts(videoTrack.samples);
26567
26567
  videoTrack.samples = videoTrack.samples.slice(firstKeyFrameIndex);
26568
26568
  videoTrack.dropped += firstKeyFrameIndex;
26569
26569
  videoTimeOffset += (videoTrack.samples[0].pts - startPTS) / videoTrack.inputTimeScale;
26570
26570
  firstKeyFramePTS = videoTimeOffset;
26571
26571
  } else if (firstKeyFrameIndex === -1) {
26572
- logger.warn(`[mp4-remuxer]: No keyframe found out of ${length} video samples`);
26572
+ logger$1.warn(`[mp4-remuxer]: No keyframe found out of ${length} video samples`);
26573
26573
  independent = false;
26574
26574
  }
26575
26575
  }
@@ -26591,7 +26591,7 @@ class MP4Remuxer {
26591
26591
  if (enoughAudioSamples) {
26592
26592
  // if initSegment was generated without audio samples, regenerate it again
26593
26593
  if (!audioTrack.samplerate) {
26594
- logger.warn('[mp4-remuxer]: regenerate InitSegment as audio detected');
26594
+ logger$1.warn('[mp4-remuxer]: regenerate InitSegment as audio detected');
26595
26595
  initSegment = this.generateIS(audioTrack, videoTrack, timeOffset, accurateTimeOffset);
26596
26596
  }
26597
26597
  audio = this.remuxAudio(audioTrack, audioTimeOffset, this.isAudioContiguous, accurateTimeOffset, hasVideo || enoughVideoSamples || playlistType === PlaylistLevelType.AUDIO ? videoTimeOffset : undefined);
@@ -26599,7 +26599,7 @@ class MP4Remuxer {
26599
26599
  const audioTrackLength = audio ? audio.endPTS - audio.startPTS : 0;
26600
26600
  // if initSegment was generated without video samples, regenerate it again
26601
26601
  if (!videoTrack.inputTimeScale) {
26602
- logger.warn('[mp4-remuxer]: regenerate InitSegment as video detected');
26602
+ logger$1.warn('[mp4-remuxer]: regenerate InitSegment as video detected');
26603
26603
  initSegment = this.generateIS(audioTrack, videoTrack, timeOffset, accurateTimeOffset);
26604
26604
  }
26605
26605
  video = this.remuxVideo(videoTrack, videoTimeOffset, isVideoContiguous, audioTrackLength);
@@ -26805,9 +26805,9 @@ class MP4Remuxer {
26805
26805
  const foundOverlap = delta < -1;
26806
26806
  if (foundHole || foundOverlap) {
26807
26807
  if (foundHole) {
26808
- logger.warn(`AVC: ${toMsFromMpegTsClock(delta, true)} ms (${delta}dts) hole between fragments detected at ${timeOffset.toFixed(3)}`);
26808
+ logger$1.warn(`AVC: ${toMsFromMpegTsClock(delta, true)} ms (${delta}dts) hole between fragments detected at ${timeOffset.toFixed(3)}`);
26809
26809
  } else {
26810
- logger.warn(`AVC: ${toMsFromMpegTsClock(-delta, true)} ms (${delta}dts) overlapping between fragments detected at ${timeOffset.toFixed(3)}`);
26810
+ logger$1.warn(`AVC: ${toMsFromMpegTsClock(-delta, true)} ms (${delta}dts) overlapping between fragments detected at ${timeOffset.toFixed(3)}`);
26811
26811
  }
26812
26812
  if (!foundOverlap || nextAvcDts >= inputSamples[0].pts || chromeVersion) {
26813
26813
  firstDTS = nextAvcDts;
@@ -26824,7 +26824,7 @@ class MP4Remuxer {
26824
26824
  inputSamples[i].pts -= delta;
26825
26825
  }
26826
26826
  }
26827
- logger.log(`Video: Initial PTS/DTS adjusted: ${toMsFromMpegTsClock(firstPTS, true)}/${toMsFromMpegTsClock(firstDTS, true)}, delta: ${toMsFromMpegTsClock(delta, true)} ms`);
26827
+ logger$1.log(`Video: Initial PTS/DTS adjusted: ${toMsFromMpegTsClock(firstPTS, true)}/${toMsFromMpegTsClock(firstDTS, true)}, delta: ${toMsFromMpegTsClock(delta, true)} ms`);
26828
26828
  }
26829
26829
  }
26830
26830
  }
@@ -26924,7 +26924,7 @@ class MP4Remuxer {
26924
26924
  } else {
26925
26925
  stretchedLastFrame = true;
26926
26926
  }
26927
- logger.log(`[mp4-remuxer]: It is approximately ${deltaToFrameEnd / 90} ms to the next segment; using duration ${mp4SampleDuration / 90} ms for the last video frame.`);
26927
+ logger$1.log(`[mp4-remuxer]: It is approximately ${deltaToFrameEnd / 90} ms to the next segment; using duration ${mp4SampleDuration / 90} ms for the last video frame.`);
26928
26928
  } else {
26929
26929
  mp4SampleDuration = lastFrameDuration;
26930
26930
  }
@@ -26952,7 +26952,7 @@ class MP4Remuxer {
26952
26952
  // Fix for "CNN special report, with CC" in test-streams (Safari browser only)
26953
26953
  // Ignore DTS when frame durations are irregular. Safari MSE does not handle this leading to gaps.
26954
26954
  if (maxPtsDelta - minPtsDelta < maxDtsDelta - minDtsDelta && averageSampleDuration / maxDtsDelta < 0.025 && outputSamples[0].cts === 0) {
26955
- logger.warn('Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.');
26955
+ logger$1.warn('Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.');
26956
26956
  let dts = firstDTS;
26957
26957
  for (let i = 0, len = outputSamples.length; i < len; i++) {
26958
26958
  const nextDts = dts + outputSamples[i].duration;
@@ -27077,7 +27077,7 @@ class MP4Remuxer {
27077
27077
  // When remuxing with video, if we're overlapping by more than a duration, drop this sample to stay in sync
27078
27078
  if (delta <= -maxAudioFramesDrift * inputSampleDuration && alignedWithVideo) {
27079
27079
  if (i === 0) {
27080
- logger.warn(`Audio frame @ ${(pts / inputTimeScale).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1000 * delta / inputTimeScale)} ms.`);
27080
+ logger$1.warn(`Audio frame @ ${(pts / inputTimeScale).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1000 * delta / inputTimeScale)} ms.`);
27081
27081
  this.nextAudioPts = nextAudioPts = nextPts = pts;
27082
27082
  }
27083
27083
  } // eslint-disable-line brace-style
@@ -27099,12 +27099,12 @@ class MP4Remuxer {
27099
27099
  if (i === 0) {
27100
27100
  this.nextAudioPts = nextAudioPts = nextPts;
27101
27101
  }
27102
- logger.warn(`[mp4-remuxer]: Injecting ${missing} audio frame @ ${(nextPts / inputTimeScale).toFixed(3)}s due to ${Math.round(1000 * delta / inputTimeScale)} ms gap.`);
27102
+ logger$1.warn(`[mp4-remuxer]: Injecting ${missing} audio frame @ ${(nextPts / inputTimeScale).toFixed(3)}s due to ${Math.round(1000 * delta / inputTimeScale)} ms gap.`);
27103
27103
  for (let j = 0; j < missing; j++) {
27104
27104
  const newStamp = Math.max(nextPts, 0);
27105
27105
  let fillFrame = AAC.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);
27106
27106
  if (!fillFrame) {
27107
- logger.log('[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead.');
27107
+ logger$1.log('[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead.');
27108
27108
  fillFrame = sample.unit.subarray();
27109
27109
  }
27110
27110
  inputSamples.splice(i, 0, {
@@ -27231,10 +27231,10 @@ class MP4Remuxer {
27231
27231
  const nbSamples = Math.ceil((endDTS - startDTS) / frameDuration);
27232
27232
  // silent frame
27233
27233
  const silentFrame = AAC.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);
27234
- logger.warn('[mp4-remuxer]: remux empty Audio');
27234
+ logger$1.warn('[mp4-remuxer]: remux empty Audio');
27235
27235
  // Can't remux if we can't generate a silent frame...
27236
27236
  if (!silentFrame) {
27237
- logger.trace('[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec');
27237
+ logger$1.trace('[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec');
27238
27238
  return;
27239
27239
  }
27240
27240
  const samples = [];
@@ -27402,7 +27402,7 @@ class PassThroughRemuxer {
27402
27402
  id: 'main'
27403
27403
  };
27404
27404
  } else {
27405
- logger.warn('[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes.');
27405
+ logger$1.warn('[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes.');
27406
27406
  }
27407
27407
  this.initTracks = tracks;
27408
27408
  }
@@ -27444,7 +27444,7 @@ class PassThroughRemuxer {
27444
27444
  }
27445
27445
  if (!((_initData2 = initData) != null && _initData2.length)) {
27446
27446
  // We can't remux if the initSegment could not be generated
27447
- logger.warn('[passthrough-remuxer.ts]: Failed to generate initSegment.');
27447
+ logger$1.warn('[passthrough-remuxer.ts]: Failed to generate initSegment.');
27448
27448
  return result;
27449
27449
  }
27450
27450
  if (this.emitInitSegment) {
@@ -27457,7 +27457,7 @@ class PassThroughRemuxer {
27457
27457
  if (isInvalidInitPts(initPTS, decodeTime, timeOffset, duration) || initSegment.timescale !== initPTS.timescale && accurateTimeOffset) {
27458
27458
  initSegment.initPTS = decodeTime - timeOffset;
27459
27459
  if (initPTS && initPTS.timescale === 1) {
27460
- logger.warn(`Adjusting initPTS by ${initSegment.initPTS - initPTS.baseTime}`);
27460
+ logger$1.warn(`Adjusting initPTS by ${initSegment.initPTS - initPTS.baseTime}`);
27461
27461
  }
27462
27462
  this.initPTS = initPTS = {
27463
27463
  baseTime: initSegment.initPTS,
@@ -27470,7 +27470,7 @@ class PassThroughRemuxer {
27470
27470
  if (duration > 0) {
27471
27471
  this.lastEndTime = endTime;
27472
27472
  } else {
27473
- logger.warn('Duration parsed from mp4 should be greater than zero');
27473
+ logger$1.warn('Duration parsed from mp4 should be greater than zero');
27474
27474
  this.resetNextTimestamp();
27475
27475
  }
27476
27476
  const hasAudio = !!initData.audio;
@@ -27528,12 +27528,12 @@ function getParsedTrackCodec(track, type) {
27528
27528
  return getCodecCompatibleName(parsedCodec, preferManagedMediaSource);
27529
27529
  }
27530
27530
  const result = 'mp4a.40.5';
27531
- logger.info(`Parsed audio codec "${parsedCodec}" or audio object type not handled. Using "${result}"`);
27531
+ logger$1.info(`Parsed audio codec "${parsedCodec}" or audio object type not handled. Using "${result}"`);
27532
27532
  return result;
27533
27533
  }
27534
27534
  // Provide defaults based on codec type
27535
27535
  // This allows for some playback of some fmp4 playlists without CODECS defined in manifest
27536
- logger.warn(`Unhandled video codec "${parsedCodec}"`);
27536
+ logger$1.warn(`Unhandled video codec "${parsedCodec}"`);
27537
27537
  if (parsedCodec === 'hvc1' || parsedCodec === 'hev1') {
27538
27538
  return 'hvc1.1.6.L120.90';
27539
27539
  }
@@ -27548,7 +27548,7 @@ let now$1;
27548
27548
  try {
27549
27549
  now$1 = self.performance.now.bind(self.performance);
27550
27550
  } catch (err) {
27551
- logger.debug('Unable to use Performance API on this environment');
27551
+ logger$1.debug('Unable to use Performance API on this environment');
27552
27552
  now$1 = optionalSelf == null ? void 0 : optionalSelf.Date.now;
27553
27553
  }
27554
27554
  const muxConfig = [{
@@ -27656,7 +27656,7 @@ class Transmuxer {
27656
27656
  if (resetMuxers) {
27657
27657
  const error = this.configureTransmuxer(uintData);
27658
27658
  if (error) {
27659
- logger.warn(`[transmuxer] ${error.message}`);
27659
+ logger$1.warn(`[transmuxer] ${error.message}`);
27660
27660
  this.observer.emit(Events.ERROR, Events.ERROR, {
27661
27661
  type: ErrorTypes.MEDIA_ERROR,
27662
27662
  details: ErrorDetails.FRAG_PARSING_ERROR,
@@ -27747,7 +27747,7 @@ class Transmuxer {
27747
27747
  accurateTimeOffset,
27748
27748
  timeOffset
27749
27749
  } = this.currentTransmuxState;
27750
- logger.log(`[transmuxer.ts]: Flushed fragment ${chunkMeta.sn}${chunkMeta.part > -1 ? ' p: ' + chunkMeta.part : ''} of level ${chunkMeta.level}`);
27750
+ logger$1.log(`[transmuxer.ts]: Flushed fragment ${chunkMeta.sn}${chunkMeta.part > -1 ? ' p: ' + chunkMeta.part : ''} of level ${chunkMeta.level}`);
27751
27751
  const remuxResult = this.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, accurateTimeOffset, true, this.id);
27752
27752
  transmuxResults.push({
27753
27753
  remuxResult,
@@ -28309,10 +28309,10 @@ class TransmuxerInterface {
28309
28309
  if (canCreateWorker) {
28310
28310
  try {
28311
28311
  if (config.workerPath) {
28312
- logger.log(`loading Web Worker ${config.workerPath} for "${id}"`);
28312
+ logger$1.log(`loading Web Worker ${config.workerPath} for "${id}"`);
28313
28313
  this.workerContext = loadWorker(config.workerPath);
28314
28314
  } else {
28315
- logger.log(`injecting Web Worker for "${id}"`);
28315
+ logger$1.log(`injecting Web Worker for "${id}"`);
28316
28316
  this.workerContext = injectWorker();
28317
28317
  }
28318
28318
  this.onwmsg = event => this.onWorkerMessage(event);
@@ -28323,7 +28323,7 @@ class TransmuxerInterface {
28323
28323
  worker.onerror = event => {
28324
28324
  const error = new Error(`${event.message} (${event.filename}:${event.lineno})`);
28325
28325
  config.enableWorker = false;
28326
- logger.warn(`Error in "${id}" Web Worker, fallback to inline`);
28326
+ logger$1.warn(`Error in "${id}" Web Worker, fallback to inline`);
28327
28327
  this.hls.trigger(Events.ERROR, {
28328
28328
  type: ErrorTypes.OTHER_ERROR,
28329
28329
  details: ErrorDetails.INTERNAL_EXCEPTION,
@@ -28340,7 +28340,7 @@ class TransmuxerInterface {
28340
28340
  config: JSON.stringify(config)
28341
28341
  });
28342
28342
  } catch (err) {
28343
- logger.warn(`Error setting up "${id}" Web Worker, fallback to inline`, err);
28343
+ logger$1.warn(`Error setting up "${id}" Web Worker, fallback to inline`, err);
28344
28344
  this.resetWorker();
28345
28345
  this.error = null;
28346
28346
  this.transmuxer = new Transmuxer(this.observer, m2tsTypeSupported, config, '', id);
@@ -28413,7 +28413,7 @@ class TransmuxerInterface {
28413
28413
  const initSegmentChange = !(lastFrag && ((_frag$initSegment = frag.initSegment) == null ? void 0 : _frag$initSegment.url) === ((_lastFrag$initSegment = lastFrag.initSegment) == null ? void 0 : _lastFrag$initSegment.url));
28414
28414
  const state = new TransmuxState(discontinuity, contiguous, accurateTimeOffset, trackSwitch, timeOffset, initSegmentChange);
28415
28415
  if (!contiguous || discontinuity || initSegmentChange) {
28416
- logger.log(`[transmuxer-interface, ${frag.type}]: Starting new transmux session for sn: ${chunkMeta.sn} p: ${chunkMeta.part} level: ${chunkMeta.level} id: ${chunkMeta.id}
28416
+ logger$1.log(`[transmuxer-interface, ${frag.type}]: Starting new transmux session for sn: ${chunkMeta.sn} p: ${chunkMeta.part} level: ${chunkMeta.level} id: ${chunkMeta.id}
28417
28417
  discontinuity: ${discontinuity}
28418
28418
  trackSwitch: ${trackSwitch}
28419
28419
  contiguous: ${contiguous}
@@ -28503,7 +28503,7 @@ class TransmuxerInterface {
28503
28503
  onWorkerMessage(event) {
28504
28504
  const data = event.data;
28505
28505
  if (!(data != null && data.event)) {
28506
- logger.warn(`worker message received with no ${data ? 'event name' : 'data'}`);
28506
+ logger$1.warn(`worker message received with no ${data ? 'event name' : 'data'}`);
28507
28507
  return;
28508
28508
  }
28509
28509
  const hls = this.hls;
@@ -28534,8 +28534,8 @@ class TransmuxerInterface {
28534
28534
 
28535
28535
  // pass logs from the worker thread to the main logger
28536
28536
  case 'workerLog':
28537
- if (logger[data.data.logType]) {
28538
- logger[data.data.logType](data.data.message);
28537
+ if (logger$1[data.data.logType]) {
28538
+ logger$1[data.data.logType](data.data.message);
28539
28539
  }
28540
28540
  break;
28541
28541
  default:
@@ -30587,7 +30587,7 @@ class BufferOperationQueue {
30587
30587
  // which do not end with this event must call _onSBUpdateEnd manually
30588
30588
  operation.execute();
30589
30589
  } catch (error) {
30590
- logger.warn(`[buffer-operation-queue]: Exception executing "${type}" SourceBuffer operation: ${error}`);
30590
+ logger$1.warn(`[buffer-operation-queue]: Exception executing "${type}" SourceBuffer operation: ${error}`);
30591
30591
  operation.onError(error);
30592
30592
 
30593
30593
  // Only shift the current operation off, otherwise the updateend handler will do this for us
@@ -30687,15 +30687,15 @@ class BufferController {
30687
30687
  _objectUrl
30688
30688
  } = this;
30689
30689
  if (mediaSrc !== _objectUrl) {
30690
- logger.error(`Media element src was set while attaching MediaSource (${_objectUrl} > ${mediaSrc})`);
30690
+ logger$1.error(`Media element src was set while attaching MediaSource (${_objectUrl} > ${mediaSrc})`);
30691
30691
  }
30692
30692
  };
30693
30693
  this.hls = hls;
30694
30694
  const logPrefix = '[buffer-controller]';
30695
30695
  this.appendSource = isManagedMediaSource(getMediaSource(hls.config.preferManagedMediaSource));
30696
- this.log = logger.log.bind(logger, logPrefix);
30697
- this.warn = logger.warn.bind(logger, logPrefix);
30698
- this.error = logger.error.bind(logger, logPrefix);
30696
+ this.log = logger$1.log.bind(logger$1, logPrefix);
30697
+ this.warn = logger$1.warn.bind(logger$1, logPrefix);
30698
+ this.error = logger$1.error.bind(logger$1, logPrefix);
30699
30699
  this._initSourceBuffer();
30700
30700
  this.registerListeners();
30701
30701
  }
@@ -31886,7 +31886,7 @@ class CaptionsLogger {
31886
31886
  log(severity, msg) {
31887
31887
  if (this.verboseLevel >= severity) {
31888
31888
  const m = typeof msg === 'function' ? msg() : msg;
31889
- logger.log(`${this.time} [${severity}] ${m}`);
31889
+ logger$1.log(`${this.time} [${severity}] ${m}`);
31890
31890
  }
31891
31891
  }
31892
31892
  }
@@ -34211,7 +34211,7 @@ class TimelineController {
34211
34211
  if (inUseTracks != null && inUseTracks.length) {
34212
34212
  const unusedTextTracks = inUseTracks.filter(t => t !== null).map(t => t.label);
34213
34213
  if (unusedTextTracks.length) {
34214
- logger.warn(`Media element contains unused subtitle tracks: ${unusedTextTracks.join(', ')}. Replace media element for each source to clear TextTracks and captions menu.`);
34214
+ logger$1.warn(`Media element contains unused subtitle tracks: ${unusedTextTracks.join(', ')}. Replace media element for each source to clear TextTracks and captions menu.`);
34215
34215
  }
34216
34216
  }
34217
34217
  } else if (this.tracks.length) {
@@ -34328,7 +34328,7 @@ class TimelineController {
34328
34328
  frag: frag
34329
34329
  });
34330
34330
  }, error => {
34331
- logger.log(`Failed to parse IMSC1: ${error}`);
34331
+ logger$1.log(`Failed to parse IMSC1: ${error}`);
34332
34332
  hls.trigger(Events.SUBTITLE_FRAG_PROCESSED, {
34333
34333
  success: false,
34334
34334
  frag: frag,
@@ -34369,7 +34369,7 @@ class TimelineController {
34369
34369
  this._fallbackToIMSC1(frag, payload);
34370
34370
  }
34371
34371
  // Something went wrong while parsing. Trigger event with success false.
34372
- logger.log(`Failed to parse VTT cue: ${error}`);
34372
+ logger$1.log(`Failed to parse VTT cue: ${error}`);
34373
34373
  if (missingInitPTS && maxAvCC > frag.cc) {
34374
34374
  return;
34375
34375
  }
@@ -34648,7 +34648,7 @@ class CapLevelController {
34648
34648
  const hls = this.hls;
34649
34649
  const maxLevel = this.getMaxLevel(levels.length - 1);
34650
34650
  if (maxLevel !== this.autoLevelCapping) {
34651
- logger.log(`Setting autoLevelCapping to ${maxLevel}: ${levels[maxLevel].height}p@${levels[maxLevel].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`);
34651
+ logger$1.log(`Setting autoLevelCapping to ${maxLevel}: ${levels[maxLevel].height}p@${levels[maxLevel].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`);
34652
34652
  }
34653
34653
  hls.autoLevelCapping = maxLevel;
34654
34654
  if (hls.autoLevelCapping > this.autoLevelCapping && this.streamController) {
@@ -34829,7 +34829,7 @@ class FPSController {
34829
34829
  // logger.log('checkFPS : droppedFPS/decodedFPS:' + droppedFPS/(1000 * currentDecoded / currentPeriod));
34830
34830
  if (currentDropped > hls.config.fpsDroppedMonitoringThreshold * currentDecoded) {
34831
34831
  let currentLevel = hls.currentLevel;
34832
- logger.warn('drop FPS ratio greater than max allowed value for currentLevel: ' + currentLevel);
34832
+ logger$1.warn('drop FPS ratio greater than max allowed value for currentLevel: ' + currentLevel);
34833
34833
  if (currentLevel > 0 && (hls.autoLevelCapping === -1 || hls.autoLevelCapping >= currentLevel)) {
34834
34834
  currentLevel = currentLevel - 1;
34835
34835
  hls.trigger(Events.FPS_DROP_LEVEL_CAPPING, {
@@ -34882,10 +34882,10 @@ class EMEController {
34882
34882
  this.setMediaKeysQueue = EMEController.CDMCleanupPromise ? [EMEController.CDMCleanupPromise] : [];
34883
34883
  this.onMediaEncrypted = this._onMediaEncrypted.bind(this);
34884
34884
  this.onWaitingForKey = this._onWaitingForKey.bind(this);
34885
- this.debug = logger.debug.bind(logger, LOGGER_PREFIX);
34886
- this.log = logger.log.bind(logger, LOGGER_PREFIX);
34887
- this.warn = logger.warn.bind(logger, LOGGER_PREFIX);
34888
- this.error = logger.error.bind(logger, LOGGER_PREFIX);
34885
+ this.debug = logger$1.debug.bind(logger$1, LOGGER_PREFIX);
34886
+ this.log = logger$1.log.bind(logger$1, LOGGER_PREFIX);
34887
+ this.warn = logger$1.warn.bind(logger$1, LOGGER_PREFIX);
34888
+ this.error = logger$1.error.bind(logger$1, LOGGER_PREFIX);
34889
34889
  this.hls = hls;
34890
34890
  this.config = hls.config;
34891
34891
  this.registerListeners();
@@ -36742,7 +36742,7 @@ class CMCDController {
36742
36742
  su: !this.initialized
36743
36743
  });
36744
36744
  } catch (error) {
36745
- logger.warn('Could not generate manifest CMCD data.', error);
36745
+ logger$1.warn('Could not generate manifest CMCD data.', error);
36746
36746
  }
36747
36747
  };
36748
36748
  /**
@@ -36764,7 +36764,7 @@ class CMCDController {
36764
36764
  }
36765
36765
  this.apply(context, data);
36766
36766
  } catch (error) {
36767
- logger.warn('Could not generate segment CMCD data.', error);
36767
+ logger$1.warn('Could not generate segment CMCD data.', error);
36768
36768
  }
36769
36769
  };
36770
36770
  this.hls = hls;
@@ -37020,7 +37020,7 @@ class ContentSteeringController {
37020
37020
  this.subtitleTracks = null;
37021
37021
  this.penalizedPathways = {};
37022
37022
  this.hls = hls;
37023
- this.log = logger.log.bind(logger, `[content-steering]:`);
37023
+ this.log = logger$1.log.bind(logger$1, `[content-steering]:`);
37024
37024
  this.registerListeners();
37025
37025
  }
37026
37026
  registerListeners() {
@@ -37144,7 +37144,7 @@ class ContentSteeringController {
37144
37144
  errorAction.resolved = this.pathwayId !== errorPathway;
37145
37145
  }
37146
37146
  if (!errorAction.resolved) {
37147
- logger.warn(`Could not resolve ${data.details} ("${data.error.message}") with content-steering for Pathway: ${errorPathway} levels: ${levels ? levels.length : levels} priorities: ${JSON.stringify(pathwayPriority)} penalized: ${JSON.stringify(this.penalizedPathways)}`);
37147
+ logger$1.warn(`Could not resolve ${data.details} ("${data.error.message}") with content-steering for Pathway: ${errorPathway} levels: ${levels ? levels.length : levels} priorities: ${JSON.stringify(pathwayPriority)} penalized: ${JSON.stringify(this.penalizedPathways)}`);
37148
37148
  }
37149
37149
  }
37150
37150
  }
@@ -37620,7 +37620,7 @@ class XhrLoader {
37620
37620
  if (shouldRetry(retryConfig, retryCount, false, response)) {
37621
37621
  this.retry(retryConfig);
37622
37622
  } else {
37623
- logger.error(`${status} while loading ${context.url}`);
37623
+ logger$1.error(`${status} while loading ${context.url}`);
37624
37624
  this.callbacks.onError({
37625
37625
  code: status,
37626
37626
  text: xhr.statusText
@@ -37638,7 +37638,7 @@ class XhrLoader {
37638
37638
  this.retry(retryConfig);
37639
37639
  } else {
37640
37640
  var _this$context;
37641
- logger.warn(`timeout while loading ${(_this$context = this.context) == null ? void 0 : _this$context.url}`);
37641
+ logger$1.warn(`timeout while loading ${(_this$context = this.context) == null ? void 0 : _this$context.url}`);
37642
37642
  const callbacks = this.callbacks;
37643
37643
  if (callbacks) {
37644
37644
  this.abortInternal();
@@ -37653,7 +37653,7 @@ class XhrLoader {
37653
37653
  } = this;
37654
37654
  this.retryDelay = getRetryDelay(retryConfig, stats.retry);
37655
37655
  stats.retry++;
37656
- logger.warn(`${status ? 'HTTP Status ' + status : 'Timeout'} while loading ${context == null ? void 0 : context.url}, retrying ${stats.retry}/${retryConfig.maxNumRetry} in ${this.retryDelay}ms`);
37656
+ logger$1.warn(`${status ? 'HTTP Status ' + status : 'Timeout'} while loading ${context == null ? void 0 : context.url}, retrying ${stats.retry}/${retryConfig.maxNumRetry} in ${this.retryDelay}ms`);
37657
37657
  // abort and reset internal state
37658
37658
  this.abortInternal();
37659
37659
  this.loader = null;
@@ -38332,7 +38332,7 @@ function mergeConfig(defaultConfig, userConfig) {
38332
38332
  }
38333
38333
  });
38334
38334
  if (report.length) {
38335
- logger.warn(`hls.js config: "${report.join('", "')}" setting(s) are deprecated, use "${policyName}": ${JSON.stringify(userConfig[policyName])}`);
38335
+ logger$1.warn(`hls.js config: "${report.join('", "')}" setting(s) are deprecated, use "${policyName}": ${JSON.stringify(userConfig[policyName])}`);
38336
38336
  }
38337
38337
  });
38338
38338
  return _objectSpread2(_objectSpread2({}, defaultsCopy), userConfig);
@@ -38357,7 +38357,7 @@ function enableStreamingMode(config) {
38357
38357
  const currentLoader = config.loader;
38358
38358
  if (currentLoader !== FetchLoader && currentLoader !== XhrLoader) {
38359
38359
  // If a developer has configured their own loader, respect that choice
38360
- logger.log('[config]: Custom loader detected, cannot enable progressive streaming');
38360
+ logger$1.log('[config]: Custom loader detected, cannot enable progressive streaming');
38361
38361
  config.progressive = false;
38362
38362
  } else {
38363
38363
  const canStreamProgressively = fetchSupported();
@@ -38365,7 +38365,7 @@ function enableStreamingMode(config) {
38365
38365
  config.loader = FetchLoader;
38366
38366
  config.progressive = true;
38367
38367
  config.enableSoftwareAES = true;
38368
- logger.log('[config]: Progressive streaming enabled, using FetchLoader');
38368
+ logger$1.log('[config]: Progressive streaming enabled, using FetchLoader');
38369
38369
  }
38370
38370
  }
38371
38371
  }
@@ -39238,7 +39238,7 @@ class GapController {
39238
39238
  // The playhead is now moving, but was previously stalled
39239
39239
  if (this.stallReported) {
39240
39240
  const _stalledDuration = self.performance.now() - stalled;
39241
- logger.warn(`playback not stuck anymore @${currentTime}, after ${Math.round(_stalledDuration)}ms`);
39241
+ logger$1.warn(`playback not stuck anymore @${currentTime}, after ${Math.round(_stalledDuration)}ms`);
39242
39242
  this.stallReported = false;
39243
39243
  }
39244
39244
  this.stalled = null;
@@ -39349,7 +39349,7 @@ class GapController {
39349
39349
  // needs to cross some sort of threshold covering all source-buffers content
39350
39350
  // to start playing properly.
39351
39351
  if ((bufferInfo.len > config.maxBufferHole || bufferInfo.nextStart && bufferInfo.nextStart - currentTime < config.maxBufferHole) && stalledDurationMs > config.highBufferWatchdogPeriod * 1000) {
39352
- logger.warn('Trying to nudge playhead over buffer-hole');
39352
+ logger$1.warn('Trying to nudge playhead over buffer-hole');
39353
39353
  // Try to nudge currentTime over a buffer hole if we've been stalling for the configured amount of seconds
39354
39354
  // We only try to jump the hole if it's under the configured size
39355
39355
  // Reset stalled so to rearm watchdog timer
@@ -39373,7 +39373,7 @@ class GapController {
39373
39373
  // Report stalled error once
39374
39374
  this.stallReported = true;
39375
39375
  const error = new Error(`Playback stalling at @${media.currentTime} due to low buffer (${JSON.stringify(bufferInfo)})`);
39376
- logger.warn(error.message);
39376
+ logger$1.warn(error.message);
39377
39377
  hls.trigger(Events.ERROR, {
39378
39378
  type: ErrorTypes.MEDIA_ERROR,
39379
39379
  details: ErrorDetails.BUFFER_STALLED_ERROR,
@@ -39441,7 +39441,7 @@ class GapController {
39441
39441
  }
39442
39442
  }
39443
39443
  const targetTime = Math.max(startTime + SKIP_BUFFER_RANGE_START, currentTime + SKIP_BUFFER_HOLE_STEP_SECONDS);
39444
- logger.warn(`skipping hole, adjusting currentTime from ${currentTime} to ${targetTime}`);
39444
+ logger$1.warn(`skipping hole, adjusting currentTime from ${currentTime} to ${targetTime}`);
39445
39445
  this.moved = true;
39446
39446
  this.stalled = null;
39447
39447
  media.currentTime = targetTime;
@@ -39482,7 +39482,7 @@ class GapController {
39482
39482
  const targetTime = currentTime + (nudgeRetry + 1) * config.nudgeOffset;
39483
39483
  // playback stalled in buffered area ... let's nudge currentTime to try to overcome this
39484
39484
  const error = new Error(`Nudging 'currentTime' from ${currentTime} to ${targetTime}`);
39485
- logger.warn(error.message);
39485
+ logger$1.warn(error.message);
39486
39486
  media.currentTime = targetTime;
39487
39487
  hls.trigger(Events.ERROR, {
39488
39488
  type: ErrorTypes.MEDIA_ERROR,
@@ -39492,7 +39492,7 @@ class GapController {
39492
39492
  });
39493
39493
  } else {
39494
39494
  const error = new Error(`Playhead still not moving while enough data buffered @${currentTime} after ${config.nudgeMaxRetry} nudges`);
39495
- logger.error(error.message);
39495
+ logger$1.error(error.message);
39496
39496
  hls.trigger(Events.ERROR, {
39497
39497
  type: ErrorTypes.MEDIA_ERROR,
39498
39498
  details: ErrorDetails.BUFFER_STALLED_ERROR,
@@ -40847,7 +40847,7 @@ class Hls {
40847
40847
  try {
40848
40848
  return this.emit(event, event, eventObject);
40849
40849
  } catch (error) {
40850
- logger.error('An internal error happened while handling event ' + event + '. Error message: "' + error.message + '". Here is a stacktrace:', error);
40850
+ logger$1.error('An internal error happened while handling event ' + event + '. Error message: "' + error.message + '". Here is a stacktrace:', error);
40851
40851
  // Prevent recursion in error event handlers that throw #5497
40852
40852
  if (!this.triggeringException) {
40853
40853
  this.triggeringException = true;
@@ -40873,7 +40873,7 @@ class Hls {
40873
40873
  * Dispose of the instance
40874
40874
  */
40875
40875
  destroy() {
40876
- logger.log('destroy');
40876
+ logger$1.log('destroy');
40877
40877
  this.trigger(Events.DESTROYING, undefined);
40878
40878
  this.detachMedia();
40879
40879
  this.removeAllListeners();
@@ -40894,7 +40894,7 @@ class Hls {
40894
40894
  * Attaches Hls.js to a media element
40895
40895
  */
40896
40896
  attachMedia(media) {
40897
- logger.log('attachMedia');
40897
+ logger$1.log('attachMedia');
40898
40898
  this._media = media;
40899
40899
  this.trigger(Events.MEDIA_ATTACHING, {
40900
40900
  media: media
@@ -40905,7 +40905,7 @@ class Hls {
40905
40905
  * Detach Hls.js from the media
40906
40906
  */
40907
40907
  detachMedia() {
40908
- logger.log('detachMedia');
40908
+ logger$1.log('detachMedia');
40909
40909
  this.trigger(Events.MEDIA_DETACHING, undefined);
40910
40910
  this._media = null;
40911
40911
  }
@@ -40922,7 +40922,7 @@ class Hls {
40922
40922
  });
40923
40923
  this._autoLevelCapping = -1;
40924
40924
  this._maxHdcpLevel = null;
40925
- logger.log(`loadSource:${loadingSource}`);
40925
+ logger$1.log(`loadSource:${loadingSource}`);
40926
40926
  if (media && loadedSource && (loadedSource !== loadingSource || this.bufferController.hasSourceTypes())) {
40927
40927
  this.detachMedia();
40928
40928
  this.attachMedia(media);
@@ -40941,7 +40941,7 @@ class Hls {
40941
40941
  * Defaults to -1 (None: starts from earliest point)
40942
40942
  */
40943
40943
  startLoad(startPosition = -1) {
40944
- logger.log(`startLoad(${startPosition})`);
40944
+ logger$1.log(`startLoad(${startPosition})`);
40945
40945
  this.started = true;
40946
40946
  this.networkControllers.forEach(controller => {
40947
40947
  controller.startLoad(startPosition);
@@ -40952,7 +40952,7 @@ class Hls {
40952
40952
  * Stop loading of any stream data.
40953
40953
  */
40954
40954
  stopLoad() {
40955
- logger.log('stopLoad');
40955
+ logger$1.log('stopLoad');
40956
40956
  this.started = false;
40957
40957
  this.networkControllers.forEach(controller => {
40958
40958
  controller.stopLoad();
@@ -40988,7 +40988,7 @@ class Hls {
40988
40988
  * Swap through possible audio codecs in the stream (for example to switch from stereo to 5.1)
40989
40989
  */
40990
40990
  swapAudioCodec() {
40991
- logger.log('swapAudioCodec');
40991
+ logger$1.log('swapAudioCodec');
40992
40992
  this.streamController.swapAudioCodec();
40993
40993
  }
40994
40994
 
@@ -40999,7 +40999,7 @@ class Hls {
40999
40999
  * Automatic recovery of media-errors by this process is configurable.
41000
41000
  */
41001
41001
  recoverMediaError() {
41002
- logger.log('recoverMediaError');
41002
+ logger$1.log('recoverMediaError');
41003
41003
  const media = this._media;
41004
41004
  this.detachMedia();
41005
41005
  if (media) {
@@ -41029,7 +41029,7 @@ class Hls {
41029
41029
  * Set quality level index immediately. This will flush the current buffer to replace the quality asap. That means playback will interrupt at least shortly to re-buffer and re-sync eventually. Set to -1 for automatic level selection.
41030
41030
  */
41031
41031
  set currentLevel(newLevel) {
41032
- logger.log(`set currentLevel:${newLevel}`);
41032
+ logger$1.log(`set currentLevel:${newLevel}`);
41033
41033
  this.levelController.manualLevel = newLevel;
41034
41034
  this.streamController.immediateLevelSwitch();
41035
41035
  }
@@ -41048,7 +41048,7 @@ class Hls {
41048
41048
  * @param newLevel - Pass -1 for automatic level selection
41049
41049
  */
41050
41050
  set nextLevel(newLevel) {
41051
- logger.log(`set nextLevel:${newLevel}`);
41051
+ logger$1.log(`set nextLevel:${newLevel}`);
41052
41052
  this.levelController.manualLevel = newLevel;
41053
41053
  this.streamController.nextLevelSwitch();
41054
41054
  }
@@ -41067,7 +41067,7 @@ class Hls {
41067
41067
  * @param newLevel - Pass -1 for automatic level selection
41068
41068
  */
41069
41069
  set loadLevel(newLevel) {
41070
- logger.log(`set loadLevel:${newLevel}`);
41070
+ logger$1.log(`set loadLevel:${newLevel}`);
41071
41071
  this.levelController.manualLevel = newLevel;
41072
41072
  }
41073
41073
 
@@ -41098,7 +41098,7 @@ class Hls {
41098
41098
  * Sets "first-level", see getter.
41099
41099
  */
41100
41100
  set firstLevel(newLevel) {
41101
- logger.log(`set firstLevel:${newLevel}`);
41101
+ logger$1.log(`set firstLevel:${newLevel}`);
41102
41102
  this.levelController.firstLevel = newLevel;
41103
41103
  }
41104
41104
 
@@ -41123,7 +41123,7 @@ class Hls {
41123
41123
  * (determined from download of first segment)
41124
41124
  */
41125
41125
  set startLevel(newLevel) {
41126
- logger.log(`set startLevel:${newLevel}`);
41126
+ logger$1.log(`set startLevel:${newLevel}`);
41127
41127
  // if not in automatic start level detection, ensure startLevel is greater than minAutoLevel
41128
41128
  if (newLevel !== -1) {
41129
41129
  newLevel = Math.max(newLevel, this.minAutoLevel);
@@ -41198,7 +41198,7 @@ class Hls {
41198
41198
  */
41199
41199
  set autoLevelCapping(newLevel) {
41200
41200
  if (this._autoLevelCapping !== newLevel) {
41201
- logger.log(`set autoLevelCapping:${newLevel}`);
41201
+ logger$1.log(`set autoLevelCapping:${newLevel}`);
41202
41202
  this._autoLevelCapping = newLevel;
41203
41203
  this.levelController.checkMaxAutoUpdated();
41204
41204
  }
@@ -42232,13 +42232,13 @@ const DEFAULT_OPTIONS = {
42232
42232
  * @beta
42233
42233
  */
42234
42234
  class Player {
42235
+ bitrateInfo = null;
42236
+ config;
42235
42237
  emitter = new EventLite();
42236
42238
  player = null;
42237
42239
  ready = false;
42238
42240
  tuneInTimerId = null;
42239
42241
  tunedIn = false;
42240
- config;
42241
- bitrateInfo = null;
42242
42242
  get activePlayback() {
42243
42243
  if (!this.player?.core.activePlayback) {
42244
42244
  return null;
@@ -42298,6 +42298,13 @@ class Player {
42298
42298
  this.player.destroy();
42299
42299
  this.player = null;
42300
42300
  }
42301
+ this.ready = false;
42302
+ this.tunedIn = false;
42303
+ if (this.tuneInTimerId) {
42304
+ clearTimeout(this.tuneInTimerId);
42305
+ this.tuneInTimerId = null;
42306
+ }
42307
+ this.bitrateInfo = null;
42301
42308
  }
42302
42309
  pause() {
42303
42310
  assert.ok(this.player, 'Player not initialized');
@@ -42460,7 +42467,6 @@ class Player {
42460
42467
  configurePlaybacks() {
42461
42468
  Loader.registerPlayback(DashPlayback);
42462
42469
  Loader.registerPlayback(HlsPlayback);
42463
- // Loader.registerPlayback(HTML5Video); // registered by default
42464
42470
  }
42465
42471
  bindBitrateChangeHandler() {
42466
42472
  this.player?.core.activeContainer.on(Events$1.CONTAINER_BITRATE, (bitrate) => {
@@ -42607,30 +42613,1332 @@ class LogTracer {
42607
42613
  }
42608
42614
  }
42609
42615
 
42616
+ // This is a magic string replaced by rollup
42617
+
42618
+ const SDK_VERSION = "8.47.0" ;
42619
+
42620
+ /** Get's the global object for the current JavaScript runtime */
42621
+ const GLOBAL_OBJ = globalThis ;
42622
+
42610
42623
  /**
42611
- * @beta
42624
+ * Returns a global singleton contained in the global `__SENTRY__[]` object.
42625
+ *
42626
+ * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory
42627
+ * function and added to the `__SENTRY__` object.
42628
+ *
42629
+ * @param name name of the global singleton on __SENTRY__
42630
+ * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`
42631
+ * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value
42632
+ * @returns the singleton
42612
42633
  */
42613
- class SentryTracer {
42614
- client;
42615
- constructor(client) {
42616
- this.client = client;
42634
+ function getGlobalSingleton(name, creator, obj) {
42635
+ const gbl = (GLOBAL_OBJ) ;
42636
+ const __SENTRY__ = (gbl.__SENTRY__ = gbl.__SENTRY__ || {});
42637
+ const versionedCarrier = (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});
42638
+ return versionedCarrier[name] || (versionedCarrier[name] = creator());
42639
+ }
42640
+
42641
+ /**
42642
+ * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
42643
+ *
42644
+ * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
42645
+ */
42646
+ const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
42647
+
42648
+ /** Prefix for logging strings */
42649
+ const PREFIX = 'Sentry Logger ';
42650
+
42651
+ const CONSOLE_LEVELS = [
42652
+ 'debug',
42653
+ 'info',
42654
+ 'warn',
42655
+ 'error',
42656
+ 'log',
42657
+ 'assert',
42658
+ 'trace',
42659
+ ] ;
42660
+
42661
+ /** This may be mutated by the console instrumentation. */
42662
+ const originalConsoleMethods
42663
+
42664
+ = {};
42665
+
42666
+ /** JSDoc */
42667
+
42668
+ /**
42669
+ * Temporarily disable sentry console instrumentations.
42670
+ *
42671
+ * @param callback The function to run against the original `console` messages
42672
+ * @returns The results of the callback
42673
+ */
42674
+ function consoleSandbox(callback) {
42675
+ if (!('console' in GLOBAL_OBJ)) {
42676
+ return callback();
42677
+ }
42678
+
42679
+ const console = GLOBAL_OBJ.console ;
42680
+ const wrappedFuncs = {};
42681
+
42682
+ const wrappedLevels = Object.keys(originalConsoleMethods) ;
42683
+
42684
+ // Restore all wrapped console methods
42685
+ wrappedLevels.forEach(level => {
42686
+ const originalConsoleMethod = originalConsoleMethods[level] ;
42687
+ wrappedFuncs[level] = console[level] ;
42688
+ console[level] = originalConsoleMethod;
42689
+ });
42690
+
42691
+ try {
42692
+ return callback();
42693
+ } finally {
42694
+ // Revert restoration to wrapped state
42695
+ wrappedLevels.forEach(level => {
42696
+ console[level] = wrappedFuncs[level] ;
42697
+ });
42698
+ }
42699
+ }
42700
+
42701
+ function makeLogger() {
42702
+ let enabled = false;
42703
+ const logger = {
42704
+ enable: () => {
42705
+ enabled = true;
42706
+ },
42707
+ disable: () => {
42708
+ enabled = false;
42709
+ },
42710
+ isEnabled: () => enabled,
42711
+ };
42712
+
42713
+ if (DEBUG_BUILD) {
42714
+ CONSOLE_LEVELS.forEach(name => {
42715
+ logger[name] = (...args) => {
42716
+ if (enabled) {
42717
+ consoleSandbox(() => {
42718
+ GLOBAL_OBJ.console[name](`${PREFIX}[${name}]:`, ...args);
42719
+ });
42720
+ }
42721
+ };
42722
+ });
42723
+ } else {
42724
+ CONSOLE_LEVELS.forEach(name => {
42725
+ logger[name] = () => undefined;
42726
+ });
42727
+ }
42728
+
42729
+ return logger ;
42730
+ }
42731
+
42732
+ /**
42733
+ * This is a logger singleton which either logs things or no-ops if logging is not enabled.
42734
+ * The logger is a singleton on the carrier, to ensure that a consistent logger is used throughout the SDK.
42735
+ */
42736
+ const logger = getGlobalSingleton('logger', makeLogger);
42737
+
42738
+ /**
42739
+ * An object that contains globally accessible properties and maintains a scope stack.
42740
+ * @hidden
42741
+ */
42742
+
42743
+ /**
42744
+ * Returns the global shim registry.
42745
+ *
42746
+ * FIXME: This function is problematic, because despite always returning a valid Carrier,
42747
+ * it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check
42748
+ * at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there.
42749
+ **/
42750
+ function getMainCarrier() {
42751
+ // This ensures a Sentry carrier exists
42752
+ getSentryCarrier(GLOBAL_OBJ);
42753
+ return GLOBAL_OBJ;
42754
+ }
42755
+
42756
+ /** Will either get the existing sentry carrier, or create a new one. */
42757
+ function getSentryCarrier(carrier) {
42758
+ const __SENTRY__ = (carrier.__SENTRY__ = carrier.__SENTRY__ || {});
42759
+
42760
+ // For now: First SDK that sets the .version property wins
42761
+ __SENTRY__.version = __SENTRY__.version || SDK_VERSION;
42762
+
42763
+ // Intentionally populating and returning the version of "this" SDK instance
42764
+ // rather than what's set in .version so that "this" SDK always gets its carrier
42765
+ return (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});
42766
+ }
42767
+
42768
+ // eslint-disable-next-line @typescript-eslint/unbound-method
42769
+ const objectToString = Object.prototype.toString;
42770
+ /**
42771
+ * Checks whether given value is an instance of the given built-in class.
42772
+ *
42773
+ * @param wat The value to be checked
42774
+ * @param className
42775
+ * @returns A boolean representing the result.
42776
+ */
42777
+ function isBuiltin(wat, className) {
42778
+ return objectToString.call(wat) === `[object ${className}]`;
42779
+ }
42780
+
42781
+ /**
42782
+ * Checks whether given value's type is an object literal, or a class instance.
42783
+ * {@link isPlainObject}.
42784
+ *
42785
+ * @param wat A value to be checked.
42786
+ * @returns A boolean representing the result.
42787
+ */
42788
+ function isPlainObject(wat) {
42789
+ return isBuiltin(wat, 'Object');
42790
+ }
42791
+
42792
+ /**
42793
+ * Checks whether given value has a then function.
42794
+ * @param wat A value to be checked.
42795
+ */
42796
+ function isThenable(wat) {
42797
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
42798
+ return Boolean(wat && wat.then && typeof wat.then === 'function');
42799
+ }
42800
+
42801
+ /**
42802
+ * Defines a non-enumerable property on the given object.
42803
+ *
42804
+ * @param obj The object on which to set the property
42805
+ * @param name The name of the property to be set
42806
+ * @param value The value to which to set the property
42807
+ */
42808
+ function addNonEnumerableProperty(obj, name, value) {
42809
+ try {
42810
+ Object.defineProperty(obj, name, {
42811
+ // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it
42812
+ value: value,
42813
+ writable: true,
42814
+ configurable: true,
42815
+ });
42816
+ } catch (o_O) {
42817
+ DEBUG_BUILD && logger.log(`Failed to add non-enumerable property "${name}" to object`, obj);
42818
+ }
42819
+ }
42820
+
42821
+ const ONE_SECOND_IN_MS = 1000;
42822
+
42823
+ /**
42824
+ * A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}
42825
+ * for accessing a high-resolution monotonic clock.
42826
+ */
42827
+
42828
+ /**
42829
+ * Returns a timestamp in seconds since the UNIX epoch using the Date API.
42830
+ *
42831
+ * TODO(v8): Return type should be rounded.
42832
+ */
42833
+ function dateTimestampInSeconds() {
42834
+ return Date.now() / ONE_SECOND_IN_MS;
42835
+ }
42836
+
42837
+ /**
42838
+ * Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not
42839
+ * support the API.
42840
+ *
42841
+ * Wrapping the native API works around differences in behavior from different browsers.
42842
+ */
42843
+ function createUnixTimestampInSecondsFunc() {
42844
+ const { performance } = GLOBAL_OBJ ;
42845
+ if (!performance || !performance.now) {
42846
+ return dateTimestampInSeconds;
42847
+ }
42848
+
42849
+ // Some browser and environments don't have a timeOrigin, so we fallback to
42850
+ // using Date.now() to compute the starting time.
42851
+ const approxStartingTimeOrigin = Date.now() - performance.now();
42852
+ const timeOrigin = performance.timeOrigin == undefined ? approxStartingTimeOrigin : performance.timeOrigin;
42853
+
42854
+ // performance.now() is a monotonic clock, which means it starts at 0 when the process begins. To get the current
42855
+ // wall clock time (actual UNIX timestamp), we need to add the starting time origin and the current time elapsed.
42856
+ //
42857
+ // TODO: This does not account for the case where the monotonic clock that powers performance.now() drifts from the
42858
+ // wall clock time, which causes the returned timestamp to be inaccurate. We should investigate how to detect and
42859
+ // correct for this.
42860
+ // See: https://github.com/getsentry/sentry-javascript/issues/2590
42861
+ // See: https://github.com/mdn/content/issues/4713
42862
+ // See: https://dev.to/noamr/when-a-millisecond-is-not-a-millisecond-3h6
42863
+ return () => {
42864
+ return (timeOrigin + performance.now()) / ONE_SECOND_IN_MS;
42865
+ };
42866
+ }
42867
+
42868
+ /**
42869
+ * Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the
42870
+ * availability of the Performance API.
42871
+ *
42872
+ * BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is
42873
+ * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The
42874
+ * skew can grow to arbitrary amounts like days, weeks or months.
42875
+ * See https://github.com/getsentry/sentry-javascript/issues/2590.
42876
+ */
42877
+ const timestampInSeconds = createUnixTimestampInSecondsFunc();
42878
+
42879
+ /**
42880
+ * The number of milliseconds since the UNIX epoch. This value is only usable in a browser, and only when the
42881
+ * performance API is available.
42882
+ */
42883
+ (() => {
42884
+ // Unfortunately browsers may report an inaccurate time origin data, through either performance.timeOrigin or
42885
+ // performance.timing.navigationStart, which results in poor results in performance data. We only treat time origin
42886
+ // data as reliable if they are within a reasonable threshold of the current time.
42887
+
42888
+ const { performance } = GLOBAL_OBJ ;
42889
+ if (!performance || !performance.now) {
42890
+ return undefined;
42891
+ }
42892
+
42893
+ const threshold = 3600 * 1000;
42894
+ const performanceNow = performance.now();
42895
+ const dateNow = Date.now();
42896
+
42897
+ // if timeOrigin isn't available set delta to threshold so it isn't used
42898
+ const timeOriginDelta = performance.timeOrigin
42899
+ ? Math.abs(performance.timeOrigin + performanceNow - dateNow)
42900
+ : threshold;
42901
+ const timeOriginIsReliable = timeOriginDelta < threshold;
42902
+
42903
+ // While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin
42904
+ // is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing.
42905
+ // Also as of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always
42906
+ // a valid fallback. In the absence of an initial time provided by the browser, fallback to the current time from the
42907
+ // Date API.
42908
+ // eslint-disable-next-line deprecation/deprecation
42909
+ const navigationStart = performance.timing && performance.timing.navigationStart;
42910
+ const hasNavigationStart = typeof navigationStart === 'number';
42911
+ // if navigationStart isn't available set delta to threshold so it isn't used
42912
+ const navigationStartDelta = hasNavigationStart ? Math.abs(navigationStart + performanceNow - dateNow) : threshold;
42913
+ const navigationStartIsReliable = navigationStartDelta < threshold;
42914
+
42915
+ if (timeOriginIsReliable || navigationStartIsReliable) {
42916
+ // Use the more reliable time origin
42917
+ if (timeOriginDelta <= navigationStartDelta) {
42918
+ return performance.timeOrigin;
42919
+ } else {
42920
+ return navigationStart;
42617
42921
  }
42618
- reportError(e) {
42619
- this.client.captureException(e);
42922
+ }
42923
+ return dateNow;
42924
+ })();
42925
+
42926
+ /**
42927
+ * UUID4 generator
42928
+ *
42929
+ * @returns string Generated UUID4.
42930
+ */
42931
+ function uuid4() {
42932
+ const gbl = GLOBAL_OBJ ;
42933
+ const crypto = gbl.crypto || gbl.msCrypto;
42934
+
42935
+ let getRandomByte = () => Math.random() * 16;
42936
+ try {
42937
+ if (crypto && crypto.randomUUID) {
42938
+ return crypto.randomUUID().replace(/-/g, '');
42939
+ }
42940
+ if (crypto && crypto.getRandomValues) {
42941
+ getRandomByte = () => {
42942
+ // crypto.getRandomValues might return undefined instead of the typed array
42943
+ // in old Chromium versions (e.g. 23.0.1235.0 (151422))
42944
+ // However, `typedArray` is still filled in-place.
42945
+ // @see https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues#typedarray
42946
+ const typedArray = new Uint8Array(1);
42947
+ crypto.getRandomValues(typedArray);
42948
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
42949
+ return typedArray[0];
42950
+ };
42620
42951
  }
42621
- trace(msg, data) {
42622
- this.client.captureMessage(msg, "info", {
42623
- data,
42624
- });
42952
+ } catch (_) {
42953
+ // some runtimes can crash invoking crypto
42954
+ // https://github.com/getsentry/sentry-javascript/issues/8935
42955
+ }
42956
+
42957
+ // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
42958
+ // Concatenating the following numbers as strings results in '10000000100040008000100000000000'
42959
+ return (([1e7] ) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, c =>
42960
+ // eslint-disable-next-line no-bitwise
42961
+ ((c ) ^ ((getRandomByte() & 15) >> ((c ) / 4))).toString(16),
42962
+ );
42963
+ }
42964
+
42965
+ /**
42966
+ * Updates a session object with the properties passed in the context.
42967
+ *
42968
+ * Note that this function mutates the passed object and returns void.
42969
+ * (Had to do this instead of returning a new and updated session because closing and sending a session
42970
+ * makes an update to the session after it was passed to the sending logic.
42971
+ * @see BaseClient.captureSession )
42972
+ *
42973
+ * @param session the `Session` to update
42974
+ * @param context the `SessionContext` holding the properties that should be updated in @param session
42975
+ */
42976
+ // eslint-disable-next-line complexity
42977
+ function updateSession(session, context = {}) {
42978
+ if (context.user) {
42979
+ if (!session.ipAddress && context.user.ip_address) {
42980
+ session.ipAddress = context.user.ip_address;
42625
42981
  }
42982
+
42983
+ if (!session.did && !context.did) {
42984
+ session.did = context.user.id || context.user.email || context.user.username;
42985
+ }
42986
+ }
42987
+
42988
+ session.timestamp = context.timestamp || timestampInSeconds();
42989
+
42990
+ if (context.abnormal_mechanism) {
42991
+ session.abnormal_mechanism = context.abnormal_mechanism;
42992
+ }
42993
+
42994
+ if (context.ignoreDuration) {
42995
+ session.ignoreDuration = context.ignoreDuration;
42996
+ }
42997
+ if (context.sid) {
42998
+ // Good enough uuid validation. — Kamil
42999
+ session.sid = context.sid.length === 32 ? context.sid : uuid4();
43000
+ }
43001
+ if (context.init !== undefined) {
43002
+ session.init = context.init;
43003
+ }
43004
+ if (!session.did && context.did) {
43005
+ session.did = `${context.did}`;
43006
+ }
43007
+ if (typeof context.started === 'number') {
43008
+ session.started = context.started;
43009
+ }
43010
+ if (session.ignoreDuration) {
43011
+ session.duration = undefined;
43012
+ } else if (typeof context.duration === 'number') {
43013
+ session.duration = context.duration;
43014
+ } else {
43015
+ const duration = session.timestamp - session.started;
43016
+ session.duration = duration >= 0 ? duration : 0;
43017
+ }
43018
+ if (context.release) {
43019
+ session.release = context.release;
43020
+ }
43021
+ if (context.environment) {
43022
+ session.environment = context.environment;
43023
+ }
43024
+ if (!session.ipAddress && context.ipAddress) {
43025
+ session.ipAddress = context.ipAddress;
43026
+ }
43027
+ if (!session.userAgent && context.userAgent) {
43028
+ session.userAgent = context.userAgent;
43029
+ }
43030
+ if (typeof context.errors === 'number') {
43031
+ session.errors = context.errors;
43032
+ }
43033
+ if (context.status) {
43034
+ session.status = context.status;
43035
+ }
42626
43036
  }
42627
43037
 
42628
- var version$1 = "2.0.0";
43038
+ /**
43039
+ * Generate a random, valid trace ID.
43040
+ */
43041
+ function generateTraceId() {
43042
+ return uuid4();
43043
+ }
42629
43044
 
42630
- var packages = {
42631
- "": {
42632
- name: "@gcorevideo/player",
42633
- version: "2.0.0",
43045
+ /**
43046
+ * Generate a random, valid span ID.
43047
+ */
43048
+ function generateSpanId() {
43049
+ return uuid4().substring(16);
43050
+ }
43051
+
43052
+ /**
43053
+ * Shallow merge two objects.
43054
+ * Does not mutate the passed in objects.
43055
+ * Undefined/empty values in the merge object will overwrite existing values.
43056
+ *
43057
+ * By default, this merges 2 levels deep.
43058
+ */
43059
+ function merge(initialObj, mergeObj, levels = 2) {
43060
+ // If the merge value is not an object, or we have no merge levels left,
43061
+ // we just set the value to the merge value
43062
+ if (!mergeObj || typeof mergeObj !== 'object' || levels <= 0) {
43063
+ return mergeObj;
43064
+ }
43065
+
43066
+ // If the merge object is an empty object, and the initial object is not undefined, we return the initial object
43067
+ if (initialObj && mergeObj && Object.keys(mergeObj).length === 0) {
43068
+ return initialObj;
43069
+ }
43070
+
43071
+ // Clone object
43072
+ const output = { ...initialObj };
43073
+
43074
+ // Merge values into output, resursively
43075
+ for (const key in mergeObj) {
43076
+ if (Object.prototype.hasOwnProperty.call(mergeObj, key)) {
43077
+ output[key] = merge(output[key], mergeObj[key], levels - 1);
43078
+ }
43079
+ }
43080
+
43081
+ return output;
43082
+ }
43083
+
43084
+ const SCOPE_SPAN_FIELD = '_sentrySpan';
43085
+
43086
+ /**
43087
+ * Set the active span for a given scope.
43088
+ * NOTE: This should NOT be used directly, but is only used internally by the trace methods.
43089
+ */
43090
+ function _setSpanForScope(scope, span) {
43091
+ if (span) {
43092
+ addNonEnumerableProperty(scope , SCOPE_SPAN_FIELD, span);
43093
+ } else {
43094
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
43095
+ delete (scope )[SCOPE_SPAN_FIELD];
43096
+ }
43097
+ }
43098
+
43099
+ /**
43100
+ * Get the active span for a given scope.
43101
+ * NOTE: This should NOT be used directly, but is only used internally by the trace methods.
43102
+ */
43103
+ function _getSpanForScope(scope) {
43104
+ return scope[SCOPE_SPAN_FIELD];
43105
+ }
43106
+
43107
+ /**
43108
+ * Default value for maximum number of breadcrumbs added to an event.
43109
+ */
43110
+ const DEFAULT_MAX_BREADCRUMBS = 100;
43111
+
43112
+ /**
43113
+ * Holds additional event information.
43114
+ */
43115
+ class ScopeClass {
43116
+ /** Flag if notifying is happening. */
43117
+
43118
+ /** Callback for client to receive scope changes. */
43119
+
43120
+ /** Callback list that will be called during event processing. */
43121
+
43122
+ /** Array of breadcrumbs. */
43123
+
43124
+ /** User */
43125
+
43126
+ /** Tags */
43127
+
43128
+ /** Extra */
43129
+
43130
+ /** Contexts */
43131
+
43132
+ /** Attachments */
43133
+
43134
+ /** Propagation Context for distributed tracing */
43135
+
43136
+ /**
43137
+ * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
43138
+ * sent to Sentry
43139
+ */
43140
+
43141
+ /** Fingerprint */
43142
+
43143
+ /** Severity */
43144
+
43145
+ /**
43146
+ * Transaction Name
43147
+ *
43148
+ * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.
43149
+ * It's purpose is to assign a transaction to the scope that's added to non-transaction events.
43150
+ */
43151
+
43152
+ /** Session */
43153
+
43154
+ /** Request Mode Session Status */
43155
+ // eslint-disable-next-line deprecation/deprecation
43156
+
43157
+ /** The client on this scope */
43158
+
43159
+ /** Contains the last event id of a captured event. */
43160
+
43161
+ // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.
43162
+
43163
+ constructor() {
43164
+ this._notifyingListeners = false;
43165
+ this._scopeListeners = [];
43166
+ this._eventProcessors = [];
43167
+ this._breadcrumbs = [];
43168
+ this._attachments = [];
43169
+ this._user = {};
43170
+ this._tags = {};
43171
+ this._extra = {};
43172
+ this._contexts = {};
43173
+ this._sdkProcessingMetadata = {};
43174
+ this._propagationContext = {
43175
+ traceId: generateTraceId(),
43176
+ spanId: generateSpanId(),
43177
+ };
43178
+ }
43179
+
43180
+ /**
43181
+ * @inheritDoc
43182
+ */
43183
+ clone() {
43184
+ const newScope = new ScopeClass();
43185
+ newScope._breadcrumbs = [...this._breadcrumbs];
43186
+ newScope._tags = { ...this._tags };
43187
+ newScope._extra = { ...this._extra };
43188
+ newScope._contexts = { ...this._contexts };
43189
+ if (this._contexts.flags) {
43190
+ // We need to copy the `values` array so insertions on a cloned scope
43191
+ // won't affect the original array.
43192
+ newScope._contexts.flags = {
43193
+ values: [...this._contexts.flags.values],
43194
+ };
43195
+ }
43196
+
43197
+ newScope._user = this._user;
43198
+ newScope._level = this._level;
43199
+ newScope._session = this._session;
43200
+ newScope._transactionName = this._transactionName;
43201
+ newScope._fingerprint = this._fingerprint;
43202
+ newScope._eventProcessors = [...this._eventProcessors];
43203
+ newScope._requestSession = this._requestSession;
43204
+ newScope._attachments = [...this._attachments];
43205
+ newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata };
43206
+ newScope._propagationContext = { ...this._propagationContext };
43207
+ newScope._client = this._client;
43208
+ newScope._lastEventId = this._lastEventId;
43209
+
43210
+ _setSpanForScope(newScope, _getSpanForScope(this));
43211
+
43212
+ return newScope;
43213
+ }
43214
+
43215
+ /**
43216
+ * @inheritDoc
43217
+ */
43218
+ setClient(client) {
43219
+ this._client = client;
43220
+ }
43221
+
43222
+ /**
43223
+ * @inheritDoc
43224
+ */
43225
+ setLastEventId(lastEventId) {
43226
+ this._lastEventId = lastEventId;
43227
+ }
43228
+
43229
+ /**
43230
+ * @inheritDoc
43231
+ */
43232
+ getClient() {
43233
+ return this._client ;
43234
+ }
43235
+
43236
+ /**
43237
+ * @inheritDoc
43238
+ */
43239
+ lastEventId() {
43240
+ return this._lastEventId;
43241
+ }
43242
+
43243
+ /**
43244
+ * @inheritDoc
43245
+ */
43246
+ addScopeListener(callback) {
43247
+ this._scopeListeners.push(callback);
43248
+ }
43249
+
43250
+ /**
43251
+ * @inheritDoc
43252
+ */
43253
+ addEventProcessor(callback) {
43254
+ this._eventProcessors.push(callback);
43255
+ return this;
43256
+ }
43257
+
43258
+ /**
43259
+ * @inheritDoc
43260
+ */
43261
+ setUser(user) {
43262
+ // If null is passed we want to unset everything, but still define keys,
43263
+ // so that later down in the pipeline any existing values are cleared.
43264
+ this._user = user || {
43265
+ email: undefined,
43266
+ id: undefined,
43267
+ ip_address: undefined,
43268
+ username: undefined,
43269
+ };
43270
+
43271
+ if (this._session) {
43272
+ updateSession(this._session, { user });
43273
+ }
43274
+
43275
+ this._notifyScopeListeners();
43276
+ return this;
43277
+ }
43278
+
43279
+ /**
43280
+ * @inheritDoc
43281
+ */
43282
+ getUser() {
43283
+ return this._user;
43284
+ }
43285
+
43286
+ /**
43287
+ * @inheritDoc
43288
+ */
43289
+ // eslint-disable-next-line deprecation/deprecation
43290
+ getRequestSession() {
43291
+ return this._requestSession;
43292
+ }
43293
+
43294
+ /**
43295
+ * @inheritDoc
43296
+ */
43297
+ // eslint-disable-next-line deprecation/deprecation
43298
+ setRequestSession(requestSession) {
43299
+ this._requestSession = requestSession;
43300
+ return this;
43301
+ }
43302
+
43303
+ /**
43304
+ * @inheritDoc
43305
+ */
43306
+ setTags(tags) {
43307
+ this._tags = {
43308
+ ...this._tags,
43309
+ ...tags,
43310
+ };
43311
+ this._notifyScopeListeners();
43312
+ return this;
43313
+ }
43314
+
43315
+ /**
43316
+ * @inheritDoc
43317
+ */
43318
+ setTag(key, value) {
43319
+ this._tags = { ...this._tags, [key]: value };
43320
+ this._notifyScopeListeners();
43321
+ return this;
43322
+ }
43323
+
43324
+ /**
43325
+ * @inheritDoc
43326
+ */
43327
+ setExtras(extras) {
43328
+ this._extra = {
43329
+ ...this._extra,
43330
+ ...extras,
43331
+ };
43332
+ this._notifyScopeListeners();
43333
+ return this;
43334
+ }
43335
+
43336
+ /**
43337
+ * @inheritDoc
43338
+ */
43339
+ setExtra(key, extra) {
43340
+ this._extra = { ...this._extra, [key]: extra };
43341
+ this._notifyScopeListeners();
43342
+ return this;
43343
+ }
43344
+
43345
+ /**
43346
+ * @inheritDoc
43347
+ */
43348
+ setFingerprint(fingerprint) {
43349
+ this._fingerprint = fingerprint;
43350
+ this._notifyScopeListeners();
43351
+ return this;
43352
+ }
43353
+
43354
+ /**
43355
+ * @inheritDoc
43356
+ */
43357
+ setLevel(level) {
43358
+ this._level = level;
43359
+ this._notifyScopeListeners();
43360
+ return this;
43361
+ }
43362
+
43363
+ /**
43364
+ * @inheritDoc
43365
+ */
43366
+ setTransactionName(name) {
43367
+ this._transactionName = name;
43368
+ this._notifyScopeListeners();
43369
+ return this;
43370
+ }
43371
+
43372
+ /**
43373
+ * @inheritDoc
43374
+ */
43375
+ setContext(key, context) {
43376
+ if (context === null) {
43377
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
43378
+ delete this._contexts[key];
43379
+ } else {
43380
+ this._contexts[key] = context;
43381
+ }
43382
+
43383
+ this._notifyScopeListeners();
43384
+ return this;
43385
+ }
43386
+
43387
+ /**
43388
+ * @inheritDoc
43389
+ */
43390
+ setSession(session) {
43391
+ if (!session) {
43392
+ delete this._session;
43393
+ } else {
43394
+ this._session = session;
43395
+ }
43396
+ this._notifyScopeListeners();
43397
+ return this;
43398
+ }
43399
+
43400
+ /**
43401
+ * @inheritDoc
43402
+ */
43403
+ getSession() {
43404
+ return this._session;
43405
+ }
43406
+
43407
+ /**
43408
+ * @inheritDoc
43409
+ */
43410
+ update(captureContext) {
43411
+ if (!captureContext) {
43412
+ return this;
43413
+ }
43414
+
43415
+ const scopeToMerge = typeof captureContext === 'function' ? captureContext(this) : captureContext;
43416
+
43417
+ const [scopeInstance, requestSession] =
43418
+ scopeToMerge instanceof Scope
43419
+ ? // eslint-disable-next-line deprecation/deprecation
43420
+ [scopeToMerge.getScopeData(), scopeToMerge.getRequestSession()]
43421
+ : isPlainObject(scopeToMerge)
43422
+ ? [captureContext , (captureContext ).requestSession]
43423
+ : [];
43424
+
43425
+ const { tags, extra, user, contexts, level, fingerprint = [], propagationContext } = scopeInstance || {};
43426
+
43427
+ this._tags = { ...this._tags, ...tags };
43428
+ this._extra = { ...this._extra, ...extra };
43429
+ this._contexts = { ...this._contexts, ...contexts };
43430
+
43431
+ if (user && Object.keys(user).length) {
43432
+ this._user = user;
43433
+ }
43434
+
43435
+ if (level) {
43436
+ this._level = level;
43437
+ }
43438
+
43439
+ if (fingerprint.length) {
43440
+ this._fingerprint = fingerprint;
43441
+ }
43442
+
43443
+ if (propagationContext) {
43444
+ this._propagationContext = propagationContext;
43445
+ }
43446
+
43447
+ if (requestSession) {
43448
+ this._requestSession = requestSession;
43449
+ }
43450
+
43451
+ return this;
43452
+ }
43453
+
43454
+ /**
43455
+ * @inheritDoc
43456
+ */
43457
+ clear() {
43458
+ // client is not cleared here on purpose!
43459
+ this._breadcrumbs = [];
43460
+ this._tags = {};
43461
+ this._extra = {};
43462
+ this._user = {};
43463
+ this._contexts = {};
43464
+ this._level = undefined;
43465
+ this._transactionName = undefined;
43466
+ this._fingerprint = undefined;
43467
+ this._requestSession = undefined;
43468
+ this._session = undefined;
43469
+ _setSpanForScope(this, undefined);
43470
+ this._attachments = [];
43471
+ this.setPropagationContext({ traceId: generateTraceId() });
43472
+
43473
+ this._notifyScopeListeners();
43474
+ return this;
43475
+ }
43476
+
43477
+ /**
43478
+ * @inheritDoc
43479
+ */
43480
+ addBreadcrumb(breadcrumb, maxBreadcrumbs) {
43481
+ const maxCrumbs = typeof maxBreadcrumbs === 'number' ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS;
43482
+
43483
+ // No data has been changed, so don't notify scope listeners
43484
+ if (maxCrumbs <= 0) {
43485
+ return this;
43486
+ }
43487
+
43488
+ const mergedBreadcrumb = {
43489
+ timestamp: dateTimestampInSeconds(),
43490
+ ...breadcrumb,
43491
+ };
43492
+
43493
+ const breadcrumbs = this._breadcrumbs;
43494
+ breadcrumbs.push(mergedBreadcrumb);
43495
+ this._breadcrumbs = breadcrumbs.length > maxCrumbs ? breadcrumbs.slice(-maxCrumbs) : breadcrumbs;
43496
+
43497
+ this._notifyScopeListeners();
43498
+
43499
+ return this;
43500
+ }
43501
+
43502
+ /**
43503
+ * @inheritDoc
43504
+ */
43505
+ getLastBreadcrumb() {
43506
+ return this._breadcrumbs[this._breadcrumbs.length - 1];
43507
+ }
43508
+
43509
+ /**
43510
+ * @inheritDoc
43511
+ */
43512
+ clearBreadcrumbs() {
43513
+ this._breadcrumbs = [];
43514
+ this._notifyScopeListeners();
43515
+ return this;
43516
+ }
43517
+
43518
+ /**
43519
+ * @inheritDoc
43520
+ */
43521
+ addAttachment(attachment) {
43522
+ this._attachments.push(attachment);
43523
+ return this;
43524
+ }
43525
+
43526
+ /**
43527
+ * @inheritDoc
43528
+ */
43529
+ clearAttachments() {
43530
+ this._attachments = [];
43531
+ return this;
43532
+ }
43533
+
43534
+ /** @inheritDoc */
43535
+ getScopeData() {
43536
+ return {
43537
+ breadcrumbs: this._breadcrumbs,
43538
+ attachments: this._attachments,
43539
+ contexts: this._contexts,
43540
+ tags: this._tags,
43541
+ extra: this._extra,
43542
+ user: this._user,
43543
+ level: this._level,
43544
+ fingerprint: this._fingerprint || [],
43545
+ eventProcessors: this._eventProcessors,
43546
+ propagationContext: this._propagationContext,
43547
+ sdkProcessingMetadata: this._sdkProcessingMetadata,
43548
+ transactionName: this._transactionName,
43549
+ span: _getSpanForScope(this),
43550
+ };
43551
+ }
43552
+
43553
+ /**
43554
+ * @inheritDoc
43555
+ */
43556
+ setSDKProcessingMetadata(newData) {
43557
+ this._sdkProcessingMetadata = merge(this._sdkProcessingMetadata, newData, 2);
43558
+ return this;
43559
+ }
43560
+
43561
+ /**
43562
+ * @inheritDoc
43563
+ */
43564
+ setPropagationContext(
43565
+ context,
43566
+ ) {
43567
+ this._propagationContext = {
43568
+ // eslint-disable-next-line deprecation/deprecation
43569
+ spanId: generateSpanId(),
43570
+ ...context,
43571
+ };
43572
+ return this;
43573
+ }
43574
+
43575
+ /**
43576
+ * @inheritDoc
43577
+ */
43578
+ getPropagationContext() {
43579
+ return this._propagationContext;
43580
+ }
43581
+
43582
+ /**
43583
+ * @inheritDoc
43584
+ */
43585
+ captureException(exception, hint) {
43586
+ const eventId = hint && hint.event_id ? hint.event_id : uuid4();
43587
+
43588
+ if (!this._client) {
43589
+ logger.warn('No client configured on scope - will not capture exception!');
43590
+ return eventId;
43591
+ }
43592
+
43593
+ const syntheticException = new Error('Sentry syntheticException');
43594
+
43595
+ this._client.captureException(
43596
+ exception,
43597
+ {
43598
+ originalException: exception,
43599
+ syntheticException,
43600
+ ...hint,
43601
+ event_id: eventId,
43602
+ },
43603
+ this,
43604
+ );
43605
+
43606
+ return eventId;
43607
+ }
43608
+
43609
+ /**
43610
+ * @inheritDoc
43611
+ */
43612
+ captureMessage(message, level, hint) {
43613
+ const eventId = hint && hint.event_id ? hint.event_id : uuid4();
43614
+
43615
+ if (!this._client) {
43616
+ logger.warn('No client configured on scope - will not capture message!');
43617
+ return eventId;
43618
+ }
43619
+
43620
+ const syntheticException = new Error(message);
43621
+
43622
+ this._client.captureMessage(
43623
+ message,
43624
+ level,
43625
+ {
43626
+ originalException: message,
43627
+ syntheticException,
43628
+ ...hint,
43629
+ event_id: eventId,
43630
+ },
43631
+ this,
43632
+ );
43633
+
43634
+ return eventId;
43635
+ }
43636
+
43637
+ /**
43638
+ * @inheritDoc
43639
+ */
43640
+ captureEvent(event, hint) {
43641
+ const eventId = hint && hint.event_id ? hint.event_id : uuid4();
43642
+
43643
+ if (!this._client) {
43644
+ logger.warn('No client configured on scope - will not capture event!');
43645
+ return eventId;
43646
+ }
43647
+
43648
+ this._client.captureEvent(event, { ...hint, event_id: eventId }, this);
43649
+
43650
+ return eventId;
43651
+ }
43652
+
43653
+ /**
43654
+ * This will be called on every set call.
43655
+ */
43656
+ _notifyScopeListeners() {
43657
+ // We need this check for this._notifyingListeners to be able to work on scope during updates
43658
+ // If this check is not here we'll produce endless recursion when something is done with the scope
43659
+ // during the callback.
43660
+ if (!this._notifyingListeners) {
43661
+ this._notifyingListeners = true;
43662
+ this._scopeListeners.forEach(callback => {
43663
+ callback(this);
43664
+ });
43665
+ this._notifyingListeners = false;
43666
+ }
43667
+ }
43668
+ }
43669
+
43670
+ /**
43671
+ * Holds additional event information.
43672
+ */
43673
+ const Scope = ScopeClass;
43674
+
43675
+ /** Get the default current scope. */
43676
+ function getDefaultCurrentScope() {
43677
+ return getGlobalSingleton('defaultCurrentScope', () => new Scope());
43678
+ }
43679
+
43680
+ /** Get the default isolation scope. */
43681
+ function getDefaultIsolationScope() {
43682
+ return getGlobalSingleton('defaultIsolationScope', () => new Scope());
43683
+ }
43684
+
43685
+ /**
43686
+ * This is an object that holds a stack of scopes.
43687
+ */
43688
+ class AsyncContextStack {
43689
+
43690
+ constructor(scope, isolationScope) {
43691
+ let assignedScope;
43692
+ if (!scope) {
43693
+ assignedScope = new Scope();
43694
+ } else {
43695
+ assignedScope = scope;
43696
+ }
43697
+
43698
+ let assignedIsolationScope;
43699
+ if (!isolationScope) {
43700
+ assignedIsolationScope = new Scope();
43701
+ } else {
43702
+ assignedIsolationScope = isolationScope;
43703
+ }
43704
+
43705
+ // scope stack for domains or the process
43706
+ this._stack = [{ scope: assignedScope }];
43707
+ this._isolationScope = assignedIsolationScope;
43708
+ }
43709
+
43710
+ /**
43711
+ * Fork a scope for the stack.
43712
+ */
43713
+ withScope(callback) {
43714
+ const scope = this._pushScope();
43715
+
43716
+ let maybePromiseResult;
43717
+ try {
43718
+ maybePromiseResult = callback(scope);
43719
+ } catch (e) {
43720
+ this._popScope();
43721
+ throw e;
43722
+ }
43723
+
43724
+ if (isThenable(maybePromiseResult)) {
43725
+ // @ts-expect-error - isThenable returns the wrong type
43726
+ return maybePromiseResult.then(
43727
+ res => {
43728
+ this._popScope();
43729
+ return res;
43730
+ },
43731
+ e => {
43732
+ this._popScope();
43733
+ throw e;
43734
+ },
43735
+ );
43736
+ }
43737
+
43738
+ this._popScope();
43739
+ return maybePromiseResult;
43740
+ }
43741
+
43742
+ /**
43743
+ * Get the client of the stack.
43744
+ */
43745
+ getClient() {
43746
+ return this.getStackTop().client ;
43747
+ }
43748
+
43749
+ /**
43750
+ * Returns the scope of the top stack.
43751
+ */
43752
+ getScope() {
43753
+ return this.getStackTop().scope;
43754
+ }
43755
+
43756
+ /**
43757
+ * Get the isolation scope for the stack.
43758
+ */
43759
+ getIsolationScope() {
43760
+ return this._isolationScope;
43761
+ }
43762
+
43763
+ /**
43764
+ * Returns the topmost scope layer in the order domain > local > process.
43765
+ */
43766
+ getStackTop() {
43767
+ return this._stack[this._stack.length - 1] ;
43768
+ }
43769
+
43770
+ /**
43771
+ * Push a scope to the stack.
43772
+ */
43773
+ _pushScope() {
43774
+ // We want to clone the content of prev scope
43775
+ const scope = this.getScope().clone();
43776
+ this._stack.push({
43777
+ client: this.getClient(),
43778
+ scope,
43779
+ });
43780
+ return scope;
43781
+ }
43782
+
43783
+ /**
43784
+ * Pop a scope from the stack.
43785
+ */
43786
+ _popScope() {
43787
+ if (this._stack.length <= 1) return false;
43788
+ return !!this._stack.pop();
43789
+ }
43790
+ }
43791
+
43792
+ /**
43793
+ * Get the global async context stack.
43794
+ * This will be removed during the v8 cycle and is only here to make migration easier.
43795
+ */
43796
+ function getAsyncContextStack() {
43797
+ const registry = getMainCarrier();
43798
+ const sentry = getSentryCarrier(registry);
43799
+
43800
+ return (sentry.stack = sentry.stack || new AsyncContextStack(getDefaultCurrentScope(), getDefaultIsolationScope()));
43801
+ }
43802
+
43803
+ function withScope(callback) {
43804
+ return getAsyncContextStack().withScope(callback);
43805
+ }
43806
+
43807
+ function withSetScope(scope, callback) {
43808
+ const stack = getAsyncContextStack() ;
43809
+ return stack.withScope(() => {
43810
+ stack.getStackTop().scope = scope;
43811
+ return callback(scope);
43812
+ });
43813
+ }
43814
+
43815
+ function withIsolationScope(callback) {
43816
+ return getAsyncContextStack().withScope(() => {
43817
+ return callback(getAsyncContextStack().getIsolationScope());
43818
+ });
43819
+ }
43820
+
43821
+ /**
43822
+ * Get the stack-based async context strategy.
43823
+ */
43824
+ function getStackAsyncContextStrategy() {
43825
+ return {
43826
+ withIsolationScope,
43827
+ withScope,
43828
+ withSetScope,
43829
+ withSetIsolationScope: (_isolationScope, callback) => {
43830
+ return withIsolationScope(callback);
43831
+ },
43832
+ getCurrentScope: () => getAsyncContextStack().getScope(),
43833
+ getIsolationScope: () => getAsyncContextStack().getIsolationScope(),
43834
+ };
43835
+ }
43836
+
43837
+ /**
43838
+ * Get the current async context strategy.
43839
+ * If none has been setup, the default will be used.
43840
+ */
43841
+ function getAsyncContextStrategy(carrier) {
43842
+ const sentry = getSentryCarrier(carrier);
43843
+
43844
+ if (sentry.acs) {
43845
+ return sentry.acs;
43846
+ }
43847
+
43848
+ // Otherwise, use the default one (stack)
43849
+ return getStackAsyncContextStrategy();
43850
+ }
43851
+
43852
+ /**
43853
+ * Get the currently active scope.
43854
+ */
43855
+ function getCurrentScope() {
43856
+ const carrier = getMainCarrier();
43857
+ const acs = getAsyncContextStrategy(carrier);
43858
+ return acs.getCurrentScope();
43859
+ }
43860
+
43861
+ /**
43862
+ * Get the currently active isolation scope.
43863
+ * The isolation scope is active for the current execution context.
43864
+ */
43865
+ function getIsolationScope() {
43866
+ const carrier = getMainCarrier();
43867
+ const acs = getAsyncContextStrategy(carrier);
43868
+ return acs.getIsolationScope();
43869
+ }
43870
+
43871
+ /**
43872
+ * Get the currently active client.
43873
+ */
43874
+ function getClient() {
43875
+ return getCurrentScope().getClient();
43876
+ }
43877
+
43878
+ /**
43879
+ * Default maximum number of breadcrumbs added to an event. Can be overwritten
43880
+ * with {@link Options.maxBreadcrumbs}.
43881
+ */
43882
+ const DEFAULT_BREADCRUMBS = 100;
43883
+
43884
+ /**
43885
+ * Records a new breadcrumb which will be attached to future events.
43886
+ *
43887
+ * Breadcrumbs will be added to subsequent events to provide more context on
43888
+ * user's actions prior to an error or crash.
43889
+ */
43890
+ function addBreadcrumb(breadcrumb, hint) {
43891
+ const client = getClient();
43892
+ const isolationScope = getIsolationScope();
43893
+
43894
+ if (!client) return;
43895
+
43896
+ const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions();
43897
+
43898
+ if (maxBreadcrumbs <= 0) return;
43899
+
43900
+ const timestamp = dateTimestampInSeconds();
43901
+ const mergedBreadcrumb = { timestamp, ...breadcrumb };
43902
+ const finalBreadcrumb = beforeBreadcrumb
43903
+ ? (consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) )
43904
+ : mergedBreadcrumb;
43905
+
43906
+ if (finalBreadcrumb === null) return;
43907
+
43908
+ if (client.emit) {
43909
+ client.emit('beforeAddBreadcrumb', finalBreadcrumb, hint);
43910
+ }
43911
+
43912
+ isolationScope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);
43913
+ }
43914
+
43915
+ /**
43916
+ * @beta
43917
+ */
43918
+ class SentryTracer {
43919
+ client;
43920
+ constructor(client) {
43921
+ this.client = client;
43922
+ }
43923
+ reportError(e) {
43924
+ this.client.captureException(e);
43925
+ }
43926
+ trace(message, data) {
43927
+ addBreadcrumb({
43928
+ type: "default",
43929
+ level: "info",
43930
+ message,
43931
+ data,
43932
+ });
43933
+ }
43934
+ }
43935
+
43936
+ var version$1 = "2.0.2";
43937
+
43938
+ var packages = {
43939
+ "": {
43940
+ name: "@gcorevideo/player",
43941
+ version: "2.0.2",
42634
43942
  license: "Apache-2.0",
42635
43943
  dependencies: {
42636
43944
  "@clappr/core": "^0.11.3",