hls.js 1.6.0-beta.1.0.canary.10823 → 1.6.0-beta.1.0.canary.10826
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/hls.js +37 -31
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +2 -2
- package/dist/hls.light.js.map +1 -1
- package/dist/hls.light.min.js +1 -1
- package/dist/hls.light.min.js.map +1 -1
- package/dist/hls.light.mjs +2 -2
- package/dist/hls.light.mjs.map +1 -1
- package/dist/hls.min.js +1 -1
- package/dist/hls.min.js.map +1 -1
- package/dist/hls.mjs +21 -19
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +2 -2
- package/src/controller/buffer-controller.ts +1 -1
- package/src/controller/interstitials-controller.ts +12 -5
- package/src/controller/interstitials-schedule.ts +17 -14
- package/src/loader/interstitial-event.ts +1 -1
package/dist/hls.mjs
CHANGED
@@ -401,7 +401,7 @@ function enableLogs(debugConfig, context, id) {
|
|
401
401
|
// Some browsers don't allow to use bind on console object anyway
|
402
402
|
// fallback to default if needed
|
403
403
|
try {
|
404
|
-
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.
|
404
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.10826"}`);
|
405
405
|
} catch (e) {
|
406
406
|
/* log fn threw an exception. All logger methods are no-ops. */
|
407
407
|
return createLogger();
|
@@ -9836,7 +9836,7 @@ var eventemitter3 = {exports: {}};
|
|
9836
9836
|
var eventemitter3Exports = eventemitter3.exports;
|
9837
9837
|
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
9838
9838
|
|
9839
|
-
const version = "1.6.0-beta.1.0.canary.
|
9839
|
+
const version = "1.6.0-beta.1.0.canary.10826";
|
9840
9840
|
|
9841
9841
|
// ensure the worker ends up in the bundle
|
9842
9842
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -22644,8 +22644,7 @@ function hash(text) {
|
|
22644
22644
|
return (hash >>> 0).toString();
|
22645
22645
|
}
|
22646
22646
|
|
22647
|
-
const ALIGNED_END_THRESHOLD_SECONDS = 0.02;
|
22648
|
-
|
22647
|
+
const ALIGNED_END_THRESHOLD_SECONDS = 0.02;
|
22649
22648
|
let TimelineOccupancy = /*#__PURE__*/function (TimelineOccupancy) {
|
22650
22649
|
TimelineOccupancy[TimelineOccupancy["Point"] = 0] = "Point";
|
22651
22650
|
TimelineOccupancy[TimelineOccupancy["Range"] = 1] = "Range";
|
@@ -22993,8 +22992,9 @@ class HlsAssetPlayer {
|
|
22993
22992
|
}
|
22994
22993
|
|
22995
22994
|
const ABUTTING_THRESHOLD_SECONDS = 0.033;
|
22996
|
-
class InterstitialsSchedule {
|
22997
|
-
constructor(onScheduleUpdate) {
|
22995
|
+
class InterstitialsSchedule extends Logger {
|
22996
|
+
constructor(onScheduleUpdate, logger) {
|
22997
|
+
super('interstitials-sched', logger);
|
22998
22998
|
this.onScheduleUpdate = void 0;
|
22999
22999
|
this.eventMap = {};
|
23000
23000
|
this.events = null;
|
@@ -23430,28 +23430,29 @@ class InterstitialsSchedule {
|
|
23430
23430
|
const resumeTime = interstitial.resumeTime;
|
23431
23431
|
const resumesInPlaceAt = interstitial.startTime + interstitial.resumptionOffset;
|
23432
23432
|
if (Math.abs(resumeTime - resumesInPlaceAt) > ALIGNED_END_THRESHOLD_SECONDS) {
|
23433
|
-
|
23433
|
+
this.log(`"${interstitial.identifier}" resumption ${resumeTime} not aligned with estimated timeline end ${resumesInPlaceAt}`);
|
23434
23434
|
return false;
|
23435
23435
|
}
|
23436
23436
|
if (!mediaSelection) {
|
23437
|
-
|
23437
|
+
this.log(`"${interstitial.identifier}" resumption ${resumeTime} can not be aligned with media (none selected)`);
|
23438
23438
|
return false;
|
23439
23439
|
}
|
23440
23440
|
return !Object.keys(mediaSelection).some(playlistType => {
|
23441
23441
|
const details = mediaSelection[playlistType].details;
|
23442
23442
|
const playlistEnd = details.edge;
|
23443
23443
|
if (resumeTime > playlistEnd) {
|
23444
|
-
|
23444
|
+
this.log(`"${interstitial.identifier}" resumption ${resumeTime} past ${playlistType} playlist end ${playlistEnd}`);
|
23445
23445
|
return true;
|
23446
23446
|
}
|
23447
23447
|
const startFragment = findFragmentByPTS(null, details.fragments, resumeTime);
|
23448
23448
|
if (!startFragment) {
|
23449
|
-
|
23449
|
+
this.log(`"${interstitial.identifier}" resumption ${resumeTime} does not align with any fragments in ${playlistType} playlist`);
|
23450
23450
|
return true;
|
23451
23451
|
}
|
23452
|
-
const
|
23452
|
+
const endAllowance = playlistType === 'audio' ? 0.175 : 0;
|
23453
|
+
const alignedWithSegment = Math.abs(startFragment.start - resumeTime) < ALIGNED_END_THRESHOLD_SECONDS || Math.abs(startFragment.end - resumeTime) < ALIGNED_END_THRESHOLD_SECONDS + endAllowance;
|
23453
23454
|
if (!alignedWithSegment) {
|
23454
|
-
|
23455
|
+
this.log(`"${interstitial.identifier}" resumption ${resumeTime} not aligned with ${playlistType} fragment bounds (${startFragment.start}-${startFragment.end} sn: ${startFragment.sn} cc: ${startFragment.cc})`);
|
23455
23456
|
return true;
|
23456
23457
|
}
|
23457
23458
|
return false;
|
@@ -23573,6 +23574,9 @@ class AssetListLoader {
|
|
23573
23574
|
}
|
23574
23575
|
}
|
23575
23576
|
|
23577
|
+
function playWithCatch(media) {
|
23578
|
+
media == null ? void 0 : media.play().catch() /* no-op */;
|
23579
|
+
}
|
23576
23580
|
class InterstitialsController extends Logger {
|
23577
23581
|
constructor(hls, HlsPlayerClass) {
|
23578
23582
|
super('interstitials', hls.logger);
|
@@ -23780,7 +23784,7 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
|
|
23780
23784
|
this.hls = hls;
|
23781
23785
|
this.HlsPlayerClass = HlsPlayerClass;
|
23782
23786
|
this.assetListLoader = new AssetListLoader(hls);
|
23783
|
-
this.schedule = new InterstitialsSchedule(this.onScheduleUpdate);
|
23787
|
+
this.schedule = new InterstitialsSchedule(this.onScheduleUpdate, hls.logger);
|
23784
23788
|
this.registerListeners();
|
23785
23789
|
}
|
23786
23790
|
registerListeners() {
|
@@ -24251,8 +24255,8 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
|
|
24251
24255
|
if (detachedMediaSource) {
|
24252
24256
|
attachMediaSourceData = this.detachedData;
|
24253
24257
|
this.log(`using detachedData: MediaSource ${JSON.stringify(attachMediaSourceData)}`);
|
24254
|
-
} else if (!this.detachedData) {
|
24255
|
-
|
24258
|
+
} else if (!this.detachedData || this.hls.media === media) {
|
24259
|
+
// Media is attaching when `detachedData` and `hls.media` are populated. Detach to clear the MediaSource.
|
24256
24260
|
this.hls.detachMedia();
|
24257
24261
|
this.detachedData = {
|
24258
24262
|
media
|
@@ -24473,14 +24477,12 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
|
|
24473
24477
|
}
|
24474
24478
|
this.startAssetPlayer(player, assetListIndex, scheduleItems, index, media);
|
24475
24479
|
if (this.shouldPlay) {
|
24476
|
-
|
24477
|
-
(_player$media = player.media) == null ? void 0 : _player$media.play();
|
24480
|
+
playWithCatch(player.media);
|
24478
24481
|
}
|
24479
24482
|
} else if (scheduledItem !== null) {
|
24480
24483
|
this.resumePrimary(scheduledItem, index, currentItem);
|
24481
24484
|
if (this.shouldPlay) {
|
24482
|
-
|
24483
|
-
(_this$hls$media = this.hls.media) == null ? void 0 : _this$hls$media.play();
|
24485
|
+
playWithCatch(this.hls.media);
|
24484
24486
|
}
|
24485
24487
|
} else if (playingLastItem && this.isInterstitial(currentItem)) {
|
24486
24488
|
// Maintain playingItem state at end of schedule (setSchedulePosition(-1) called to end program)
|