hls.js 1.6.0-rc.2 → 1.6.0-rc.2.0.canary.11083
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 +1 -0
- package/dist/hls.d.ts +1 -0
- package/dist/hls.js +85 -42
- package/dist/hls.js.d.ts +1 -0
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +32 -25
- 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 +34 -27
- 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 +86 -43
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/dist/hls.worker.js.map +1 -1
- package/package.json +1 -1
- package/src/controller/abr-controller.ts +10 -5
- package/src/controller/base-stream-controller.ts +8 -1
- package/src/controller/interstitials-controller.ts +61 -17
- package/src/controller/interstitials-schedule.ts +1 -1
- package/src/exports-named.ts +2 -0
- package/src/utils/mp4-tools.ts +13 -15
package/dist/hls.d.mts
CHANGED
@@ -19,6 +19,7 @@ export declare class AbrController extends Logger implements AbrComponentAPI {
|
|
19
19
|
private fragCurrent;
|
20
20
|
private partCurrent;
|
21
21
|
private bitrateTestDelay;
|
22
|
+
private rebufferNotice;
|
22
23
|
bwEstimator: EwmaBandWidthEstimator;
|
23
24
|
constructor(hls: Hls);
|
24
25
|
resetEstimator(abrEwmaDefaultEstimate?: number): void;
|
package/dist/hls.d.ts
CHANGED
@@ -19,6 +19,7 @@ export declare class AbrController extends Logger implements AbrComponentAPI {
|
|
19
19
|
private fragCurrent;
|
20
20
|
private partCurrent;
|
21
21
|
private bitrateTestDelay;
|
22
|
+
private rebufferNotice;
|
22
23
|
bwEstimator: EwmaBandWidthEstimator;
|
23
24
|
constructor(hls: Hls);
|
24
25
|
resetEstimator(abrEwmaDefaultEstimate?: number): void;
|
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-rc.2");
|
1076
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-rc.2.0.canary.11083");
|
1077
1077
|
} catch (e) {
|
1078
1078
|
/* log fn threw an exception. All logger methods are no-ops. */
|
1079
1079
|
return createLogger();
|
@@ -1843,29 +1843,27 @@
|
|
1843
1843
|
soun: ElementaryStreamTypes.AUDIO,
|
1844
1844
|
vide: ElementaryStreamTypes.VIDEO
|
1845
1845
|
}[hdlrType];
|
1846
|
+
// Parse codec details
|
1847
|
+
var stsdBox = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];
|
1848
|
+
var stsd = parseStsd(stsdBox);
|
1846
1849
|
if (type) {
|
1847
|
-
//
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
timescale: timescale,
|
1865
|
-
type: hdlrType,
|
1866
|
-
stsd: stsd
|
1867
|
-
};
|
1868
|
-
}
|
1850
|
+
// Add 'audio', 'video', and 'audiovideo' track records that will map to SourceBuffers
|
1851
|
+
result[trackId] = {
|
1852
|
+
timescale: timescale,
|
1853
|
+
type: type,
|
1854
|
+
stsd: stsd
|
1855
|
+
};
|
1856
|
+
result[type] = _objectSpread2({
|
1857
|
+
timescale: timescale,
|
1858
|
+
id: trackId
|
1859
|
+
}, stsd);
|
1860
|
+
} else {
|
1861
|
+
// Add 'meta' and other track records required by `offsetStartDTS`
|
1862
|
+
result[trackId] = {
|
1863
|
+
timescale: timescale,
|
1864
|
+
type: hdlrType,
|
1865
|
+
stsd: stsd
|
1866
|
+
};
|
1869
1867
|
}
|
1870
1868
|
}
|
1871
1869
|
}
|
@@ -3901,6 +3899,7 @@
|
|
3901
3899
|
_this.fragCurrent = null;
|
3902
3900
|
_this.partCurrent = null;
|
3903
3901
|
_this.bitrateTestDelay = 0;
|
3902
|
+
_this.rebufferNotice = -1;
|
3904
3903
|
_this.bwEstimator = void 0;
|
3905
3904
|
/*
|
3906
3905
|
This method monitors the download rate of the current fragment, and will downswitch if that fragment will not load
|
@@ -4291,6 +4290,7 @@
|
|
4291
4290
|
if (bufferStarvationDelay) {
|
4292
4291
|
var _bestLevel = this.findBestLevel(avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay, 0, bwFactor, bwUpFactor);
|
4293
4292
|
if (_bestLevel >= 0) {
|
4293
|
+
this.rebufferNotice = -1;
|
4294
4294
|
return _bestLevel;
|
4295
4295
|
}
|
4296
4296
|
}
|
@@ -4313,7 +4313,10 @@
|
|
4313
4313
|
}
|
4314
4314
|
}
|
4315
4315
|
var bestLevel = this.findBestLevel(avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay, maxStarvationDelay, bwFactor, bwUpFactor);
|
4316
|
-
this.
|
4316
|
+
if (this.rebufferNotice !== bestLevel) {
|
4317
|
+
this.rebufferNotice = bestLevel;
|
4318
|
+
this.info((bufferStarvationDelay ? 'rebuffering expected' : 'buffer is empty') + ", optimal quality level " + bestLevel);
|
4319
|
+
}
|
4317
4320
|
if (bestLevel > -1) {
|
4318
4321
|
return bestLevel;
|
4319
4322
|
}
|
@@ -9889,6 +9892,10 @@
|
|
9889
9892
|
frag = this.getFragmentAtPosition(pos, end, levelDetails);
|
9890
9893
|
}
|
9891
9894
|
var programFrag = this.filterReplacedPrimary(frag, levelDetails);
|
9895
|
+
if (!programFrag && frag) {
|
9896
|
+
var curSNIdx = frag.sn - levelDetails.startSN;
|
9897
|
+
programFrag = this.filterReplacedPrimary(fragments[curSNIdx + 1] || null, levelDetails);
|
9898
|
+
}
|
9892
9899
|
return this.mapToInitFragWhenRequired(programFrag);
|
9893
9900
|
};
|
9894
9901
|
_proto.isLoopLoading = function isLoopLoading(frag, targetBufferTime) {
|
@@ -16588,7 +16595,7 @@
|
|
16588
16595
|
return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
|
16589
16596
|
}
|
16590
16597
|
|
16591
|
-
var version = "1.6.0-rc.2";
|
16598
|
+
var version = "1.6.0-rc.2.0.canary.11083";
|
16592
16599
|
|
16593
16600
|
// ensure the worker ends up in the bundle
|
16594
16601
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -24082,7 +24089,7 @@
|
|
24082
24089
|
return !playlists.some(function (playlistType) {
|
24083
24090
|
var details = mediaSelection[playlistType].details;
|
24084
24091
|
var playlistEnd = details.edge;
|
24085
|
-
if (resumeTime
|
24092
|
+
if (resumeTime >= playlistEnd) {
|
24086
24093
|
// Live playback - resumption segments are not yet available
|
24087
24094
|
_this4.log("\"" + interstitial.identifier + "\" resumption " + resumeTime + " past " + playlistType + " playlist end " + playlistEnd);
|
24088
24095
|
// Assume alignment is possible (or reset can take place)
|
@@ -25189,14 +25196,18 @@
|
|
25189
25196
|
|
25190
25197
|
// Schedule buffer control
|
25191
25198
|
;
|
25192
|
-
_proto.checkBuffer = function checkBuffer() {
|
25199
|
+
_proto.checkBuffer = function checkBuffer(starved) {
|
25193
25200
|
var items = this.schedule.items;
|
25194
25201
|
if (!items) {
|
25195
25202
|
return;
|
25196
25203
|
}
|
25197
25204
|
// Find when combined forward buffer change reaches next schedule segment
|
25198
25205
|
var bufferInfo = BufferHelper.bufferInfo(this.primaryMedia, this.timelinePos, 0);
|
25199
|
-
|
25206
|
+
if (starved) {
|
25207
|
+
this.bufferedPos = this.timelinePos;
|
25208
|
+
}
|
25209
|
+
starved || (starved = bufferInfo.len < 1);
|
25210
|
+
this.updateBufferedPos(bufferInfo.end, items, starved);
|
25200
25211
|
};
|
25201
25212
|
_proto.updateBufferedPos = function updateBufferedPos(bufferEnd, items, bufferIsEmpty) {
|
25202
25213
|
var schedule = this.schedule;
|
@@ -25233,8 +25244,12 @@
|
|
25233
25244
|
this.preloadAssets(nextItemToBuffer.event, 0);
|
25234
25245
|
}
|
25235
25246
|
}
|
25236
|
-
} else if (bufferIsEmpty && playingItem && !this.itemsMatch(playingItem, bufferingItem)
|
25237
|
-
|
25247
|
+
} else if (bufferIsEmpty && playingItem && !this.itemsMatch(playingItem, bufferingItem)) {
|
25248
|
+
if (bufferEndIndex === playingIndex) {
|
25249
|
+
this.bufferedToItem(playingItem);
|
25250
|
+
} else if (bufferEndIndex === playingIndex + 1) {
|
25251
|
+
this.bufferedToItem(items[bufferEndIndex]);
|
25252
|
+
}
|
25238
25253
|
}
|
25239
25254
|
};
|
25240
25255
|
_proto.assetsBuffered = function assetsBuffered(item, media) {
|
@@ -25349,7 +25364,11 @@
|
|
25349
25364
|
if (neverLoaded) {
|
25350
25365
|
var timelineStart = interstitial.timelineStart;
|
25351
25366
|
if (interstitial.appendInPlace) {
|
25352
|
-
|
25367
|
+
var _playingItem$nextEven;
|
25368
|
+
var playingItem = this.playingItem;
|
25369
|
+
if (!this.isInterstitial(playingItem) && (playingItem == null ? void 0 : (_playingItem$nextEven = playingItem.nextEvent) == null ? void 0 : _playingItem$nextEven.identifier) === interstitial.identifier) {
|
25370
|
+
this.flushFrontBuffer(timelineStart + 0.25);
|
25371
|
+
}
|
25353
25372
|
}
|
25354
25373
|
var hlsStartOffset;
|
25355
25374
|
var liveStartPosition = 0;
|
@@ -25393,6 +25412,7 @@
|
|
25393
25412
|
if (!requiredTracks) {
|
25394
25413
|
return;
|
25395
25414
|
}
|
25415
|
+
this.log("Removing front buffer starting at " + startOffset);
|
25396
25416
|
var sourceBufferNames = Object.keys(requiredTracks);
|
25397
25417
|
sourceBufferNames.forEach(function (type) {
|
25398
25418
|
_this6.hls.trigger(Events.BUFFER_FLUSHING, {
|
@@ -25469,11 +25489,12 @@
|
|
25469
25489
|
}
|
25470
25490
|
}
|
25471
25491
|
}
|
25492
|
+
var assetId = assetItem.identifier;
|
25472
25493
|
var playerConfig = _objectSpread2(_objectSpread2({}, userConfig), {}, {
|
25473
25494
|
autoStartLoad: true,
|
25474
25495
|
startFragPrefetch: true,
|
25475
25496
|
primarySessionId: primary.sessionId,
|
25476
|
-
assetPlayerId:
|
25497
|
+
assetPlayerId: assetId,
|
25477
25498
|
abrEwmaDefaultEstimate: primary.bandwidthEstimate,
|
25478
25499
|
interstitialsController: undefined,
|
25479
25500
|
startPosition: startPosition,
|
@@ -25495,10 +25516,12 @@
|
|
25495
25516
|
contentId: hash(assetItem.uri)
|
25496
25517
|
});
|
25497
25518
|
}
|
25519
|
+
if (this.getAssetPlayer(assetId)) {
|
25520
|
+
this.warn("Duplicate date range identifier " + interstitial + " and asset " + assetId);
|
25521
|
+
}
|
25498
25522
|
var player = new HlsAssetPlayer(this.HlsPlayerClass, playerConfig, interstitial, assetItem);
|
25499
25523
|
this.playerQueue.push(player);
|
25500
25524
|
interstitial.assetList[assetListIndex] = assetItem;
|
25501
|
-
var assetId = assetItem.identifier;
|
25502
25525
|
// Listen for LevelDetails and PTS change to update duration
|
25503
25526
|
var updateAssetPlayerDetails = function updateAssetPlayerDetails(details) {
|
25504
25527
|
if (details.live) {
|
@@ -25542,15 +25565,13 @@
|
|
25542
25565
|
}
|
25543
25566
|
};
|
25544
25567
|
player.on(Events.BUFFER_CODECS, _onBufferCodecs);
|
25545
|
-
var
|
25568
|
+
var bufferedToEnd = function bufferedToEnd() {
|
25546
25569
|
var _this7$schedule$items;
|
25547
25570
|
var inQueuPlayer = _this7.getAssetPlayer(assetId);
|
25548
25571
|
_this7.log("buffered to end of asset " + inQueuPlayer);
|
25549
25572
|
if (!inQueuPlayer) {
|
25550
25573
|
return;
|
25551
25574
|
}
|
25552
|
-
inQueuPlayer.off(Events.BUFFERED_TO_END, _bufferedToEnd);
|
25553
|
-
|
25554
25575
|
// Preload at end of asset
|
25555
25576
|
var scheduleIndex = _this7.schedule.findEventIndex(interstitial.identifier);
|
25556
25577
|
var assetListIndex = interstitial.findAssetIndex(assetItem);
|
@@ -25558,7 +25579,7 @@
|
|
25558
25579
|
var item = (_this7$schedule$items = _this7.schedule.items) == null ? void 0 : _this7$schedule$items[scheduleIndex];
|
25559
25580
|
if (_this7.isInterstitial(item)) {
|
25560
25581
|
if (assetListIndex !== -1 && !interstitial.isAssetPastPlayoutLimit(nextAssetIndex) && !interstitial.assetList[nextAssetIndex].error) {
|
25561
|
-
_this7.bufferedToItem(item,
|
25582
|
+
_this7.bufferedToItem(item, nextAssetIndex);
|
25562
25583
|
} else {
|
25563
25584
|
var _this7$schedule$items2;
|
25564
25585
|
var nextItem = (_this7$schedule$items2 = _this7.schedule.items) == null ? void 0 : _this7$schedule$items2[scheduleIndex + 1];
|
@@ -25568,7 +25589,7 @@
|
|
25568
25589
|
}
|
25569
25590
|
}
|
25570
25591
|
};
|
25571
|
-
player.on(Events.BUFFERED_TO_END,
|
25592
|
+
player.on(Events.BUFFERED_TO_END, bufferedToEnd);
|
25572
25593
|
var endedWithAssetIndex = function endedWithAssetIndex(assetIndex) {
|
25573
25594
|
return function () {
|
25574
25595
|
var inQueuPlayer = _this7.getAssetPlayer(assetId);
|
@@ -25583,6 +25604,22 @@
|
|
25583
25604
|
player.once(Events.MEDIA_ENDED, endedWithAssetIndex(assetListIndex));
|
25584
25605
|
player.once(Events.PLAYOUT_LIMIT_REACHED, endedWithAssetIndex(Infinity));
|
25585
25606
|
player.on(Events.ERROR, function (event, data) {
|
25607
|
+
var inQueuPlayer = _this7.getAssetPlayer(assetId);
|
25608
|
+
if (data.details === ErrorDetails.BUFFER_STALLED_ERROR) {
|
25609
|
+
if (inQueuPlayer != null && inQueuPlayer.media) {
|
25610
|
+
var assetCurrentTime = inQueuPlayer.currentTime;
|
25611
|
+
var distanceFromEnd = inQueuPlayer.duration - assetCurrentTime;
|
25612
|
+
if (assetCurrentTime && interstitial.appendInPlace && distanceFromEnd / inQueuPlayer.media.playbackRate < 0.5) {
|
25613
|
+
_this7.log("Advancing buffer past end of asset " + assetId + " " + interstitial + " at " + inQueuPlayer.media.currentTime);
|
25614
|
+
bufferedToEnd();
|
25615
|
+
} else {
|
25616
|
+
_this7.warn("Stalled at " + assetCurrentTime + " of " + (assetCurrentTime + distanceFromEnd) + " in asset " + assetId + " " + interstitial);
|
25617
|
+
_this7.onTimeupdate();
|
25618
|
+
_this7.checkBuffer(true);
|
25619
|
+
}
|
25620
|
+
}
|
25621
|
+
return;
|
25622
|
+
}
|
25586
25623
|
_this7.handleAssetItemError(data, interstitial, _this7.schedule.findEventIndex(interstitial.identifier), assetListIndex, "Asset player error " + data.error + " " + interstitial);
|
25587
25624
|
});
|
25588
25625
|
player.on(Events.DESTROYING, function () {
|
@@ -25656,10 +25693,9 @@
|
|
25656
25693
|
player: player
|
25657
25694
|
});
|
25658
25695
|
}
|
25659
|
-
|
25660
|
-
|
25661
|
-
|
25662
|
-
}
|
25696
|
+
|
25697
|
+
// detach media and attach to interstitial player if it does not have another element attached
|
25698
|
+
this.bufferAssetPlayer(player, media);
|
25663
25699
|
};
|
25664
25700
|
_proto.bufferAssetPlayer = function bufferAssetPlayer(player, media) {
|
25665
25701
|
var _this$schedule$items2, _this$detachedData4;
|
@@ -25844,6 +25880,13 @@
|
|
25844
25880
|
if (interstitial) {
|
25845
25881
|
this.primaryFallback(interstitial);
|
25846
25882
|
}
|
25883
|
+
break;
|
25884
|
+
}
|
25885
|
+
case ErrorDetails.BUFFER_STALLED_ERROR:
|
25886
|
+
{
|
25887
|
+
this.onTimeupdate();
|
25888
|
+
this.checkBuffer(true);
|
25889
|
+
break;
|
25847
25890
|
}
|
25848
25891
|
}
|
25849
25892
|
};
|
package/dist/hls.js.d.ts
CHANGED
@@ -19,6 +19,7 @@ export declare class AbrController extends Logger implements AbrComponentAPI {
|
|
19
19
|
private fragCurrent;
|
20
20
|
private partCurrent;
|
21
21
|
private bitrateTestDelay;
|
22
|
+
private rebufferNotice;
|
22
23
|
bwEstimator: EwmaBandWidthEstimator;
|
23
24
|
constructor(hls: Hls);
|
24
25
|
resetEstimator(abrEwmaDefaultEstimate?: number): void;
|