hls.js 1.6.1-0.canary.11106 → 1.6.1-0.canary.11108
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 +68 -53
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +68 -53
- 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 +51 -37
- 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 +51 -37
- 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/buffer-controller.ts +19 -8
- package/src/utils/mp4-tools.ts +71 -65
package/dist/hls.light.js
CHANGED
@@ -1165,7 +1165,7 @@
|
|
1165
1165
|
// Some browsers don't allow to use bind on console object anyway
|
1166
1166
|
// fallback to default if needed
|
1167
1167
|
try {
|
1168
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.1-0.canary.
|
1168
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.1-0.canary.11108");
|
1169
1169
|
} catch (e) {
|
1170
1170
|
/* log fn threw an exception. All logger methods are no-ops. */
|
1171
1171
|
return createLogger();
|
@@ -2001,8 +2001,10 @@
|
|
2001
2001
|
{
|
2002
2002
|
// extract profile + compatibility + level out of avcC box
|
2003
2003
|
var avcCBox = findBox(sampleEntriesEnd, ['avcC'])[0];
|
2004
|
-
|
2005
|
-
|
2004
|
+
if (avcCBox && avcCBox.length > 3) {
|
2005
|
+
codec += '.' + toHex(avcCBox[1]) + toHex(avcCBox[2]) + toHex(avcCBox[3]);
|
2006
|
+
supplemental = parseSupplementalDoViCodec(codecFourCC === 'avc1' ? 'dva1' : 'dvav', sampleEntriesEnd);
|
2007
|
+
}
|
2006
2008
|
break;
|
2007
2009
|
}
|
2008
2010
|
case 'mp4a':
|
@@ -2053,9 +2055,8 @@
|
|
2053
2055
|
case 'hvc1':
|
2054
2056
|
case 'hev1':
|
2055
2057
|
{
|
2056
|
-
var
|
2057
|
-
if (
|
2058
|
-
var hvcCBox = hvcCBoxes[0];
|
2058
|
+
var hvcCBox = findBox(sampleEntriesEnd, ['hvcC'])[0];
|
2059
|
+
if (hvcCBox && hvcCBox.length > 12) {
|
2059
2060
|
var profileByte = hvcCBox[1];
|
2060
2061
|
var profileSpace = ['', 'A', 'B', 'C'][profileByte >> 6];
|
2061
2062
|
var generalProfileIdc = profileByte & 0x1f;
|
@@ -2091,34 +2092,38 @@
|
|
2091
2092
|
case 'vp09':
|
2092
2093
|
{
|
2093
2094
|
var vpcCBox = findBox(sampleEntriesEnd, ['vpcC'])[0];
|
2094
|
-
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2095
|
+
if (vpcCBox && vpcCBox.length > 6) {
|
2096
|
+
var profile = vpcCBox[4];
|
2097
|
+
var level = vpcCBox[5];
|
2098
|
+
var bitDepth = vpcCBox[6] >> 4 & 0x0f;
|
2099
|
+
codec += '.' + addLeadingZero(profile) + '.' + addLeadingZero(level) + '.' + addLeadingZero(bitDepth);
|
2100
|
+
}
|
2098
2101
|
break;
|
2099
2102
|
}
|
2100
2103
|
case 'av01':
|
2101
2104
|
{
|
2102
2105
|
var av1CBox = findBox(sampleEntriesEnd, ['av1C'])[0];
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2118
|
-
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2106
|
+
if (av1CBox && av1CBox.length > 2) {
|
2107
|
+
var _profile = av1CBox[1] >>> 5;
|
2108
|
+
var _level = av1CBox[1] & 0x1f;
|
2109
|
+
var _tierFlag = av1CBox[2] >>> 7 ? 'H' : 'M';
|
2110
|
+
var highBitDepth = (av1CBox[2] & 0x40) >> 6;
|
2111
|
+
var twelveBit = (av1CBox[2] & 0x20) >> 5;
|
2112
|
+
var _bitDepth = _profile === 2 && highBitDepth ? twelveBit ? 12 : 10 : highBitDepth ? 10 : 8;
|
2113
|
+
var monochrome = (av1CBox[2] & 0x10) >> 4;
|
2114
|
+
var chromaSubsamplingX = (av1CBox[2] & 0x08) >> 3;
|
2115
|
+
var chromaSubsamplingY = (av1CBox[2] & 0x04) >> 2;
|
2116
|
+
var chromaSamplePosition = av1CBox[2] & 0x03;
|
2117
|
+
// TODO: parse color_description_present_flag
|
2118
|
+
// default it to BT.709/limited range for now
|
2119
|
+
// more info https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-syntax
|
2120
|
+
var colorPrimaries = 1;
|
2121
|
+
var transferCharacteristics = 1;
|
2122
|
+
var matrixCoefficients = 1;
|
2123
|
+
var videoFullRangeFlag = 0;
|
2124
|
+
codec += '.' + _profile + '.' + addLeadingZero(_level) + _tierFlag + '.' + addLeadingZero(_bitDepth) + '.' + monochrome + '.' + chromaSubsamplingX + chromaSubsamplingY + chromaSamplePosition + '.' + addLeadingZero(colorPrimaries) + '.' + addLeadingZero(transferCharacteristics) + '.' + addLeadingZero(matrixCoefficients) + '.' + videoFullRangeFlag;
|
2125
|
+
supplemental = parseSupplementalDoViCodec('dav1', sampleEntriesEnd);
|
2126
|
+
}
|
2122
2127
|
break;
|
2123
2128
|
}
|
2124
2129
|
}
|
@@ -6000,7 +6005,10 @@
|
|
6000
6005
|
if (buffersAppendedTo.length === 0) {
|
6001
6006
|
this.warn("Fragments must have at least one ElementaryStreamType set. type: " + frag.type + " level: " + frag.level + " sn: " + frag.sn);
|
6002
6007
|
}
|
6003
|
-
this.blockBuffers(onUnblocked, buffersAppendedTo)
|
6008
|
+
this.blockBuffers(onUnblocked, buffersAppendedTo).catch(function (error) {
|
6009
|
+
_this15.warn("Fragment buffered callback " + error);
|
6010
|
+
_this15.stepOperationQueue(_this15.sourceBufferTypes);
|
6011
|
+
});
|
6004
6012
|
};
|
6005
6013
|
_proto.onFragChanged = function onFragChanged(event, data) {
|
6006
6014
|
this.trimBuffers();
|
@@ -6483,10 +6491,18 @@
|
|
6483
6491
|
sb.appendBuffer(data);
|
6484
6492
|
};
|
6485
6493
|
_proto.blockUntilOpen = function blockUntilOpen(callback) {
|
6494
|
+
var _this23 = this;
|
6486
6495
|
if (this.isUpdating() || this.isQueued()) {
|
6487
|
-
this.blockBuffers(callback)
|
6496
|
+
this.blockBuffers(callback).catch(function (error) {
|
6497
|
+
_this23.warn("SourceBuffer blocked callback " + error);
|
6498
|
+
_this23.stepOperationQueue(_this23.sourceBufferTypes);
|
6499
|
+
});
|
6488
6500
|
} else {
|
6489
|
-
|
6501
|
+
try {
|
6502
|
+
callback();
|
6503
|
+
} catch (error) {
|
6504
|
+
this.warn("Callback run without blocking " + this.operationQueue + " " + error);
|
6505
|
+
}
|
6490
6506
|
}
|
6491
6507
|
};
|
6492
6508
|
_proto.isUpdating = function isUpdating() {
|
@@ -6497,10 +6513,10 @@
|
|
6497
6513
|
});
|
6498
6514
|
};
|
6499
6515
|
_proto.isQueued = function isQueued() {
|
6500
|
-
var
|
6516
|
+
var _this24 = this;
|
6501
6517
|
return this.sourceBuffers.some(function (_ref15) {
|
6502
6518
|
var type = _ref15[0];
|
6503
|
-
return type && !!
|
6519
|
+
return type && !!_this24.currentOp(type);
|
6504
6520
|
});
|
6505
6521
|
};
|
6506
6522
|
_proto.isPending = function isPending(track) {
|
@@ -6512,46 +6528,45 @@
|
|
6512
6528
|
// upon completion, since we already do it here
|
6513
6529
|
;
|
6514
6530
|
_proto.blockBuffers = function blockBuffers(onUnblocked, bufferNames) {
|
6515
|
-
var
|
6531
|
+
var _this25 = this;
|
6516
6532
|
if (bufferNames === void 0) {
|
6517
6533
|
bufferNames = this.sourceBufferTypes;
|
6518
6534
|
}
|
6519
6535
|
if (!bufferNames.length) {
|
6520
6536
|
this.log('Blocking operation requested, but no SourceBuffers exist');
|
6521
|
-
Promise.resolve().then(onUnblocked);
|
6522
|
-
return;
|
6537
|
+
return Promise.resolve().then(onUnblocked);
|
6523
6538
|
}
|
6524
6539
|
var operationQueue = this.operationQueue;
|
6525
6540
|
|
6526
6541
|
// logger.debug(`[buffer-controller]: Blocking ${buffers} SourceBuffer`);
|
6527
6542
|
var blockingOperations = bufferNames.map(function (type) {
|
6528
|
-
return
|
6543
|
+
return _this25.appendBlocker(type);
|
6529
6544
|
});
|
6530
6545
|
var audioBlocked = bufferNames.length > 1 && !!this.blockedAudioAppend;
|
6531
6546
|
if (audioBlocked) {
|
6532
6547
|
this.unblockAudio();
|
6533
6548
|
}
|
6534
|
-
Promise.all(blockingOperations).then(function (result) {
|
6535
|
-
if (operationQueue !==
|
6549
|
+
return Promise.all(blockingOperations).then(function (result) {
|
6550
|
+
if (operationQueue !== _this25.operationQueue) {
|
6536
6551
|
return;
|
6537
6552
|
}
|
6538
6553
|
// logger.debug(`[buffer-controller]: Blocking operation resolved; unblocking ${buffers} SourceBuffer`);
|
6539
6554
|
onUnblocked();
|
6540
|
-
|
6555
|
+
_this25.stepOperationQueue(_this25.sourceBufferTypes);
|
6541
6556
|
});
|
6542
6557
|
};
|
6543
6558
|
_proto.stepOperationQueue = function stepOperationQueue(bufferNames) {
|
6544
|
-
var
|
6559
|
+
var _this26 = this;
|
6545
6560
|
bufferNames.forEach(function (type) {
|
6546
|
-
var
|
6547
|
-
var sb = (
|
6561
|
+
var _this26$tracks$type;
|
6562
|
+
var sb = (_this26$tracks$type = _this26.tracks[type]) == null ? void 0 : _this26$tracks$type.buffer;
|
6548
6563
|
// Only cycle the queue if the SB is not updating. There's a bug in Chrome which sets the SB updating flag to
|
6549
6564
|
// true when changing the MediaSource duration (https://bugs.chromium.org/p/chromium/issues/detail?id=959359&can=2&q=mediasource%20duration)
|
6550
6565
|
// While this is a workaround, it's probably useful to have around
|
6551
6566
|
if (!sb || sb.updating) {
|
6552
6567
|
return;
|
6553
6568
|
}
|
6554
|
-
|
6569
|
+
_this26.shiftAndExecuteNext(type);
|
6555
6570
|
});
|
6556
6571
|
};
|
6557
6572
|
_proto.append = function append(operation, type, pending) {
|
@@ -6620,9 +6635,9 @@
|
|
6620
6635
|
}, {
|
6621
6636
|
key: "sourceBufferTracks",
|
6622
6637
|
get: function get() {
|
6623
|
-
var
|
6638
|
+
var _this27 = this;
|
6624
6639
|
return Object.keys(this.tracks).reduce(function (baseTracks, type) {
|
6625
|
-
var track =
|
6640
|
+
var track = _this27.tracks[type];
|
6626
6641
|
baseTracks[type] = {
|
6627
6642
|
id: track.id,
|
6628
6643
|
container: track.container,
|
@@ -6635,11 +6650,11 @@
|
|
6635
6650
|
}, {
|
6636
6651
|
key: "bufferedToEnd",
|
6637
6652
|
get: function get() {
|
6638
|
-
var
|
6653
|
+
var _this28 = this;
|
6639
6654
|
return this.sourceBufferCount > 0 && !this.sourceBuffers.some(function (_ref16) {
|
6640
|
-
var
|
6655
|
+
var _this28$tracks$type, _this28$tracks$type2;
|
6641
6656
|
var type = _ref16[0];
|
6642
|
-
return type && (!((
|
6657
|
+
return type && (!((_this28$tracks$type = _this28.tracks[type]) != null && _this28$tracks$type.ended) || ((_this28$tracks$type2 = _this28.tracks[type]) == null ? void 0 : _this28$tracks$type2.ending));
|
6643
6658
|
});
|
6644
6659
|
}
|
6645
6660
|
}, {
|
@@ -6658,9 +6673,9 @@
|
|
6658
6673
|
}, {
|
6659
6674
|
key: "pendingTrackCount",
|
6660
6675
|
get: function get() {
|
6661
|
-
var
|
6676
|
+
var _this29 = this;
|
6662
6677
|
return Object.keys(this.tracks).reduce(function (acc, type) {
|
6663
|
-
return acc + (
|
6678
|
+
return acc + (_this29.isPending(_this29.tracks[type]) ? 1 : 0);
|
6664
6679
|
}, 0);
|
6665
6680
|
}
|
6666
6681
|
}, {
|
@@ -20414,7 +20429,7 @@
|
|
20414
20429
|
return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
|
20415
20430
|
}
|
20416
20431
|
|
20417
|
-
var version = "1.6.1-0.canary.
|
20432
|
+
var version = "1.6.1-0.canary.11108";
|
20418
20433
|
|
20419
20434
|
// ensure the worker ends up in the bundle
|
20420
20435
|
// If the worker should not be included this gets aliased to empty.js
|