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.js
CHANGED
@@ -1194,7 +1194,7 @@
|
|
1194
1194
|
// Some browsers don't allow to use bind on console object anyway
|
1195
1195
|
// fallback to default if needed
|
1196
1196
|
try {
|
1197
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.1-0.canary.
|
1197
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.1-0.canary.11108");
|
1198
1198
|
} catch (e) {
|
1199
1199
|
/* log fn threw an exception. All logger methods are no-ops. */
|
1200
1200
|
return createLogger();
|
@@ -2037,8 +2037,10 @@
|
|
2037
2037
|
{
|
2038
2038
|
// extract profile + compatibility + level out of avcC box
|
2039
2039
|
var avcCBox = findBox(sampleEntriesEnd, ['avcC'])[0];
|
2040
|
-
|
2041
|
-
|
2040
|
+
if (avcCBox && avcCBox.length > 3) {
|
2041
|
+
codec += '.' + toHex(avcCBox[1]) + toHex(avcCBox[2]) + toHex(avcCBox[3]);
|
2042
|
+
supplemental = parseSupplementalDoViCodec(codecFourCC === 'avc1' ? 'dva1' : 'dvav', sampleEntriesEnd);
|
2043
|
+
}
|
2042
2044
|
break;
|
2043
2045
|
}
|
2044
2046
|
case 'mp4a':
|
@@ -2089,9 +2091,8 @@
|
|
2089
2091
|
case 'hvc1':
|
2090
2092
|
case 'hev1':
|
2091
2093
|
{
|
2092
|
-
var
|
2093
|
-
if (
|
2094
|
-
var hvcCBox = hvcCBoxes[0];
|
2094
|
+
var hvcCBox = findBox(sampleEntriesEnd, ['hvcC'])[0];
|
2095
|
+
if (hvcCBox && hvcCBox.length > 12) {
|
2095
2096
|
var profileByte = hvcCBox[1];
|
2096
2097
|
var profileSpace = ['', 'A', 'B', 'C'][profileByte >> 6];
|
2097
2098
|
var generalProfileIdc = profileByte & 0x1f;
|
@@ -2127,34 +2128,38 @@
|
|
2127
2128
|
case 'vp09':
|
2128
2129
|
{
|
2129
2130
|
var vpcCBox = findBox(sampleEntriesEnd, ['vpcC'])[0];
|
2130
|
-
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2131
|
+
if (vpcCBox && vpcCBox.length > 6) {
|
2132
|
+
var profile = vpcCBox[4];
|
2133
|
+
var level = vpcCBox[5];
|
2134
|
+
var bitDepth = vpcCBox[6] >> 4 & 0x0f;
|
2135
|
+
codec += '.' + addLeadingZero(profile) + '.' + addLeadingZero(level) + '.' + addLeadingZero(bitDepth);
|
2136
|
+
}
|
2134
2137
|
break;
|
2135
2138
|
}
|
2136
2139
|
case 'av01':
|
2137
2140
|
{
|
2138
2141
|
var av1CBox = findBox(sampleEntriesEnd, ['av1C'])[0];
|
2139
|
-
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2142
|
+
if (av1CBox && av1CBox.length > 2) {
|
2143
|
+
var _profile = av1CBox[1] >>> 5;
|
2144
|
+
var _level = av1CBox[1] & 0x1f;
|
2145
|
+
var _tierFlag = av1CBox[2] >>> 7 ? 'H' : 'M';
|
2146
|
+
var highBitDepth = (av1CBox[2] & 0x40) >> 6;
|
2147
|
+
var twelveBit = (av1CBox[2] & 0x20) >> 5;
|
2148
|
+
var _bitDepth = _profile === 2 && highBitDepth ? twelveBit ? 12 : 10 : highBitDepth ? 10 : 8;
|
2149
|
+
var monochrome = (av1CBox[2] & 0x10) >> 4;
|
2150
|
+
var chromaSubsamplingX = (av1CBox[2] & 0x08) >> 3;
|
2151
|
+
var chromaSubsamplingY = (av1CBox[2] & 0x04) >> 2;
|
2152
|
+
var chromaSamplePosition = av1CBox[2] & 0x03;
|
2153
|
+
// TODO: parse color_description_present_flag
|
2154
|
+
// default it to BT.709/limited range for now
|
2155
|
+
// more info https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-syntax
|
2156
|
+
var colorPrimaries = 1;
|
2157
|
+
var transferCharacteristics = 1;
|
2158
|
+
var matrixCoefficients = 1;
|
2159
|
+
var videoFullRangeFlag = 0;
|
2160
|
+
codec += '.' + _profile + '.' + addLeadingZero(_level) + _tierFlag + '.' + addLeadingZero(_bitDepth) + '.' + monochrome + '.' + chromaSubsamplingX + chromaSubsamplingY + chromaSamplePosition + '.' + addLeadingZero(colorPrimaries) + '.' + addLeadingZero(transferCharacteristics) + '.' + addLeadingZero(matrixCoefficients) + '.' + videoFullRangeFlag;
|
2161
|
+
supplemental = parseSupplementalDoViCodec('dav1', sampleEntriesEnd);
|
2162
|
+
}
|
2158
2163
|
break;
|
2159
2164
|
}
|
2160
2165
|
}
|
@@ -16716,7 +16721,7 @@
|
|
16716
16721
|
return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
|
16717
16722
|
}
|
16718
16723
|
|
16719
|
-
var version = "1.6.1-0.canary.
|
16724
|
+
var version = "1.6.1-0.canary.11108";
|
16720
16725
|
|
16721
16726
|
// ensure the worker ends up in the bundle
|
16722
16727
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -19505,7 +19510,10 @@
|
|
19505
19510
|
if (buffersAppendedTo.length === 0) {
|
19506
19511
|
this.warn("Fragments must have at least one ElementaryStreamType set. type: " + frag.type + " level: " + frag.level + " sn: " + frag.sn);
|
19507
19512
|
}
|
19508
|
-
this.blockBuffers(onUnblocked, buffersAppendedTo)
|
19513
|
+
this.blockBuffers(onUnblocked, buffersAppendedTo).catch(function (error) {
|
19514
|
+
_this15.warn("Fragment buffered callback " + error);
|
19515
|
+
_this15.stepOperationQueue(_this15.sourceBufferTypes);
|
19516
|
+
});
|
19509
19517
|
};
|
19510
19518
|
_proto.onFragChanged = function onFragChanged(event, data) {
|
19511
19519
|
this.trimBuffers();
|
@@ -19988,10 +19996,18 @@
|
|
19988
19996
|
sb.appendBuffer(data);
|
19989
19997
|
};
|
19990
19998
|
_proto.blockUntilOpen = function blockUntilOpen(callback) {
|
19999
|
+
var _this23 = this;
|
19991
20000
|
if (this.isUpdating() || this.isQueued()) {
|
19992
|
-
this.blockBuffers(callback)
|
20001
|
+
this.blockBuffers(callback).catch(function (error) {
|
20002
|
+
_this23.warn("SourceBuffer blocked callback " + error);
|
20003
|
+
_this23.stepOperationQueue(_this23.sourceBufferTypes);
|
20004
|
+
});
|
19993
20005
|
} else {
|
19994
|
-
|
20006
|
+
try {
|
20007
|
+
callback();
|
20008
|
+
} catch (error) {
|
20009
|
+
this.warn("Callback run without blocking " + this.operationQueue + " " + error);
|
20010
|
+
}
|
19995
20011
|
}
|
19996
20012
|
};
|
19997
20013
|
_proto.isUpdating = function isUpdating() {
|
@@ -20002,10 +20018,10 @@
|
|
20002
20018
|
});
|
20003
20019
|
};
|
20004
20020
|
_proto.isQueued = function isQueued() {
|
20005
|
-
var
|
20021
|
+
var _this24 = this;
|
20006
20022
|
return this.sourceBuffers.some(function (_ref15) {
|
20007
20023
|
var type = _ref15[0];
|
20008
|
-
return type && !!
|
20024
|
+
return type && !!_this24.currentOp(type);
|
20009
20025
|
});
|
20010
20026
|
};
|
20011
20027
|
_proto.isPending = function isPending(track) {
|
@@ -20017,46 +20033,45 @@
|
|
20017
20033
|
// upon completion, since we already do it here
|
20018
20034
|
;
|
20019
20035
|
_proto.blockBuffers = function blockBuffers(onUnblocked, bufferNames) {
|
20020
|
-
var
|
20036
|
+
var _this25 = this;
|
20021
20037
|
if (bufferNames === void 0) {
|
20022
20038
|
bufferNames = this.sourceBufferTypes;
|
20023
20039
|
}
|
20024
20040
|
if (!bufferNames.length) {
|
20025
20041
|
this.log('Blocking operation requested, but no SourceBuffers exist');
|
20026
|
-
Promise.resolve().then(onUnblocked);
|
20027
|
-
return;
|
20042
|
+
return Promise.resolve().then(onUnblocked);
|
20028
20043
|
}
|
20029
20044
|
var operationQueue = this.operationQueue;
|
20030
20045
|
|
20031
20046
|
// logger.debug(`[buffer-controller]: Blocking ${buffers} SourceBuffer`);
|
20032
20047
|
var blockingOperations = bufferNames.map(function (type) {
|
20033
|
-
return
|
20048
|
+
return _this25.appendBlocker(type);
|
20034
20049
|
});
|
20035
20050
|
var audioBlocked = bufferNames.length > 1 && !!this.blockedAudioAppend;
|
20036
20051
|
if (audioBlocked) {
|
20037
20052
|
this.unblockAudio();
|
20038
20053
|
}
|
20039
|
-
Promise.all(blockingOperations).then(function (result) {
|
20040
|
-
if (operationQueue !==
|
20054
|
+
return Promise.all(blockingOperations).then(function (result) {
|
20055
|
+
if (operationQueue !== _this25.operationQueue) {
|
20041
20056
|
return;
|
20042
20057
|
}
|
20043
20058
|
// logger.debug(`[buffer-controller]: Blocking operation resolved; unblocking ${buffers} SourceBuffer`);
|
20044
20059
|
onUnblocked();
|
20045
|
-
|
20060
|
+
_this25.stepOperationQueue(_this25.sourceBufferTypes);
|
20046
20061
|
});
|
20047
20062
|
};
|
20048
20063
|
_proto.stepOperationQueue = function stepOperationQueue(bufferNames) {
|
20049
|
-
var
|
20064
|
+
var _this26 = this;
|
20050
20065
|
bufferNames.forEach(function (type) {
|
20051
|
-
var
|
20052
|
-
var sb = (
|
20066
|
+
var _this26$tracks$type;
|
20067
|
+
var sb = (_this26$tracks$type = _this26.tracks[type]) == null ? void 0 : _this26$tracks$type.buffer;
|
20053
20068
|
// Only cycle the queue if the SB is not updating. There's a bug in Chrome which sets the SB updating flag to
|
20054
20069
|
// true when changing the MediaSource duration (https://bugs.chromium.org/p/chromium/issues/detail?id=959359&can=2&q=mediasource%20duration)
|
20055
20070
|
// While this is a workaround, it's probably useful to have around
|
20056
20071
|
if (!sb || sb.updating) {
|
20057
20072
|
return;
|
20058
20073
|
}
|
20059
|
-
|
20074
|
+
_this26.shiftAndExecuteNext(type);
|
20060
20075
|
});
|
20061
20076
|
};
|
20062
20077
|
_proto.append = function append(operation, type, pending) {
|
@@ -20125,9 +20140,9 @@
|
|
20125
20140
|
}, {
|
20126
20141
|
key: "sourceBufferTracks",
|
20127
20142
|
get: function get() {
|
20128
|
-
var
|
20143
|
+
var _this27 = this;
|
20129
20144
|
return Object.keys(this.tracks).reduce(function (baseTracks, type) {
|
20130
|
-
var track =
|
20145
|
+
var track = _this27.tracks[type];
|
20131
20146
|
baseTracks[type] = {
|
20132
20147
|
id: track.id,
|
20133
20148
|
container: track.container,
|
@@ -20140,11 +20155,11 @@
|
|
20140
20155
|
}, {
|
20141
20156
|
key: "bufferedToEnd",
|
20142
20157
|
get: function get() {
|
20143
|
-
var
|
20158
|
+
var _this28 = this;
|
20144
20159
|
return this.sourceBufferCount > 0 && !this.sourceBuffers.some(function (_ref16) {
|
20145
|
-
var
|
20160
|
+
var _this28$tracks$type, _this28$tracks$type2;
|
20146
20161
|
var type = _ref16[0];
|
20147
|
-
return type && (!((
|
20162
|
+
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));
|
20148
20163
|
});
|
20149
20164
|
}
|
20150
20165
|
}, {
|
@@ -20163,9 +20178,9 @@
|
|
20163
20178
|
}, {
|
20164
20179
|
key: "pendingTrackCount",
|
20165
20180
|
get: function get() {
|
20166
|
-
var
|
20181
|
+
var _this29 = this;
|
20167
20182
|
return Object.keys(this.tracks).reduce(function (acc, type) {
|
20168
|
-
return acc + (
|
20183
|
+
return acc + (_this29.isPending(_this29.tracks[type]) ? 1 : 0);
|
20169
20184
|
}, 0);
|
20170
20185
|
}
|
20171
20186
|
}, {
|