hls.js 1.6.0-beta.2.0.canary.10941 → 1.6.0-beta.2.0.canary.10942
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 -1
- package/dist/hls.d.ts +1 -1
- package/dist/hls.js +68 -45
- package/dist/hls.js.d.ts +1 -1
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +15 -10
- 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 +15 -10
- 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 +68 -45
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +1 -1
- package/src/controller/audio-stream-controller.ts +22 -19
- package/src/controller/base-stream-controller.ts +15 -1
- package/src/controller/gap-controller.ts +5 -2
- package/src/controller/interstitial-player.ts +2 -2
- package/src/controller/interstitials-controller.ts +14 -14
- package/src/controller/interstitials-schedule.ts +11 -5
- package/src/controller/stream-controller.ts +14 -4
package/dist/hls.d.mts
CHANGED
@@ -352,7 +352,7 @@ export declare class BaseStreamController extends TaskLoop implements NetworkCom
|
|
352
352
|
protected bufferFragmentData(data: RemuxedTrack, frag: Fragment, part: Part | null, chunkMeta: ChunkMetadata, noBacktracking?: boolean): void;
|
353
353
|
protected flushBufferGap(frag: Fragment): void;
|
354
354
|
protected getFwdBufferInfo(bufferable: Bufferable | null, type: PlaylistLevelType): BufferInfo | null;
|
355
|
-
|
355
|
+
protected getFwdBufferInfoAtPos(bufferable: Bufferable | null, pos: number, type: PlaylistLevelType, maxBufferHole: number): BufferInfo | null;
|
356
356
|
protected getMaxBufferLength(levelBitrate?: number): number;
|
357
357
|
protected reduceMaxBufferLength(threshold: number, fragDuration: number): boolean;
|
358
358
|
protected getAppendedFrag(position: number, playlistType?: PlaylistLevelType): Fragment | null;
|
package/dist/hls.d.ts
CHANGED
@@ -352,7 +352,7 @@ export declare class BaseStreamController extends TaskLoop implements NetworkCom
|
|
352
352
|
protected bufferFragmentData(data: RemuxedTrack, frag: Fragment, part: Part | null, chunkMeta: ChunkMetadata, noBacktracking?: boolean): void;
|
353
353
|
protected flushBufferGap(frag: Fragment): void;
|
354
354
|
protected getFwdBufferInfo(bufferable: Bufferable | null, type: PlaylistLevelType): BufferInfo | null;
|
355
|
-
|
355
|
+
protected getFwdBufferInfoAtPos(bufferable: Bufferable | null, pos: number, type: PlaylistLevelType, maxBufferHole: number): BufferInfo | null;
|
356
356
|
protected getMaxBufferLength(levelBitrate?: number): number;
|
357
357
|
protected reduceMaxBufferLength(threshold: number, fragDuration: number): boolean;
|
358
358
|
protected getAppendedFrag(position: number, playlistType?: PlaylistLevelType): Fragment | null;
|
package/dist/hls.js
CHANGED
@@ -1059,7 +1059,7 @@
|
|
1059
1059
|
// Some browsers don't allow to use bind on console object anyway
|
1060
1060
|
// fallback to default if needed
|
1061
1061
|
try {
|
1062
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.
|
1062
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.10942");
|
1063
1063
|
} catch (e) {
|
1064
1064
|
/* log fn threw an exception. All logger methods are no-ops. */
|
1065
1065
|
return createLogger();
|
@@ -9099,6 +9099,16 @@
|
|
9099
9099
|
}
|
9100
9100
|
}
|
9101
9101
|
}
|
9102
|
+
// Skip loading of fragments that overlap completely with appendInPlace interstitals
|
9103
|
+
var playerQueue = interstitials == null ? undefined : interstitials.playerQueue;
|
9104
|
+
if (playerQueue) {
|
9105
|
+
for (var i = playerQueue.length; i--;) {
|
9106
|
+
var interstitial = playerQueue[i].interstitial;
|
9107
|
+
if (interstitial.appendInPlace && frag.start >= interstitial.startTime && frag.end <= interstitial.resumeTime) {
|
9108
|
+
return;
|
9109
|
+
}
|
9110
|
+
}
|
9111
|
+
}
|
9102
9112
|
}
|
9103
9113
|
this.startFragRequested = true;
|
9104
9114
|
this._loadFragForPlayback(frag, level, targetBufferTime);
|
@@ -16348,7 +16358,7 @@
|
|
16348
16358
|
return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
|
16349
16359
|
}
|
16350
16360
|
|
16351
|
-
var version = "1.6.0-beta.2.0.canary.
|
16361
|
+
var version = "1.6.0-beta.2.0.canary.10942";
|
16352
16362
|
|
16353
16363
|
// ensure the worker ends up in the bundle
|
16354
16364
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -17011,23 +17021,27 @@
|
|
17011
17021
|
}
|
17012
17022
|
|
17013
17023
|
// Request audio segments up to one fragment ahead of main stream-controller
|
17014
|
-
var mainFragLoading = (_this$mainFragLoading = this.mainFragLoading) == null ? undefined : _this$mainFragLoading.frag;
|
17015
|
-
if (!this.audioOnly && this.startFragRequested && mainFragLoading && isMediaFragment(
|
17016
|
-
|
17017
|
-
|
17018
|
-
|
17019
|
-
|
17020
|
-
if (
|
17021
|
-
|
17022
|
-
this.
|
17023
|
-
|
17024
|
-
|
17025
|
-
|
17024
|
+
var mainFragLoading = ((_this$mainFragLoading = this.mainFragLoading) == null ? undefined : _this$mainFragLoading.frag) || null;
|
17025
|
+
if (!this.audioOnly && this.startFragRequested && mainFragLoading && isMediaFragment(frag) && !frag.endList && (!trackDetails.live || !this.loadingParts && targetBufferTime < this.hls.liveSyncPosition)) {
|
17026
|
+
if (this.fragmentTracker.getState(mainFragLoading) === FragmentState.OK) {
|
17027
|
+
this.mainFragLoading = mainFragLoading = null;
|
17028
|
+
}
|
17029
|
+
if (mainFragLoading && isMediaFragment(mainFragLoading)) {
|
17030
|
+
if (frag.start > mainFragLoading.end) {
|
17031
|
+
// Get buffered frag at target position from tracker (loaded out of sequence)
|
17032
|
+
var mainFragAtPos = this.fragmentTracker.getFragAtPos(targetBufferTime, PlaylistLevelType.MAIN);
|
17033
|
+
if (mainFragAtPos && mainFragAtPos.end > mainFragLoading.end) {
|
17034
|
+
mainFragLoading = mainFragAtPos;
|
17035
|
+
this.mainFragLoading = {
|
17036
|
+
frag: mainFragAtPos,
|
17037
|
+
targetBufferTime: null
|
17038
|
+
};
|
17039
|
+
}
|
17040
|
+
}
|
17041
|
+
var atBufferSyncLimit = frag.start > mainFragLoading.end;
|
17042
|
+
if (atBufferSyncLimit) {
|
17043
|
+
return;
|
17026
17044
|
}
|
17027
|
-
}
|
17028
|
-
var atBufferSyncLimit = frag.start > mainFrag.end;
|
17029
|
-
if (atBufferSyncLimit) {
|
17030
|
-
return;
|
17031
17045
|
}
|
17032
17046
|
}
|
17033
17047
|
this.loadFragment(frag, levelInfo, targetBufferTime);
|
@@ -23183,7 +23197,8 @@
|
|
23183
23197
|
}, {
|
23184
23198
|
key: "media",
|
23185
23199
|
get: function get() {
|
23186
|
-
|
23200
|
+
var _this$hls2;
|
23201
|
+
return ((_this$hls2 = this.hls) == null ? undefined : _this$hls2.media) || null;
|
23187
23202
|
}
|
23188
23203
|
}, {
|
23189
23204
|
key: "bufferedEnd",
|
@@ -23226,7 +23241,8 @@
|
|
23226
23241
|
}, {
|
23227
23242
|
key: "timelineOffset",
|
23228
23243
|
get: function get() {
|
23229
|
-
|
23244
|
+
var _this$hls3;
|
23245
|
+
return ((_this$hls3 = this.hls) == null ? undefined : _this$hls3.config.timelineOffset) || 0;
|
23230
23246
|
},
|
23231
23247
|
set: function set(value) {
|
23232
23248
|
var timelineOffset = this.timelineOffset;
|
@@ -23306,6 +23322,8 @@
|
|
23306
23322
|
// Only return index of a Primary Item
|
23307
23323
|
while (index >= 0 && (_items$index = items[index]) != null && _items$index.event) {
|
23308
23324
|
var _items$index;
|
23325
|
+
// If index found is an interstitial it is not a valid result as it should have been matched up top
|
23326
|
+
// decrement until result is negative (not found) or a primary segment
|
23309
23327
|
index--;
|
23310
23328
|
}
|
23311
23329
|
}
|
@@ -23684,12 +23702,16 @@
|
|
23684
23702
|
this.log("\"" + interstitial.identifier + "\" resumption " + resumeTime + " can not be aligned with media (none selected)");
|
23685
23703
|
return false;
|
23686
23704
|
}
|
23687
|
-
|
23705
|
+
var playlists = Object.keys(mediaSelection);
|
23706
|
+
return !playlists.some(function (playlistType) {
|
23688
23707
|
var details = mediaSelection[playlistType].details;
|
23689
23708
|
var playlistEnd = details.edge;
|
23690
23709
|
if (resumeTime > playlistEnd) {
|
23691
|
-
|
23692
|
-
|
23710
|
+
if (playlists.length > 1) {
|
23711
|
+
_this4.log("\"" + interstitial.identifier + "\" resumption " + resumeTime + " past " + playlistType + " playlist end " + playlistEnd);
|
23712
|
+
return true;
|
23713
|
+
}
|
23714
|
+
return false;
|
23693
23715
|
}
|
23694
23716
|
var startFragment = findFragmentByPTS(null, details.fragments, resumeTime);
|
23695
23717
|
if (!startFragment) {
|
@@ -24244,6 +24266,7 @@
|
|
24244
24266
|
var appendInPlace = player.interstitial.appendInPlace;
|
24245
24267
|
var playerMedia = player.media;
|
24246
24268
|
if (appendInPlace && playerMedia === this.primaryMedia) {
|
24269
|
+
this.bufferingAsset = null;
|
24247
24270
|
if (!toSegment || this.isInterstitial(toSegment) && !toSegment.event.appendInPlace) {
|
24248
24271
|
// MediaSource cannot be transfered back to an Interstitial that requires a source reset
|
24249
24272
|
// no-op when toSegment is undefined
|
@@ -24251,12 +24274,11 @@
|
|
24251
24274
|
this.detachedData = {
|
24252
24275
|
media: playerMedia
|
24253
24276
|
};
|
24277
|
+
return;
|
24254
24278
|
}
|
24255
|
-
return;
|
24256
24279
|
}
|
24257
24280
|
var attachMediaSourceData = player.transferMedia();
|
24258
24281
|
this.log("transfer MediaSource from " + player + " " + JSON.stringify(attachMediaSourceData));
|
24259
|
-
this.bufferingAsset = null;
|
24260
24282
|
this.detachedData = attachMediaSourceData;
|
24261
24283
|
} else if (toSegment && playerMedia) {
|
24262
24284
|
this.shouldPlay || (this.shouldPlay = !playerMedia.paused);
|
@@ -24305,7 +24327,7 @@
|
|
24305
24327
|
dataToAttach.overrides = {
|
24306
24328
|
duration: this.schedule.duration,
|
24307
24329
|
endOfStream: !isAssetPlayer || isAssetAtEndOfSchedule,
|
24308
|
-
cueRemoval:
|
24330
|
+
cueRemoval: !isAssetPlayer
|
24309
24331
|
};
|
24310
24332
|
}
|
24311
24333
|
player.attachMedia(dataToAttach);
|
@@ -24698,7 +24720,7 @@
|
|
24698
24720
|
if (playingItem && !this.itemsMatch(playingItem, this.bufferingItem) && !this.isInterstitial(playingItem)) {
|
24699
24721
|
var timelinePos = this.timelinePos;
|
24700
24722
|
this.bufferedPos = timelinePos;
|
24701
|
-
this.
|
24723
|
+
this.checkBuffer();
|
24702
24724
|
}
|
24703
24725
|
};
|
24704
24726
|
_proto.onBufferedToEnd = function onBufferedToEnd(event) {
|
@@ -24737,8 +24759,7 @@
|
|
24737
24759
|
return null;
|
24738
24760
|
};
|
24739
24761
|
_proto.itemsMatch = function itemsMatch(a, b) {
|
24740
|
-
|
24741
|
-
return !!b && (a === b || a.event && b.event && this.eventItemsMatch(a, b) || !a.event && !b.event && ((_a$nextEvent = a.nextEvent) == null ? undefined : _a$nextEvent.identifier) === ((_b$nextEvent = b.nextEvent) == null ? undefined : _b$nextEvent.identifier));
|
24762
|
+
return !!b && (a === b || a.event && b.event && this.eventItemsMatch(a, b) || !a.event && !b.event && this.findItemIndex(a) === this.findItemIndex(b));
|
24742
24763
|
};
|
24743
24764
|
_proto.eventItemsMatch = function eventItemsMatch(a, b) {
|
24744
24765
|
var _b$event;
|
@@ -24780,11 +24801,11 @@
|
|
24780
24801
|
var playingIndex = this.findItemIndex(playingItem);
|
24781
24802
|
var bufferEndIndex = schedule.findItemIndexAtTime(bufferEnd);
|
24782
24803
|
if (this.bufferedPos < bufferEnd) {
|
24783
|
-
var _bufferingItem$event;
|
24804
|
+
var _nextItemToBuffer$eve, _bufferingItem$event;
|
24784
24805
|
var bufferingIndex = this.findItemIndex(bufferingItem);
|
24785
24806
|
var nextToBufferIndex = Math.min(bufferingIndex + 1, items.length - 1);
|
24786
24807
|
var nextItemToBuffer = items[nextToBufferIndex];
|
24787
|
-
if (bufferEndIndex === -1 && bufferingItem && bufferEnd >= bufferingItem.end) {
|
24808
|
+
if (bufferEndIndex === -1 && bufferingItem && bufferEnd >= bufferingItem.end || (_nextItemToBuffer$eve = nextItemToBuffer.event) != null && _nextItemToBuffer$eve.appendInPlace && bufferEnd + 0.01 >= nextItemToBuffer.start) {
|
24788
24809
|
bufferEndIndex = nextToBufferIndex;
|
24789
24810
|
}
|
24790
24811
|
if (nextToBufferIndex - playingIndex > 1 && (bufferingItem == null ? undefined : (_bufferingItem$event = bufferingItem.event) == null ? undefined : _bufferingItem$event.appendInPlace) === false) {
|
@@ -25161,9 +25182,6 @@
|
|
25161
25182
|
interstitial.appendInPlaceStarted = false;
|
25162
25183
|
};
|
25163
25184
|
_proto.clearAssetPlayer = function clearAssetPlayer(assetId, toSegment) {
|
25164
|
-
if (toSegment === null) {
|
25165
|
-
return;
|
25166
|
-
}
|
25167
25185
|
var playerIndex = this.getAssetPlayerQueueIndex(assetId);
|
25168
25186
|
if (playerIndex !== -1) {
|
25169
25187
|
this.log("clearAssetPlayer \"" + assetId + "\" toSegment: " + (toSegment ? segmentToString(toSegment) : toSegment));
|
@@ -25631,11 +25649,11 @@
|
|
25631
25649
|
get: function get() {
|
25632
25650
|
var _this$schedule;
|
25633
25651
|
var playingItem = this.playingItem;
|
25634
|
-
|
25652
|
+
var items = (_this$schedule = this.schedule) == null ? undefined : _this$schedule.items;
|
25653
|
+
if (!this.playbackStarted || !playingItem || !items) {
|
25635
25654
|
return false;
|
25636
25655
|
}
|
25637
|
-
|
25638
|
-
return this.itemsMatch(playingItem, items ? items[items.length - 1] : null);
|
25656
|
+
return this.findItemIndex(playingItem) === items.length - 1;
|
25639
25657
|
}
|
25640
25658
|
}, {
|
25641
25659
|
key: "playbackStarted",
|
@@ -30955,7 +30973,7 @@
|
|
30955
30973
|
* @private
|
30956
30974
|
*/;
|
30957
30975
|
_proto._tryFixBufferStall = function _tryFixBufferStall(bufferInfo, stalledDurationMs) {
|
30958
|
-
var _this$hls3;
|
30976
|
+
var _this$hls3, _this$hls4;
|
30959
30977
|
var fragmentTracker = this.fragmentTracker,
|
30960
30978
|
media = this.media;
|
30961
30979
|
var config = (_this$hls3 = this.hls) == null ? undefined : _this$hls3.config;
|
@@ -30963,8 +30981,9 @@
|
|
30963
30981
|
return;
|
30964
30982
|
}
|
30965
30983
|
var currentTime = media.currentTime;
|
30984
|
+
var levelDetails = (_this$hls4 = this.hls) == null ? undefined : _this$hls4.latestLevelDetails;
|
30966
30985
|
var partial = fragmentTracker.getPartialFragment(currentTime);
|
30967
|
-
if (partial) {
|
30986
|
+
if (partial || levelDetails != null && levelDetails.live && currentTime < levelDetails.fragmentStart) {
|
30968
30987
|
// Try to skip over the buffer hole caused by a partial fragment
|
30969
30988
|
// This method isn't limited by the size of the gap between buffered ranges
|
30970
30989
|
var targetTime = this._trySkipBufferHole(partial);
|
@@ -31023,10 +31042,10 @@
|
|
31023
31042
|
* @private
|
31024
31043
|
*/;
|
31025
31044
|
_proto._trySkipBufferHole = function _trySkipBufferHole(partial) {
|
31026
|
-
var _this$
|
31045
|
+
var _this$hls5;
|
31027
31046
|
var fragmentTracker = this.fragmentTracker,
|
31028
31047
|
media = this.media;
|
31029
|
-
var config = (_this$
|
31048
|
+
var config = (_this$hls5 = this.hls) == null ? undefined : _this$hls5.config;
|
31030
31049
|
if (!media || !fragmentTracker || !config) {
|
31031
31050
|
return 0;
|
31032
31051
|
}
|
@@ -32415,14 +32434,18 @@
|
|
32415
32434
|
_this.onMediaSeeked = function () {
|
32416
32435
|
var media = _this.media;
|
32417
32436
|
var currentTime = media ? media.currentTime : null;
|
32418
|
-
if (isFiniteNumber(currentTime)) {
|
32419
|
-
|
32437
|
+
if (currentTime === null || !isFiniteNumber(currentTime)) {
|
32438
|
+
return;
|
32420
32439
|
}
|
32440
|
+
_this.log("Media seeked to " + currentTime.toFixed(3));
|
32421
32441
|
|
32422
32442
|
// If seeked was issued before buffer was appended do not tick immediately
|
32423
|
-
|
32443
|
+
if (!_this.getBufferedFrag(currentTime)) {
|
32444
|
+
return;
|
32445
|
+
}
|
32446
|
+
var bufferInfo = _this.getFwdBufferInfoAtPos(media, currentTime, PlaylistLevelType.MAIN, 0);
|
32424
32447
|
if (bufferInfo === null || bufferInfo.len === 0) {
|
32425
|
-
_this.warn("Main forward buffer length on \"seeked\" event " + (bufferInfo ? bufferInfo.len : 'empty') + ")");
|
32448
|
+
_this.warn("Main forward buffer length at " + currentTime + " on \"seeked\" event " + (bufferInfo ? bufferInfo.len : 'empty') + ")");
|
32426
32449
|
return;
|
32427
32450
|
}
|
32428
32451
|
|
package/dist/hls.js.d.ts
CHANGED
@@ -352,7 +352,7 @@ export declare class BaseStreamController extends TaskLoop implements NetworkCom
|
|
352
352
|
protected bufferFragmentData(data: RemuxedTrack, frag: Fragment, part: Part | null, chunkMeta: ChunkMetadata, noBacktracking?: boolean): void;
|
353
353
|
protected flushBufferGap(frag: Fragment): void;
|
354
354
|
protected getFwdBufferInfo(bufferable: Bufferable | null, type: PlaylistLevelType): BufferInfo | null;
|
355
|
-
|
355
|
+
protected getFwdBufferInfoAtPos(bufferable: Bufferable | null, pos: number, type: PlaylistLevelType, maxBufferHole: number): BufferInfo | null;
|
356
356
|
protected getMaxBufferLength(levelBitrate?: number): number;
|
357
357
|
protected reduceMaxBufferLength(threshold: number, fragDuration: number): boolean;
|
358
358
|
protected getAppendedFrag(position: number, playlistType?: PlaylistLevelType): Fragment | null;
|