hls.js 1.6.0-beta.4.0.canary.11044 → 1.6.0-beta.4.0.canary.11046
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.d.mts +3 -1
- package/dist/hls.d.ts +3 -1
- package/dist/hls.js +197 -167
- package/dist/hls.js.d.ts +3 -1
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +39 -33
- 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 +38 -32
- 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 +149 -116
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +1 -1
- package/src/controller/base-stream-controller.ts +81 -69
- package/src/controller/buffer-controller.ts +2 -3
- package/src/controller/interstitial-player.ts +6 -3
- package/src/controller/interstitials-controller.ts +51 -27
- package/src/controller/interstitials-schedule.ts +21 -12
- package/src/controller/subtitle-stream-controller.ts +15 -14
- package/src/utils/level-helper.ts +6 -9
package/dist/hls.js
CHANGED
@@ -1073,7 +1073,7 @@
|
|
1073
1073
|
// Some browsers don't allow to use bind on console object anyway
|
1074
1074
|
// fallback to default if needed
|
1075
1075
|
try {
|
1076
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.4.0.canary.
|
1076
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.4.0.canary.11046");
|
1077
1077
|
} catch (e) {
|
1078
1078
|
/* log fn threw an exception. All logger methods are no-ops. */
|
1079
1079
|
return createLogger();
|
@@ -8716,15 +8716,12 @@
|
|
8716
8716
|
function reassignFragmentLevelIndexes(levels) {
|
8717
8717
|
levels.forEach(function (level, index) {
|
8718
8718
|
var _level$details;
|
8719
|
-
|
8720
|
-
|
8721
|
-
|
8722
|
-
fragment.level = index;
|
8723
|
-
|
8724
|
-
|
8725
|
-
}
|
8726
|
-
});
|
8727
|
-
}
|
8719
|
+
(_level$details = level.details) == null ? void 0 : _level$details.fragments.forEach(function (fragment) {
|
8720
|
+
fragment.level = index;
|
8721
|
+
if (fragment.initSegment) {
|
8722
|
+
fragment.initSegment.level = index;
|
8723
|
+
}
|
8724
|
+
});
|
8728
8725
|
});
|
8729
8726
|
}
|
8730
8727
|
|
@@ -9116,6 +9113,7 @@
|
|
9116
9113
|
this.media = this.mediaBuffer = null;
|
9117
9114
|
this.loopSn = undefined;
|
9118
9115
|
if (transferringMedia) {
|
9116
|
+
this.resetLoadingState();
|
9119
9117
|
this.resetTransmuxer();
|
9120
9118
|
return;
|
9121
9119
|
}
|
@@ -9158,42 +9156,6 @@
|
|
9158
9156
|
_TaskLoop.prototype.onHandlerDestroyed.call(this);
|
9159
9157
|
};
|
9160
9158
|
_proto.loadFragment = function loadFragment(frag, level, targetBufferTime) {
|
9161
|
-
var config = this.hls.config;
|
9162
|
-
if (config.interstitialsController && config.enableInterstitialPlayback !== false && frag.type !== PlaylistLevelType.SUBTITLE) {
|
9163
|
-
// Do not load fragments outside the buffering schedule segment
|
9164
|
-
var interstitials = this.hls.interstitialsManager;
|
9165
|
-
var bufferingItem = interstitials == null ? void 0 : interstitials.bufferingItem;
|
9166
|
-
if (bufferingItem) {
|
9167
|
-
var bufferingInterstitial = bufferingItem.event;
|
9168
|
-
if (bufferingInterstitial) {
|
9169
|
-
// Do not stream fragments while buffering Interstitial Events (except for overlap at the start)
|
9170
|
-
if (bufferingInterstitial.appendInPlace || Math.abs(frag.start - bufferingItem.start) > 1 || bufferingItem.start === 0) {
|
9171
|
-
return;
|
9172
|
-
}
|
9173
|
-
} else {
|
9174
|
-
var _level$details;
|
9175
|
-
// Limit fragment loading to media in schedule item
|
9176
|
-
if (frag.end <= bufferingItem.start && ((_level$details = level.details) == null ? void 0 : _level$details.live) === false) {
|
9177
|
-
// fragment ends by schedule item start
|
9178
|
-
return;
|
9179
|
-
}
|
9180
|
-
if (frag.start > bufferingItem.end && bufferingItem.nextEvent) {
|
9181
|
-
// fragment is past schedule item end
|
9182
|
-
return;
|
9183
|
-
}
|
9184
|
-
}
|
9185
|
-
}
|
9186
|
-
// Skip loading of fragments that overlap completely with appendInPlace interstitials
|
9187
|
-
var playerQueue = interstitials == null ? void 0 : interstitials.playerQueue;
|
9188
|
-
if (playerQueue) {
|
9189
|
-
for (var i = playerQueue.length; i--;) {
|
9190
|
-
var interstitial = playerQueue[i].interstitial;
|
9191
|
-
if (interstitial.appendInPlace && frag.start >= interstitial.startTime && frag.end <= interstitial.resumeTime) {
|
9192
|
-
return;
|
9193
|
-
}
|
9194
|
-
}
|
9195
|
-
}
|
9196
|
-
}
|
9197
9159
|
this.startFragRequested = true;
|
9198
9160
|
this._loadFragForPlayback(frag, level, targetBufferTime);
|
9199
9161
|
};
|
@@ -9552,9 +9514,9 @@
|
|
9552
9514
|
_proto.doFragPartsLoad = function doFragPartsLoad(frag, fromPart, level, progressCallback) {
|
9553
9515
|
var _this6 = this;
|
9554
9516
|
return new Promise(function (resolve, reject) {
|
9555
|
-
var _level$
|
9517
|
+
var _level$details;
|
9556
9518
|
var partsLoaded = [];
|
9557
|
-
var initialPartList = (_level$
|
9519
|
+
var initialPartList = (_level$details = level.details) == null ? void 0 : _level$details.partList;
|
9558
9520
|
var _loadPart = function loadPart(part) {
|
9559
9521
|
_this6.fragmentLoader.loadPart(frag, part, progressCallback).then(function (partLoadedData) {
|
9560
9522
|
partsLoaded[part.index] = partLoadedData;
|
@@ -9820,6 +9782,7 @@
|
|
9820
9782
|
var end = this.loadingParts ? levelDetails.partEnd : levelDetails.fragmentEnd;
|
9821
9783
|
frag = this.getFragmentAtPosition(pos, end, levelDetails);
|
9822
9784
|
}
|
9785
|
+
frag = this.filterReplacedPrimary(frag, levelDetails);
|
9823
9786
|
return this.mapToInitFragWhenRequired(frag);
|
9824
9787
|
};
|
9825
9788
|
_proto.isLoopLoading = function isLoopLoading(frag, targetBufferTime) {
|
@@ -9847,6 +9810,48 @@
|
|
9847
9810
|
this.loopSn = undefined;
|
9848
9811
|
return nextFragment;
|
9849
9812
|
};
|
9813
|
+
_proto.filterReplacedPrimary = function filterReplacedPrimary(frag, details) {
|
9814
|
+
if (!frag) {
|
9815
|
+
return frag;
|
9816
|
+
}
|
9817
|
+
var config = this.hls.config;
|
9818
|
+
if (config.interstitialsController && config.enableInterstitialPlayback !== false && frag.type !== PlaylistLevelType.SUBTITLE) {
|
9819
|
+
// Do not load fragments outside the buffering schedule segment
|
9820
|
+
var interstitials = this.hls.interstitialsManager;
|
9821
|
+
var bufferingItem = interstitials == null ? void 0 : interstitials.bufferingItem;
|
9822
|
+
if (bufferingItem) {
|
9823
|
+
var bufferingInterstitial = bufferingItem.event;
|
9824
|
+
if (bufferingInterstitial) {
|
9825
|
+
// Do not stream fragments while buffering Interstitial Events (except for overlap at the start)
|
9826
|
+
if (bufferingInterstitial.appendInPlace || Math.abs(frag.start - bufferingItem.start) > 1 || bufferingItem.start === 0) {
|
9827
|
+
return null;
|
9828
|
+
}
|
9829
|
+
} else {
|
9830
|
+
// Limit fragment loading to media in schedule item
|
9831
|
+
if (frag.end <= bufferingItem.start && (details == null ? void 0 : details.live) === false) {
|
9832
|
+
// fragment ends by schedule item start
|
9833
|
+
// this.fragmentTracker.fragBuffered(frag, true);
|
9834
|
+
return null;
|
9835
|
+
}
|
9836
|
+
if (frag.start > bufferingItem.end && bufferingItem.nextEvent) {
|
9837
|
+
// fragment is past schedule item end
|
9838
|
+
return null;
|
9839
|
+
}
|
9840
|
+
}
|
9841
|
+
}
|
9842
|
+
// Skip loading of fragments that overlap completely with appendInPlace interstitials
|
9843
|
+
var playerQueue = interstitials == null ? void 0 : interstitials.playerQueue;
|
9844
|
+
if (playerQueue) {
|
9845
|
+
for (var i = playerQueue.length; i--;) {
|
9846
|
+
var interstitial = playerQueue[i].interstitial;
|
9847
|
+
if (interstitial.appendInPlace && frag.start >= interstitial.startTime && frag.end <= interstitial.resumeTime) {
|
9848
|
+
return null;
|
9849
|
+
}
|
9850
|
+
}
|
9851
|
+
}
|
9852
|
+
}
|
9853
|
+
return frag;
|
9854
|
+
};
|
9850
9855
|
_proto.mapToInitFragWhenRequired = function mapToInitFragWhenRequired(frag) {
|
9851
9856
|
// If an initSegment is present, it must be buffered first
|
9852
9857
|
if (frag != null && frag.initSegment && !(frag != null && frag.initSegment.data) && !this.bitrateTest) {
|
@@ -10210,8 +10215,7 @@
|
|
10210
10215
|
this.fragmentTracker.removeFragmentsInRange(start, Infinity, this.playlistType, false, true);
|
10211
10216
|
};
|
10212
10217
|
_proto.updateLevelTiming = function updateLevelTiming(frag, part, level, partial) {
|
10213
|
-
var _this7 = this
|
10214
|
-
_this$transmuxer;
|
10218
|
+
var _this7 = this;
|
10215
10219
|
var details = level.details;
|
10216
10220
|
if (!details) {
|
10217
10221
|
this.warn('level.details undefined');
|
@@ -10242,25 +10246,28 @@
|
|
10242
10246
|
}
|
10243
10247
|
return result;
|
10244
10248
|
}, false);
|
10245
|
-
if (!parsed
|
10246
|
-
var
|
10249
|
+
if (!parsed) {
|
10250
|
+
var _this$transmuxer;
|
10247
10251
|
if (level.fragmentError === 0) {
|
10248
10252
|
// Mark and track the odd empty segment as a gap to avoid reloading
|
10249
10253
|
this.treatAsGap(frag, level);
|
10250
10254
|
}
|
10251
|
-
this.
|
10252
|
-
|
10253
|
-
|
10254
|
-
|
10255
|
-
|
10256
|
-
|
10257
|
-
|
10258
|
-
|
10259
|
-
|
10260
|
-
|
10261
|
-
|
10255
|
+
if (((_this$transmuxer = this.transmuxer) == null ? void 0 : _this$transmuxer.error) === null) {
|
10256
|
+
var error = new Error("Found no media in fragment " + frag.sn + " of " + this.playlistLabel() + " " + frag.level + " resetting transmuxer to fallback to playlist timing");
|
10257
|
+
this.warn(error.message);
|
10258
|
+
this.hls.trigger(Events.ERROR, {
|
10259
|
+
type: ErrorTypes.MEDIA_ERROR,
|
10260
|
+
details: ErrorDetails.FRAG_PARSING_ERROR,
|
10261
|
+
fatal: false,
|
10262
|
+
error: error,
|
10263
|
+
frag: frag,
|
10264
|
+
reason: "Found no media in msn " + frag.sn + " of " + this.playlistLabel() + " \"" + level.url + "\""
|
10265
|
+
});
|
10266
|
+
if (!this.hls) {
|
10267
|
+
return;
|
10268
|
+
}
|
10269
|
+
this.resetTransmuxer();
|
10262
10270
|
}
|
10263
|
-
this.resetTransmuxer();
|
10264
10271
|
// For this error fallthrough. Marking parsed will allow advancing to next fragment.
|
10265
10272
|
}
|
10266
10273
|
this.state = State.PARSED;
|
@@ -16443,7 +16450,7 @@
|
|
16443
16450
|
return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
|
16444
16451
|
}
|
16445
16452
|
|
16446
|
-
var version = "1.6.0-beta.4.0.canary.
|
16453
|
+
var version = "1.6.0-beta.4.0.canary.11046";
|
16447
16454
|
|
16448
16455
|
// ensure the worker ends up in the bundle
|
16449
16456
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -18436,15 +18443,14 @@
|
|
18436
18443
|
if (!media || !mediaSource) {
|
18437
18444
|
return;
|
18438
18445
|
}
|
18446
|
+
// once received, don't listen anymore to sourceopen event
|
18447
|
+
mediaSource.removeEventListener('sourceopen', _this2._onMediaSourceOpen);
|
18439
18448
|
media.removeEventListener('emptied', _this2._onMediaEmptied);
|
18440
18449
|
_this2.updateDuration();
|
18441
18450
|
_this2.hls.trigger(Events.MEDIA_ATTACHED, {
|
18442
18451
|
media: media,
|
18443
18452
|
mediaSource: mediaSource
|
18444
18453
|
});
|
18445
|
-
|
18446
|
-
// once received, don't listen anymore to sourceopen event
|
18447
|
-
mediaSource.removeEventListener('sourceopen', _this2._onMediaSourceOpen);
|
18448
18454
|
if (_this2.mediaSource !== null) {
|
18449
18455
|
_this2.checkPendingTracks();
|
18450
18456
|
}
|
@@ -23213,6 +23219,7 @@
|
|
23213
23219
|
this.tracks = null;
|
23214
23220
|
this.hasDetails = false;
|
23215
23221
|
this.mediaAttached = null;
|
23222
|
+
this._currentTime = void 0;
|
23216
23223
|
this.checkPlayout = function () {
|
23217
23224
|
var interstitial = _this.interstitial;
|
23218
23225
|
var playoutLimit = interstitial.playoutLimit;
|
@@ -23257,6 +23264,7 @@
|
|
23257
23264
|
_proto.removeMediaListeners = function removeMediaListeners() {
|
23258
23265
|
var media = this.mediaAttached;
|
23259
23266
|
if (media) {
|
23267
|
+
this._currentTime = media.currentTime;
|
23260
23268
|
media.removeEventListener('timeupdate', this.checkPlayout);
|
23261
23269
|
}
|
23262
23270
|
};
|
@@ -23273,6 +23281,7 @@
|
|
23273
23281
|
};
|
23274
23282
|
_proto.detachMedia = function detachMedia() {
|
23275
23283
|
this.removeMediaListeners();
|
23284
|
+
this.mediaAttached = null;
|
23276
23285
|
this.hls.detachMedia();
|
23277
23286
|
};
|
23278
23287
|
_proto.resumeBuffering = function resumeBuffering() {
|
@@ -23294,13 +23303,14 @@
|
|
23294
23303
|
this.hls.off(event, listener);
|
23295
23304
|
};
|
23296
23305
|
_proto.toString = function toString() {
|
23297
|
-
|
23306
|
+
var _this$hls, _this$interstitial;
|
23307
|
+
return "HlsAssetPlayer: " + eventAssetToString(this.assetItem) + " " + ((_this$hls = this.hls) == null ? void 0 : _this$hls.sessionId) + " " + ((_this$interstitial = this.interstitial) != null && _this$interstitial.appendInPlace ? 'append-in-place' : '');
|
23298
23308
|
};
|
23299
23309
|
return _createClass(HlsAssetPlayer, [{
|
23300
23310
|
key: "destroyed",
|
23301
23311
|
get: function get() {
|
23302
|
-
var _this$
|
23303
|
-
return !((_this$
|
23312
|
+
var _this$hls2;
|
23313
|
+
return !((_this$hls2 = this.hls) != null && _this$hls2.userConfig);
|
23304
23314
|
}
|
23305
23315
|
}, {
|
23306
23316
|
key: "assetId",
|
@@ -23315,15 +23325,15 @@
|
|
23315
23325
|
}, {
|
23316
23326
|
key: "media",
|
23317
23327
|
get: function get() {
|
23318
|
-
var _this$
|
23319
|
-
return ((_this$
|
23328
|
+
var _this$hls3;
|
23329
|
+
return ((_this$hls3 = this.hls) == null ? void 0 : _this$hls3.media) || null;
|
23320
23330
|
}
|
23321
23331
|
}, {
|
23322
23332
|
key: "bufferedEnd",
|
23323
23333
|
get: function get() {
|
23324
23334
|
var media = this.media || this.mediaAttached;
|
23325
23335
|
if (!media) {
|
23326
|
-
return
|
23336
|
+
return this.currentTime;
|
23327
23337
|
}
|
23328
23338
|
var bufferInfo = BufferHelper.bufferInfo(media, media.currentTime, 0.001);
|
23329
23339
|
return this.getAssetTime(bufferInfo.end);
|
@@ -23333,7 +23343,7 @@
|
|
23333
23343
|
get: function get() {
|
23334
23344
|
var media = this.media || this.mediaAttached;
|
23335
23345
|
if (!media) {
|
23336
|
-
return 0;
|
23346
|
+
return this._currentTime || 0;
|
23337
23347
|
}
|
23338
23348
|
return this.getAssetTime(media.currentTime);
|
23339
23349
|
}
|
@@ -23363,8 +23373,8 @@
|
|
23363
23373
|
}, {
|
23364
23374
|
key: "timelineOffset",
|
23365
23375
|
get: function get() {
|
23366
|
-
var _this$
|
23367
|
-
return ((_this$
|
23376
|
+
var _this$hls4;
|
23377
|
+
return ((_this$hls4 = this.hls) == null ? void 0 : _this$hls4.config.timelineOffset) || 0;
|
23368
23378
|
},
|
23369
23379
|
set: function set(value) {
|
23370
23380
|
var timelineOffset = this.timelineOffset;
|
@@ -23521,14 +23531,14 @@
|
|
23521
23531
|
}
|
23522
23532
|
return 0;
|
23523
23533
|
};
|
23524
|
-
_proto.parseInterstitialDateRanges = function parseInterstitialDateRanges(mediaSelection) {
|
23534
|
+
_proto.parseInterstitialDateRanges = function parseInterstitialDateRanges(mediaSelection, enableAppendInPlace) {
|
23525
23535
|
var _this2 = this;
|
23526
23536
|
var details = mediaSelection.main.details;
|
23527
23537
|
var dateRanges = details.dateRanges;
|
23528
23538
|
var previousInterstitialEvents = this.events;
|
23529
23539
|
var interstitialEvents = this.parseDateRanges(dateRanges, {
|
23530
23540
|
url: details.url
|
23531
|
-
});
|
23541
|
+
}, enableAppendInPlace);
|
23532
23542
|
var ids = Object.keys(dateRanges);
|
23533
23543
|
var removedInterstitials = previousInterstitialEvents ? previousInterstitialEvents.filter(function (event) {
|
23534
23544
|
return !ids.includes(event.identifier);
|
@@ -23589,7 +23599,7 @@
|
|
23589
23599
|
}
|
23590
23600
|
}
|
23591
23601
|
};
|
23592
|
-
_proto.parseDateRanges = function parseDateRanges(dateRanges, baseData) {
|
23602
|
+
_proto.parseDateRanges = function parseDateRanges(dateRanges, baseData, enableAppendInPlace) {
|
23593
23603
|
var interstitialEvents = [];
|
23594
23604
|
var ids = Object.keys(dateRanges);
|
23595
23605
|
for (var i = 0; i < ids.length; i++) {
|
@@ -23604,6 +23614,9 @@
|
|
23604
23614
|
} else {
|
23605
23615
|
interstitial = new InterstitialEvent(dateRange, baseData);
|
23606
23616
|
this.eventMap[id] = interstitial;
|
23617
|
+
if (enableAppendInPlace === false) {
|
23618
|
+
interstitial.appendInPlace = enableAppendInPlace;
|
23619
|
+
}
|
23607
23620
|
}
|
23608
23621
|
interstitialEvents.push(interstitial);
|
23609
23622
|
}
|
@@ -23810,13 +23823,11 @@
|
|
23810
23823
|
interstitial.appendInPlace = false;
|
23811
23824
|
}
|
23812
23825
|
}
|
23813
|
-
if (!interstitial.appendInPlace) {
|
23826
|
+
if (!interstitial.appendInPlace && i + 1 < interstitialEvents.length) {
|
23814
23827
|
// abutting Interstitials must use the same MediaSource strategy, this applies to all whether or not they are back to back:
|
23815
|
-
|
23816
|
-
|
23817
|
-
|
23818
|
-
interstitialEvents[j].appendInPlace = false;
|
23819
|
-
}
|
23828
|
+
var timeBetween = interstitialEvents[i + 1].startTime - interstitialEvents[i].resumeTime;
|
23829
|
+
if (timeBetween < ABUTTING_THRESHOLD_SECONDS) {
|
23830
|
+
interstitialEvents[i + 1].appendInPlace = false;
|
23820
23831
|
}
|
23821
23832
|
}
|
23822
23833
|
// Update cumulativeDuration for next abutting interstitial with the same start date
|
@@ -24176,11 +24187,6 @@
|
|
24176
24187
|
});
|
24177
24188
|
var interstitialsUpdated = !!(interstitialEvents.length || removedIds.length);
|
24178
24189
|
if (interstitialsUpdated) {
|
24179
|
-
if (_this.hls.config.interstitialAppendInPlace === false) {
|
24180
|
-
interstitialEvents.forEach(function (event) {
|
24181
|
-
return event.appendInPlace = false;
|
24182
|
-
});
|
24183
|
-
}
|
24184
24190
|
_this.log("INTERSTITIALS_UPDATED (" + interstitialEvents.length + "): " + interstitialEvents + "\nSchedule: " + scheduleItems.map(function (seg) {
|
24185
24191
|
return segmentToString(seg);
|
24186
24192
|
}));
|
@@ -24314,14 +24320,12 @@
|
|
24314
24320
|
this.pauseBuffering();
|
24315
24321
|
};
|
24316
24322
|
_proto.resumeBuffering = function resumeBuffering() {
|
24317
|
-
|
24318
|
-
|
24319
|
-
});
|
24323
|
+
var _this$getBufferingPla;
|
24324
|
+
(_this$getBufferingPla = this.getBufferingPlayer()) == null ? void 0 : _this$getBufferingPla.resumeBuffering();
|
24320
24325
|
};
|
24321
24326
|
_proto.pauseBuffering = function pauseBuffering() {
|
24322
|
-
|
24323
|
-
|
24324
|
-
});
|
24327
|
+
var _this$getBufferingPla2;
|
24328
|
+
(_this$getBufferingPla2 = this.getBufferingPlayer()) == null ? void 0 : _this$getBufferingPla2.pauseBuffering();
|
24325
24329
|
};
|
24326
24330
|
_proto.destroy = function destroy() {
|
24327
24331
|
this.unregisterListeners();
|
@@ -24431,33 +24435,51 @@
|
|
24431
24435
|
}
|
24432
24436
|
};
|
24433
24437
|
_proto.transferMediaTo = function transferMediaTo(player, media) {
|
24434
|
-
var _this$detachedData,
|
24438
|
+
var _this$detachedData,
|
24439
|
+
_this2 = this,
|
24440
|
+
_attachMediaSourceDat;
|
24441
|
+
if (player.media === media) {
|
24442
|
+
return;
|
24443
|
+
}
|
24435
24444
|
var attachMediaSourceData = null;
|
24436
24445
|
var primaryPlayer = this.hls;
|
24437
24446
|
var isAssetPlayer = player !== primaryPlayer;
|
24438
24447
|
var appendInPlace = isAssetPlayer && player.interstitial.appendInPlace;
|
24439
24448
|
var detachedMediaSource = (_this$detachedData = this.detachedData) == null ? void 0 : _this$detachedData.mediaSource;
|
24440
24449
|
var logFromSource;
|
24441
|
-
if (primaryPlayer.media
|
24442
|
-
|
24443
|
-
|
24450
|
+
if (primaryPlayer.media) {
|
24451
|
+
if (appendInPlace) {
|
24452
|
+
attachMediaSourceData = primaryPlayer.transferMedia();
|
24453
|
+
this.detachedData = attachMediaSourceData;
|
24454
|
+
}
|
24444
24455
|
logFromSource = "Primary";
|
24445
24456
|
} else if (detachedMediaSource) {
|
24446
24457
|
var bufferingPlayer = this.getBufferingPlayer();
|
24447
24458
|
if (bufferingPlayer) {
|
24448
24459
|
attachMediaSourceData = bufferingPlayer.transferMedia();
|
24460
|
+
logFromSource = "" + bufferingPlayer;
|
24461
|
+
} else {
|
24462
|
+
logFromSource = "detached MediaSource";
|
24449
24463
|
}
|
24450
|
-
logFromSource = "" + bufferingPlayer;
|
24451
24464
|
} else {
|
24452
|
-
logFromSource = "
|
24465
|
+
logFromSource = "detached media";
|
24453
24466
|
}
|
24454
|
-
this.log("transferring to " + (isAssetPlayer ? player : 'Primary') + "\nMediaSource " + stringify(attachMediaSourceData) + " from " + logFromSource);
|
24455
24467
|
if (!attachMediaSourceData) {
|
24456
24468
|
if (detachedMediaSource) {
|
24457
24469
|
attachMediaSourceData = this.detachedData;
|
24458
24470
|
this.log("using detachedData: MediaSource " + stringify(attachMediaSourceData));
|
24459
|
-
} else if (!this.detachedData ||
|
24460
|
-
//
|
24471
|
+
} else if (!this.detachedData || primaryPlayer.media === media) {
|
24472
|
+
// Keep interstitial media transition consistent
|
24473
|
+
var playerQueue = this.playerQueue;
|
24474
|
+
if (playerQueue.length > 1) {
|
24475
|
+
playerQueue.forEach(function (queuedPlayer) {
|
24476
|
+
if (isAssetPlayer && queuedPlayer.interstitial.appendInPlace !== appendInPlace) {
|
24477
|
+
var interstitial = queuedPlayer.interstitial;
|
24478
|
+
_this2.clearInterstitial(queuedPlayer.interstitial, null);
|
24479
|
+
interstitial.appendInPlace = false;
|
24480
|
+
}
|
24481
|
+
});
|
24482
|
+
}
|
24461
24483
|
this.hls.detachMedia();
|
24462
24484
|
this.detachedData = {
|
24463
24485
|
media: media
|
@@ -24466,7 +24488,7 @@
|
|
24466
24488
|
}
|
24467
24489
|
var transferring = attachMediaSourceData && 'mediaSource' in attachMediaSourceData && ((_attachMediaSourceDat = attachMediaSourceData.mediaSource) == null ? void 0 : _attachMediaSourceDat.readyState) !== 'closed';
|
24468
24490
|
var dataToAttach = transferring && attachMediaSourceData ? attachMediaSourceData : media;
|
24469
|
-
this.log((transferring ? 'transfering MediaSource' : 'attaching media') + " to " + (isAssetPlayer ? player : 'Primary'));
|
24491
|
+
this.log((transferring ? 'transfering MediaSource' : 'attaching media') + " to " + (isAssetPlayer ? player : 'Primary') + " from " + logFromSource);
|
24470
24492
|
if (dataToAttach === attachMediaSourceData) {
|
24471
24493
|
var isAssetAtEndOfSchedule = isAssetPlayer && player.assetId === this.schedule.assetIdAtEnd;
|
24472
24494
|
// Prevent asset players from marking EoS on transferred MediaSource
|
@@ -24563,6 +24585,7 @@
|
|
24563
24585
|
var assetId = playingAsset == null ? void 0 : playingAsset.identifier;
|
24564
24586
|
var player = assetId ? this.getAssetPlayer(assetId) : null;
|
24565
24587
|
if (player && assetId && (!this.eventItemsMatch(currentItem, scheduledItem) || assetListIndex !== undefined && assetId !== ((_interstitial$assetLi = interstitial.assetList) == null ? void 0 : _interstitial$assetLi[assetListIndex].identifier))) {
|
24588
|
+
var _this$detachedData2;
|
24566
24589
|
var _assetListIndex = interstitial.findAssetIndex(playingAsset);
|
24567
24590
|
this.log("INTERSTITIAL_ASSET_ENDED " + (_assetListIndex + 1) + "/" + interstitial.assetList.length + " " + eventAssetToString(playingAsset));
|
24568
24591
|
this.endedAsset = playingAsset;
|
@@ -24576,7 +24599,7 @@
|
|
24576
24599
|
player: player
|
24577
24600
|
});
|
24578
24601
|
this.retreiveMediaSource(assetId, scheduledItem);
|
24579
|
-
if (player.media && !this.detachedData) {
|
24602
|
+
if (player.media && !((_this$detachedData2 = this.detachedData) != null && _this$detachedData2.mediaSource)) {
|
24580
24603
|
player.detachMedia();
|
24581
24604
|
}
|
24582
24605
|
}
|
@@ -24606,7 +24629,7 @@
|
|
24606
24629
|
this.advanceSchedule(index, scheduleItems, assetListIndex, currentItem, playingLastItem);
|
24607
24630
|
};
|
24608
24631
|
_proto.advanceSchedule = function advanceSchedule(index, scheduleItems, assetListIndex, currentItem, playedLastItem) {
|
24609
|
-
var
|
24632
|
+
var _this3 = this;
|
24610
24633
|
var scheduledItem = index >= 0 ? scheduleItems[index] : null;
|
24611
24634
|
var media = this.primaryMedia;
|
24612
24635
|
// Cleanup out of range Interstitials
|
@@ -24614,9 +24637,9 @@
|
|
24614
24637
|
if (playerQueue.length) {
|
24615
24638
|
playerQueue.forEach(function (player) {
|
24616
24639
|
var interstitial = player.interstitial;
|
24617
|
-
var queuedIndex =
|
24640
|
+
var queuedIndex = _this3.schedule.findEventIndex(interstitial.identifier);
|
24618
24641
|
if (queuedIndex < index || queuedIndex > index + 1) {
|
24619
|
-
|
24642
|
+
_this3.clearInterstitial(interstitial, scheduledItem);
|
24620
24643
|
}
|
24621
24644
|
});
|
24622
24645
|
}
|
@@ -24707,13 +24730,13 @@
|
|
24707
24730
|
}
|
24708
24731
|
};
|
24709
24732
|
_proto.resumePrimary = function resumePrimary(scheduledItem, index, fromItem) {
|
24710
|
-
var _this$
|
24733
|
+
var _this$detachedData3;
|
24711
24734
|
this.playingItem = scheduledItem;
|
24712
24735
|
this.playingAsset = this.endedAsset = null;
|
24713
24736
|
this.waitingItem = this.endedItem = null;
|
24714
24737
|
this.bufferedToItem(scheduledItem);
|
24715
24738
|
this.log("resuming " + segmentToString(scheduledItem));
|
24716
|
-
if (!((_this$
|
24739
|
+
if (!((_this$detachedData3 = this.detachedData) != null && _this$detachedData3.mediaSource)) {
|
24717
24740
|
var timelinePos = this.timelinePos;
|
24718
24741
|
if (timelinePos < scheduledItem.start || timelinePos >= scheduledItem.end) {
|
24719
24742
|
timelinePos = this.getPrimaryResumption(scheduledItem, index);
|
@@ -24815,7 +24838,7 @@
|
|
24815
24838
|
main: main
|
24816
24839
|
});
|
24817
24840
|
this.mediaSelection = currentSelection;
|
24818
|
-
this.schedule.parseInterstitialDateRanges(currentSelection);
|
24841
|
+
this.schedule.parseInterstitialDateRanges(currentSelection, this.hls.config.interstitialAppendInPlace);
|
24819
24842
|
if (!this.effectivePlayingItem && this.schedule.items) {
|
24820
24843
|
this.checkStart();
|
24821
24844
|
}
|
@@ -24901,6 +24924,8 @@
|
|
24901
24924
|
if (!this.playingLastItem && playingItem) {
|
24902
24925
|
var playingIndex = this.findItemIndex(playingItem);
|
24903
24926
|
this.setSchedulePosition(playingIndex + 1);
|
24927
|
+
} else {
|
24928
|
+
this.shouldPlay = false;
|
24904
24929
|
}
|
24905
24930
|
};
|
24906
24931
|
_proto.updateItem = function updateItem(previousItem, time) {
|
@@ -24981,7 +25006,7 @@
|
|
24981
25006
|
}
|
24982
25007
|
};
|
24983
25008
|
_proto.setBufferingItem = function setBufferingItem(item) {
|
24984
|
-
var
|
25009
|
+
var _this4 = this;
|
24985
25010
|
var bufferingLast = this.bufferingItem;
|
24986
25011
|
var schedule = this.schedule;
|
24987
25012
|
if (!this.itemsMatch(item, bufferingLast)) {
|
@@ -25000,7 +25025,7 @@
|
|
25000
25025
|
if (isInterstitial) {
|
25001
25026
|
// primary fragment loading will exit early in base-stream-controller while `bufferingItem` is set to an Interstitial block
|
25002
25027
|
item.event.assetList.forEach(function (asset) {
|
25003
|
-
var player =
|
25028
|
+
var player = _this4.getAssetPlayer(asset.identifier);
|
25004
25029
|
if (player) {
|
25005
25030
|
player.resumeBuffering();
|
25006
25031
|
}
|
@@ -25074,16 +25099,16 @@
|
|
25074
25099
|
}
|
25075
25100
|
};
|
25076
25101
|
_proto.preloadAssets = function preloadAssets(interstitial, assetListIndex) {
|
25102
|
+
var uri = interstitial.assetUrl;
|
25077
25103
|
var assetListLength = interstitial.assetList.length;
|
25078
25104
|
var neverLoaded = assetListLength === 0 && !interstitial.assetListLoader;
|
25079
25105
|
var playOnce = interstitial.cue.once;
|
25080
25106
|
if (neverLoaded) {
|
25081
|
-
this.log("Load interstitial asset " + (assetListIndex + 1) + "/" + assetListLength + " " + interstitial);
|
25107
|
+
this.log("Load interstitial asset " + (assetListIndex + 1) + "/" + (uri ? 1 : assetListLength) + " " + interstitial);
|
25082
25108
|
var timelineStart = interstitial.timelineStart;
|
25083
25109
|
if (interstitial.appendInPlace) {
|
25084
25110
|
this.flushFrontBuffer(timelineStart + 0.25);
|
25085
25111
|
}
|
25086
|
-
var uri = interstitial.assetUrl;
|
25087
25112
|
if (uri) {
|
25088
25113
|
return this.createAsset(interstitial, 0, 0, timelineStart, interstitial.duration, uri);
|
25089
25114
|
}
|
@@ -25112,7 +25137,7 @@
|
|
25112
25137
|
return null;
|
25113
25138
|
};
|
25114
25139
|
_proto.flushFrontBuffer = function flushFrontBuffer(startOffset) {
|
25115
|
-
var
|
25140
|
+
var _this5 = this;
|
25116
25141
|
// Force queued flushing of all buffers
|
25117
25142
|
var requiredTracks = this.requiredTracks;
|
25118
25143
|
if (!requiredTracks) {
|
@@ -25120,7 +25145,7 @@
|
|
25120
25145
|
}
|
25121
25146
|
var sourceBufferNames = Object.keys(requiredTracks);
|
25122
25147
|
sourceBufferNames.forEach(function (type) {
|
25123
|
-
|
25148
|
+
_this5.hls.trigger(Events.BUFFER_FLUSHING, {
|
25124
25149
|
startOffset: startOffset,
|
25125
25150
|
endOffset: Infinity,
|
25126
25151
|
type: type
|
@@ -25167,7 +25192,7 @@
|
|
25167
25192
|
return this.createAssetPlayer(interstitial, assetItem, assetListIndex);
|
25168
25193
|
};
|
25169
25194
|
_proto.createAssetPlayer = function createAssetPlayer(interstitial, assetItem, assetListIndex) {
|
25170
|
-
var
|
25195
|
+
var _this6 = this;
|
25171
25196
|
this.log("create HLSAssetPlayer for " + eventAssetToString(assetItem));
|
25172
25197
|
var primary = this.hls;
|
25173
25198
|
var userConfig = primary.userConfig;
|
@@ -25234,17 +25259,17 @@
|
|
25234
25259
|
details: ErrorDetails.INTERSTITIAL_ASSET_ITEM_ERROR,
|
25235
25260
|
error: error
|
25236
25261
|
};
|
25237
|
-
|
25262
|
+
_this6.handleAssetItemError(errorData, interstitial, _this6.schedule.findEventIndex(interstitial.identifier), assetListIndex, error.message);
|
25238
25263
|
return;
|
25239
25264
|
}
|
25240
25265
|
// Get time at end of last fragment
|
25241
25266
|
var duration = details.edge - details.fragmentStart;
|
25242
25267
|
var currentAssetDuration = assetItem.duration;
|
25243
25268
|
if (currentAssetDuration === null || duration > currentAssetDuration) {
|
25244
|
-
|
25269
|
+
_this6.log("Interstitial asset \"" + assetId + "\" duration change " + currentAssetDuration + " > " + duration);
|
25245
25270
|
assetItem.duration = duration;
|
25246
25271
|
// Update schedule with new event and asset duration
|
25247
|
-
|
25272
|
+
_this6.updateSchedule();
|
25248
25273
|
}
|
25249
25274
|
};
|
25250
25275
|
player.on(Events.LEVEL_UPDATED, function (event, _ref) {
|
@@ -25256,39 +25281,39 @@
|
|
25256
25281
|
return updateAssetPlayerDetails(details);
|
25257
25282
|
});
|
25258
25283
|
var _onBufferCodecs = function onBufferCodecs(event, data) {
|
25259
|
-
var inQueuPlayer =
|
25284
|
+
var inQueuPlayer = _this6.getAssetPlayer(assetId);
|
25260
25285
|
if (inQueuPlayer && data.tracks) {
|
25261
25286
|
inQueuPlayer.off(Events.BUFFER_CODECS, _onBufferCodecs);
|
25262
25287
|
inQueuPlayer.tracks = data.tracks;
|
25263
|
-
var media =
|
25264
|
-
if (
|
25265
|
-
|
25288
|
+
var media = _this6.primaryMedia;
|
25289
|
+
if (_this6.bufferingAsset === inQueuPlayer.assetItem && media && !inQueuPlayer.media) {
|
25290
|
+
_this6.bufferAssetPlayer(inQueuPlayer, media);
|
25266
25291
|
}
|
25267
25292
|
}
|
25268
25293
|
};
|
25269
25294
|
player.on(Events.BUFFER_CODECS, _onBufferCodecs);
|
25270
25295
|
var _bufferedToEnd = function bufferedToEnd(name) {
|
25271
|
-
var
|
25272
|
-
var inQueuPlayer =
|
25273
|
-
|
25296
|
+
var _this6$schedule$items;
|
25297
|
+
var inQueuPlayer = _this6.getAssetPlayer(assetId);
|
25298
|
+
_this6.log("buffered to end of asset " + inQueuPlayer);
|
25274
25299
|
if (!inQueuPlayer) {
|
25275
25300
|
return;
|
25276
25301
|
}
|
25277
25302
|
inQueuPlayer.off(Events.BUFFERED_TO_END, _bufferedToEnd);
|
25278
25303
|
|
25279
25304
|
// Preload at end of asset
|
25280
|
-
var scheduleIndex =
|
25305
|
+
var scheduleIndex = _this6.schedule.findEventIndex(interstitial.identifier);
|
25281
25306
|
var assetListIndex = interstitial.findAssetIndex(assetItem);
|
25282
25307
|
var nextAssetIndex = assetListIndex + 1;
|
25283
|
-
var item = (
|
25284
|
-
if (
|
25308
|
+
var item = (_this6$schedule$items = _this6.schedule.items) == null ? void 0 : _this6$schedule$items[scheduleIndex];
|
25309
|
+
if (_this6.isInterstitial(item)) {
|
25285
25310
|
if (assetListIndex !== -1 && !interstitial.isAssetPastPlayoutLimit(nextAssetIndex) && !interstitial.assetList[nextAssetIndex].error) {
|
25286
|
-
|
25311
|
+
_this6.bufferedToItem(item, assetListIndex + 1);
|
25287
25312
|
} else {
|
25288
|
-
var
|
25289
|
-
var nextItem = (
|
25313
|
+
var _this6$schedule$items2;
|
25314
|
+
var nextItem = (_this6$schedule$items2 = _this6.schedule.items) == null ? void 0 : _this6$schedule$items2[scheduleIndex + 1];
|
25290
25315
|
if (nextItem) {
|
25291
|
-
|
25316
|
+
_this6.bufferedToItem(nextItem);
|
25292
25317
|
}
|
25293
25318
|
}
|
25294
25319
|
}
|
@@ -25296,22 +25321,22 @@
|
|
25296
25321
|
player.on(Events.BUFFERED_TO_END, _bufferedToEnd);
|
25297
25322
|
var endedWithAssetIndex = function endedWithAssetIndex(assetIndex) {
|
25298
25323
|
return function () {
|
25299
|
-
var inQueuPlayer =
|
25324
|
+
var inQueuPlayer = _this6.getAssetPlayer(assetId);
|
25300
25325
|
if (!inQueuPlayer) {
|
25301
25326
|
return;
|
25302
25327
|
}
|
25303
|
-
|
25304
|
-
var scheduleIndex =
|
25305
|
-
|
25328
|
+
_this6.shouldPlay = true;
|
25329
|
+
var scheduleIndex = _this6.schedule.findEventIndex(interstitial.identifier);
|
25330
|
+
_this6.advanceAfterAssetEnded(interstitial, scheduleIndex, assetIndex);
|
25306
25331
|
};
|
25307
25332
|
};
|
25308
25333
|
player.once(Events.MEDIA_ENDED, endedWithAssetIndex(assetListIndex));
|
25309
25334
|
player.once(Events.PLAYOUT_LIMIT_REACHED, endedWithAssetIndex(Infinity));
|
25310
25335
|
player.on(Events.ERROR, function (event, data) {
|
25311
|
-
|
25336
|
+
_this6.handleAssetItemError(data, interstitial, _this6.schedule.findEventIndex(interstitial.identifier), assetListIndex, "Asset player error " + data.error + " " + interstitial);
|
25312
25337
|
});
|
25313
25338
|
player.on(Events.DESTROYING, function () {
|
25314
|
-
var inQueuPlayer =
|
25339
|
+
var inQueuPlayer = _this6.getAssetPlayer(assetId);
|
25315
25340
|
if (!inQueuPlayer) {
|
25316
25341
|
return;
|
25317
25342
|
}
|
@@ -25322,7 +25347,7 @@
|
|
25322
25347
|
details: ErrorDetails.INTERSTITIAL_ASSET_ITEM_ERROR,
|
25323
25348
|
error: error
|
25324
25349
|
};
|
25325
|
-
|
25350
|
+
_this6.handleAssetItemError(errorData, interstitial, _this6.schedule.findEventIndex(interstitial.identifier), assetListIndex, error.message);
|
25326
25351
|
});
|
25327
25352
|
this.hls.trigger(Events.INTERSTITIAL_ASSET_PLAYER_CREATED, {
|
25328
25353
|
asset: assetItem,
|
@@ -25333,9 +25358,9 @@
|
|
25333
25358
|
return player;
|
25334
25359
|
};
|
25335
25360
|
_proto.clearInterstitial = function clearInterstitial(interstitial, toSegment) {
|
25336
|
-
var
|
25361
|
+
var _this7 = this;
|
25337
25362
|
interstitial.assetList.forEach(function (asset) {
|
25338
|
-
|
25363
|
+
_this7.clearAssetPlayer(asset.identifier, toSegment);
|
25339
25364
|
});
|
25340
25365
|
// Remove asset list and resolved duration
|
25341
25366
|
interstitial.reset();
|
@@ -25383,12 +25408,10 @@
|
|
25383
25408
|
}
|
25384
25409
|
|
25385
25410
|
// detach media and attach to interstitial player if it does not have another element attached
|
25386
|
-
|
25387
|
-
this.bufferAssetPlayer(player, media);
|
25388
|
-
}
|
25411
|
+
this.bufferAssetPlayer(player, media);
|
25389
25412
|
};
|
25390
25413
|
_proto.bufferAssetPlayer = function bufferAssetPlayer(player, media) {
|
25391
|
-
var _this$schedule$items2, _this$
|
25414
|
+
var _this$schedule$items2, _this$detachedData4;
|
25392
25415
|
var interstitial = player.interstitial,
|
25393
25416
|
assetItem = player.assetItem,
|
25394
25417
|
assetId = player.assetId;
|
@@ -25403,8 +25426,13 @@
|
|
25403
25426
|
if (bufferingPlayer === player) {
|
25404
25427
|
return;
|
25405
25428
|
}
|
25406
|
-
var
|
25407
|
-
if (
|
25429
|
+
var appendInPlaceNext = interstitial.appendInPlace;
|
25430
|
+
if (appendInPlaceNext && (bufferingPlayer == null ? void 0 : bufferingPlayer.interstitial.appendInPlace) === false) {
|
25431
|
+
// Media is detached and not available to append in place
|
25432
|
+
return;
|
25433
|
+
}
|
25434
|
+
var activeTracks = (bufferingPlayer == null ? void 0 : bufferingPlayer.tracks) || ((_this$detachedData4 = this.detachedData) == null ? void 0 : _this$detachedData4.tracks) || this.requiredTracks;
|
25435
|
+
if (appendInPlaceNext && assetItem !== this.playingAsset) {
|
25408
25436
|
// Do not buffer another item if tracks are unknown or incompatible
|
25409
25437
|
if (!player.tracks) {
|
25410
25438
|
return;
|
@@ -25478,7 +25506,6 @@
|
|
25478
25506
|
if (playingItem) {
|
25479
25507
|
this.log("Fallback to primary from event \"" + interstitial.identifier + "\" start: " + flushStart + " pos: " + this.timelinePos + " playing: " + (playingItem ? segmentToString(playingItem) : '<none>') + " error: " + interstitial.error);
|
25480
25508
|
if (interstitial.appendInPlace) {
|
25481
|
-
interstitial.appendInPlace = false;
|
25482
25509
|
this.attachPrimary(flushStart, null);
|
25483
25510
|
this.flushFrontBuffer(flushStart);
|
25484
25511
|
}
|
@@ -25490,6 +25517,8 @@
|
|
25490
25517
|
if (!this.itemsMatch(playingItem, newPlayingItem)) {
|
25491
25518
|
var scheduleIndex = this.schedule.findItemIndexAtTime(timelinePos);
|
25492
25519
|
this.setSchedulePosition(scheduleIndex);
|
25520
|
+
} else {
|
25521
|
+
this.clearInterstitial(interstitial, null);
|
25493
25522
|
}
|
25494
25523
|
} else {
|
25495
25524
|
this.checkStart();
|
@@ -25499,7 +25528,7 @@
|
|
25499
25528
|
// Asset List loading
|
25500
25529
|
;
|
25501
25530
|
_proto.onAssetListLoaded = function onAssetListLoaded(event, data) {
|
25502
|
-
var
|
25531
|
+
var _this8 = this,
|
25503
25532
|
_this$bufferingItem;
|
25504
25533
|
var interstitial = data.event;
|
25505
25534
|
var interstitialId = interstitial.identifier;
|
@@ -25512,7 +25541,7 @@
|
|
25512
25541
|
var sumDuration = 0;
|
25513
25542
|
assets.forEach(function (asset, assetListIndex) {
|
25514
25543
|
var duration = parseFloat(asset.DURATION);
|
25515
|
-
|
25544
|
+
_this8.createAsset(interstitial, assetListIndex, sumDuration, eventStart + sumDuration, duration, asset.URI);
|
25516
25545
|
sumDuration += duration;
|
25517
25546
|
});
|
25518
25547
|
interstitial.duration = sumDuration;
|
@@ -25900,8 +25929,8 @@
|
|
25900
25929
|
}, {
|
25901
25930
|
key: "primaryMedia",
|
25902
25931
|
get: function get() {
|
25903
|
-
var _this$
|
25904
|
-
return this.media || ((_this$
|
25932
|
+
var _this$detachedData5;
|
25933
|
+
return this.media || ((_this$detachedData5 = this.detachedData) == null ? void 0 : _this$detachedData5.media) || null;
|
25905
25934
|
}
|
25906
25935
|
}, {
|
25907
25936
|
key: "playbackDisabled",
|
@@ -26251,21 +26280,22 @@
|
|
26251
26280
|
} else {
|
26252
26281
|
foundFrag = fragments[fragLen - 1];
|
26253
26282
|
}
|
26283
|
+
foundFrag = this.filterReplacedPrimary(foundFrag, track.details);
|
26254
26284
|
if (!foundFrag) {
|
26255
26285
|
return;
|
26256
26286
|
}
|
26257
|
-
|
26258
|
-
|
26259
|
-
|
26260
|
-
|
26261
|
-
|
26262
|
-
if (prevFrag && prevFrag.cc === foundFrag.cc && this.fragmentTracker.getState(prevFrag) === FragmentState.NOT_LOADED) {
|
26263
|
-
foundFrag = prevFrag;
|
26264
|
-
}
|
26287
|
+
// Load earlier fragment in same discontinuity to make up for misaligned playlists and cues that extend beyond end of segment
|
26288
|
+
var curSNIdx = foundFrag.sn - trackDetails.startSN;
|
26289
|
+
var prevFrag = fragments[curSNIdx - 1];
|
26290
|
+
if (prevFrag && prevFrag.cc === foundFrag.cc && this.fragmentTracker.getState(prevFrag) === FragmentState.NOT_LOADED) {
|
26291
|
+
foundFrag = prevFrag;
|
26265
26292
|
}
|
26266
26293
|
if (this.fragmentTracker.getState(foundFrag) === FragmentState.NOT_LOADED) {
|
26267
26294
|
// only load if fragment is not loaded
|
26268
|
-
this.
|
26295
|
+
var fragToLoad = this.mapToInitFragWhenRequired(foundFrag);
|
26296
|
+
if (fragToLoad) {
|
26297
|
+
this.loadFragment(fragToLoad, track, targetBufferTime);
|
26298
|
+
}
|
26269
26299
|
}
|
26270
26300
|
}
|
26271
26301
|
};
|