hls.js 1.6.0-beta.1.0.canary.10821 → 1.6.0-beta.1.0.canary.10824
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.js
CHANGED
@@ -1058,7 +1058,7 @@
|
|
1058
1058
|
// Some browsers don't allow to use bind on console object anyway
|
1059
1059
|
// fallback to default if needed
|
1060
1060
|
try {
|
1061
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.
|
1061
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10824");
|
1062
1062
|
} catch (e) {
|
1063
1063
|
/* log fn threw an exception. All logger methods are no-ops. */
|
1064
1064
|
return createLogger();
|
@@ -16297,7 +16297,7 @@
|
|
16297
16297
|
return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
|
16298
16298
|
}
|
16299
16299
|
|
16300
|
-
var version = "1.6.0-beta.1.0.canary.
|
16300
|
+
var version = "1.6.0-beta.1.0.canary.10824";
|
16301
16301
|
|
16302
16302
|
// ensure the worker ends up in the bundle
|
16303
16303
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -22773,8 +22773,7 @@
|
|
22773
22773
|
return (hash >>> 0).toString();
|
22774
22774
|
}
|
22775
22775
|
|
22776
|
-
var ALIGNED_END_THRESHOLD_SECONDS = 0.02;
|
22777
|
-
|
22776
|
+
var ALIGNED_END_THRESHOLD_SECONDS = 0.02;
|
22778
22777
|
var TimelineOccupancy = /*#__PURE__*/function (TimelineOccupancy) {
|
22779
22778
|
TimelineOccupancy[TimelineOccupancy["Point"] = 0] = "Point";
|
22780
22779
|
TimelineOccupancy[TimelineOccupancy["Range"] = 1] = "Range";
|
@@ -23176,19 +23175,23 @@
|
|
23176
23175
|
}();
|
23177
23176
|
|
23178
23177
|
var ABUTTING_THRESHOLD_SECONDS = 0.033;
|
23179
|
-
var InterstitialsSchedule = /*#__PURE__*/function () {
|
23180
|
-
function InterstitialsSchedule(onScheduleUpdate) {
|
23181
|
-
|
23182
|
-
|
23183
|
-
|
23184
|
-
|
23185
|
-
|
23178
|
+
var InterstitialsSchedule = /*#__PURE__*/function (_Logger) {
|
23179
|
+
function InterstitialsSchedule(onScheduleUpdate, logger) {
|
23180
|
+
var _this;
|
23181
|
+
_this = _Logger.call(this, 'interstitials-sched', logger) || this;
|
23182
|
+
_this.onScheduleUpdate = void 0;
|
23183
|
+
_this.eventMap = {};
|
23184
|
+
_this.events = null;
|
23185
|
+
_this.items = null;
|
23186
|
+
_this.durations = {
|
23186
23187
|
primary: 0,
|
23187
23188
|
playout: 0,
|
23188
23189
|
integrated: 0
|
23189
23190
|
};
|
23190
|
-
|
23191
|
+
_this.onScheduleUpdate = onScheduleUpdate;
|
23192
|
+
return _this;
|
23191
23193
|
}
|
23194
|
+
_inheritsLoose(InterstitialsSchedule, _Logger);
|
23192
23195
|
var _proto = InterstitialsSchedule.prototype;
|
23193
23196
|
_proto.destroy = function destroy() {
|
23194
23197
|
this.reset();
|
@@ -23298,7 +23301,7 @@
|
|
23298
23301
|
return 0;
|
23299
23302
|
};
|
23300
23303
|
_proto.parseInterstitialDateRanges = function parseInterstitialDateRanges(mediaSelection) {
|
23301
|
-
var
|
23304
|
+
var _this2 = this;
|
23302
23305
|
var details = mediaSelection.main.details;
|
23303
23306
|
var dateRanges = details.dateRanges;
|
23304
23307
|
var previousInterstitialEvents = this.events;
|
@@ -23343,7 +23346,7 @@
|
|
23343
23346
|
|
23344
23347
|
// Clear removed DateRanges from buffered list (kills playback of active Interstitials)
|
23345
23348
|
removedInterstitials.forEach(function (interstitial) {
|
23346
|
-
|
23349
|
+
_this2.removeEvent(interstitial);
|
23347
23350
|
});
|
23348
23351
|
this.updateSchedule(mediaSelection, removedInterstitials);
|
23349
23352
|
};
|
@@ -23554,7 +23557,7 @@
|
|
23554
23557
|
};
|
23555
23558
|
};
|
23556
23559
|
_proto.resolveOffsets = function resolveOffsets(interstitialEvents, mediaSelection) {
|
23557
|
-
var
|
23560
|
+
var _this3 = this;
|
23558
23561
|
var details = mediaSelection.main.details;
|
23559
23562
|
var primaryDuration = details.live ? Infinity : details.edge;
|
23560
23563
|
|
@@ -23565,7 +23568,7 @@
|
|
23565
23568
|
var preroll = interstitial.cue.pre;
|
23566
23569
|
var postroll = interstitial.cue.post;
|
23567
23570
|
var eventStart = preroll ? 0 : postroll ? primaryDuration : interstitial.startTime;
|
23568
|
-
|
23571
|
+
_this3.updateAssetDurations(interstitial);
|
23569
23572
|
|
23570
23573
|
// X-RESUME-OFFSET values of interstitials scheduled at the same time are cumulative
|
23571
23574
|
var inSameStartTimeSequence = lastScheduledStart === eventStart;
|
@@ -23581,7 +23584,7 @@
|
|
23581
23584
|
}
|
23582
23585
|
// Check if primary fragments align with resumption offset and disable appendInPlace if they do not
|
23583
23586
|
if (interstitial.appendInPlace && !interstitial.appendInPlaceStarted) {
|
23584
|
-
var alignedSegmentStart =
|
23587
|
+
var alignedSegmentStart = _this3.primaryCanResumeInPlaceAt(interstitial, mediaSelection);
|
23585
23588
|
if (!alignedSegmentStart) {
|
23586
23589
|
interstitial.appendInPlace = false;
|
23587
23590
|
}
|
@@ -23601,31 +23604,33 @@
|
|
23601
23604
|
});
|
23602
23605
|
};
|
23603
23606
|
_proto.primaryCanResumeInPlaceAt = function primaryCanResumeInPlaceAt(interstitial, mediaSelection) {
|
23607
|
+
var _this4 = this;
|
23604
23608
|
var resumeTime = interstitial.resumeTime;
|
23605
23609
|
var resumesInPlaceAt = interstitial.startTime + interstitial.resumptionOffset;
|
23606
23610
|
if (Math.abs(resumeTime - resumesInPlaceAt) > ALIGNED_END_THRESHOLD_SECONDS) {
|
23607
|
-
|
23611
|
+
this.log("\"" + interstitial.identifier + "\" resumption " + resumeTime + " not aligned with estimated timeline end " + resumesInPlaceAt);
|
23608
23612
|
return false;
|
23609
23613
|
}
|
23610
23614
|
if (!mediaSelection) {
|
23611
|
-
|
23615
|
+
this.log("\"" + interstitial.identifier + "\" resumption " + resumeTime + " can not be aligned with media (none selected)");
|
23612
23616
|
return false;
|
23613
23617
|
}
|
23614
23618
|
return !Object.keys(mediaSelection).some(function (playlistType) {
|
23615
23619
|
var details = mediaSelection[playlistType].details;
|
23616
23620
|
var playlistEnd = details.edge;
|
23617
23621
|
if (resumeTime > playlistEnd) {
|
23618
|
-
|
23622
|
+
_this4.log("\"" + interstitial.identifier + "\" resumption " + resumeTime + " past " + playlistType + " playlist end " + playlistEnd);
|
23619
23623
|
return true;
|
23620
23624
|
}
|
23621
23625
|
var startFragment = findFragmentByPTS(null, details.fragments, resumeTime);
|
23622
23626
|
if (!startFragment) {
|
23623
|
-
|
23627
|
+
_this4.log("\"" + interstitial.identifier + "\" resumption " + resumeTime + " does not align with any fragments in " + playlistType + " playlist");
|
23624
23628
|
return true;
|
23625
23629
|
}
|
23626
|
-
var
|
23630
|
+
var endAllowance = playlistType === 'audio' ? 0.175 : 0;
|
23631
|
+
var alignedWithSegment = Math.abs(startFragment.start - resumeTime) < ALIGNED_END_THRESHOLD_SECONDS || Math.abs(startFragment.end - resumeTime) < ALIGNED_END_THRESHOLD_SECONDS + endAllowance;
|
23627
23632
|
if (!alignedWithSegment) {
|
23628
|
-
|
23633
|
+
_this4.log("\"" + interstitial.identifier + "\" resumption " + resumeTime + " not aligned with " + playlistType + " fragment bounds (" + startFragment.start + "-" + startFragment.end + " sn: " + startFragment.sn + " cc: " + startFragment.cc + ")");
|
23629
23634
|
return true;
|
23630
23635
|
}
|
23631
23636
|
return false;
|
@@ -23682,7 +23687,7 @@
|
|
23682
23687
|
return null;
|
23683
23688
|
}
|
23684
23689
|
}]);
|
23685
|
-
}();
|
23690
|
+
}(Logger);
|
23686
23691
|
function segmentToString(segment) {
|
23687
23692
|
return "[" + (segment.event ? '"' + segment.event.identifier + '"' : 'primary') + ": " + segment.start.toFixed(2) + "-" + segment.end.toFixed(2) + "]";
|
23688
23693
|
}
|
@@ -23776,6 +23781,9 @@
|
|
23776
23781
|
return AssetListLoader;
|
23777
23782
|
}();
|
23778
23783
|
|
23784
|
+
function playWithCatch(media) {
|
23785
|
+
media == null ? void 0 : media.play().catch() /* no-op */;
|
23786
|
+
}
|
23779
23787
|
var InterstitialsController = /*#__PURE__*/function (_Logger) {
|
23780
23788
|
function InterstitialsController(hls, HlsPlayerClass) {
|
23781
23789
|
var _this;
|
@@ -23989,7 +23997,7 @@
|
|
23989
23997
|
_this.hls = hls;
|
23990
23998
|
_this.HlsPlayerClass = HlsPlayerClass;
|
23991
23999
|
_this.assetListLoader = new AssetListLoader(hls);
|
23992
|
-
_this.schedule = new InterstitialsSchedule(_this.onScheduleUpdate);
|
24000
|
+
_this.schedule = new InterstitialsSchedule(_this.onScheduleUpdate, hls.logger);
|
23993
24001
|
_this.registerListeners();
|
23994
24002
|
return _this;
|
23995
24003
|
}
|
@@ -24193,8 +24201,8 @@
|
|
24193
24201
|
if (detachedMediaSource) {
|
24194
24202
|
attachMediaSourceData = this.detachedData;
|
24195
24203
|
this.log("using detachedData: MediaSource " + JSON.stringify(attachMediaSourceData));
|
24196
|
-
} else if (!this.detachedData) {
|
24197
|
-
|
24204
|
+
} else if (!this.detachedData || this.hls.media === media) {
|
24205
|
+
// Media is attaching when `detachedData` and `hls.media` are populated. Detach to clear the MediaSource.
|
24198
24206
|
this.hls.detachMedia();
|
24199
24207
|
this.detachedData = {
|
24200
24208
|
media: media
|
@@ -24416,14 +24424,12 @@
|
|
24416
24424
|
}
|
24417
24425
|
this.startAssetPlayer(_player, assetListIndex, scheduleItems, index, media);
|
24418
24426
|
if (this.shouldPlay) {
|
24419
|
-
|
24420
|
-
(_player$media = _player.media) == null ? void 0 : _player$media.play();
|
24427
|
+
playWithCatch(_player.media);
|
24421
24428
|
}
|
24422
24429
|
} else if (scheduledItem !== null) {
|
24423
24430
|
this.resumePrimary(scheduledItem, index, currentItem);
|
24424
24431
|
if (this.shouldPlay) {
|
24425
|
-
|
24426
|
-
(_this$hls$media = this.hls.media) == null ? void 0 : _this$hls$media.play();
|
24432
|
+
playWithCatch(this.hls.media);
|
24427
24433
|
}
|
24428
24434
|
} else if (playingLastItem && this.isInterstitial(currentItem)) {
|
24429
24435
|
// Maintain playingItem state at end of schedule (setSchedulePosition(-1) called to end program)
|