hls.js 1.6.0-beta.2.0.canary.10871 → 1.6.0-beta.2.0.canary.10876
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 +74 -60
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +65 -131
- 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 +67 -133
- 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 +76 -62
- 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/demux/audio/base-audio-demuxer.ts +6 -6
- package/src/demux/tsdemuxer.ts +2 -3
- package/src/demux/video/hevc-video-parser.ts +12 -12
- package/src/remux/mp4-generator.ts +99 -45
- package/src/remux/mp4-remuxer.ts +24 -38
- package/src/types/demuxer.ts +41 -1
- package/src/types/remuxer.ts +25 -0
- package/src/utils/fetch-loader.ts +12 -8
- package/src/utils/xhr-loader.ts +4 -11
package/dist/hls.js
CHANGED
@@ -1058,7 +1058,7 @@
|
|
1058
1058
|
// Some browsers don't allow to use bind on console object anyway
|
1059
1059
|
// fallback to default if needed
|
1060
1060
|
try {
|
1061
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.
|
1061
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.10876");
|
1062
1062
|
} catch (e) {
|
1063
1063
|
/* log fn threw an exception. All logger methods are no-ops. */
|
1064
1064
|
return createLogger();
|
@@ -12637,9 +12637,7 @@
|
|
12637
12637
|
track.params[prop] = config.params[prop];
|
12638
12638
|
}
|
12639
12639
|
}
|
12640
|
-
|
12641
|
-
track.sps.push(unit.data);
|
12642
|
-
}
|
12640
|
+
_this2.pushParameterSet(track.sps, unit.data, track.vps);
|
12643
12641
|
if (!VideoSample) {
|
12644
12642
|
VideoSample = _this2.VideoSample = _this2.createVideoSample(true, pes.pts, pes.dts);
|
12645
12643
|
}
|
@@ -12657,9 +12655,7 @@
|
|
12657
12655
|
track.params[_prop] = _config[_prop];
|
12658
12656
|
}
|
12659
12657
|
}
|
12660
|
-
|
12661
|
-
track.pps.push(unit.data);
|
12662
|
-
}
|
12658
|
+
_this2.pushParameterSet(track.pps, unit.data, track.vps);
|
12663
12659
|
}
|
12664
12660
|
break;
|
12665
12661
|
|
@@ -12690,6 +12686,11 @@
|
|
12690
12686
|
this.VideoSample = null;
|
12691
12687
|
}
|
12692
12688
|
};
|
12689
|
+
_proto.pushParameterSet = function pushParameterSet(parameterSets, data, vps) {
|
12690
|
+
if (vps && vps[0] === this.initVPS || !vps && !parameterSets.length) {
|
12691
|
+
parameterSets.push(data);
|
12692
|
+
}
|
12693
|
+
};
|
12693
12694
|
_proto.getNALuType = function getNALuType(data, offset) {
|
12694
12695
|
return (data[offset] & 0x7e) >>> 1;
|
12695
12696
|
};
|
@@ -13756,7 +13757,6 @@
|
|
13756
13757
|
// logger.log('AVC PID:' + pid);
|
13757
13758
|
if (result.videoPid === -1) {
|
13758
13759
|
result.videoPid = pid;
|
13759
|
-
result.segmentVideoCodec = 'avc';
|
13760
13760
|
}
|
13761
13761
|
break;
|
13762
13762
|
|
@@ -14198,7 +14198,7 @@
|
|
14198
14198
|
0x00, 0x00]));
|
14199
14199
|
};
|
14200
14200
|
MP4.mdia = function mdia(track) {
|
14201
|
-
return MP4.box(MP4.types.mdia, MP4.mdhd(track.timescale, track.duration), MP4.hdlr(track.type), MP4.minf(track));
|
14201
|
+
return MP4.box(MP4.types.mdia, MP4.mdhd(track.timescale || 0, track.duration || 0), MP4.hdlr(track.type), MP4.minf(track));
|
14202
14202
|
};
|
14203
14203
|
MP4.mfhd = function mfhd(sequenceNumber) {
|
14204
14204
|
return MP4.box(MP4.types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00,
|
@@ -14222,7 +14222,7 @@
|
|
14222
14222
|
while (i--) {
|
14223
14223
|
boxes[i] = MP4.trak(tracks[i]);
|
14224
14224
|
}
|
14225
|
-
return MP4.box.apply(null, [MP4.types.moov, MP4.mvhd(tracks[0].timescale, tracks[0].duration)].concat(boxes).concat(MP4.mvex(tracks)));
|
14225
|
+
return MP4.box.apply(null, [MP4.types.moov, MP4.mvhd(tracks[0].timescale || 0, tracks[0].duration || 0)].concat(boxes).concat(MP4.mvex(tracks)));
|
14226
14226
|
};
|
14227
14227
|
MP4.mvex = function mvex(tracks) {
|
14228
14228
|
var i = tracks.length;
|
@@ -14406,7 +14406,7 @@
|
|
14406
14406
|
]));
|
14407
14407
|
};
|
14408
14408
|
MP4.audioStsd = function audioStsd(track) {
|
14409
|
-
var samplerate = track.samplerate;
|
14409
|
+
var samplerate = track.samplerate || 0;
|
14410
14410
|
return new Uint8Array([0x00, 0x00, 0x00,
|
14411
14411
|
// reserved
|
14412
14412
|
0x00, 0x00, 0x00,
|
@@ -14415,7 +14415,7 @@
|
|
14415
14415
|
// data_reference_index
|
14416
14416
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
14417
14417
|
// reserved
|
14418
|
-
0x00, track.channelCount,
|
14418
|
+
0x00, track.channelCount || 0,
|
14419
14419
|
// channelcount
|
14420
14420
|
0x00, 0x10,
|
14421
14421
|
// sampleSize:16bits
|
@@ -14435,25 +14435,36 @@
|
|
14435
14435
|
return MP4.box(MP4.types['ac-3'], MP4.audioStsd(track), MP4.box(MP4.types.dac3, track.config));
|
14436
14436
|
};
|
14437
14437
|
MP4.stsd = function stsd(track) {
|
14438
|
+
var segmentCodec = track.segmentCodec;
|
14438
14439
|
if (track.type === 'audio') {
|
14439
|
-
if (
|
14440
|
-
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.
|
14440
|
+
if (segmentCodec === 'aac') {
|
14441
|
+
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp4a(track));
|
14441
14442
|
}
|
14442
|
-
if (
|
14443
|
+
if (segmentCodec === 'ac3' && track.config) {
|
14443
14444
|
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.ac3(track));
|
14444
14445
|
}
|
14445
|
-
|
14446
|
-
|
14447
|
-
|
14446
|
+
if (segmentCodec === 'mp3' && track.codec === 'mp3') {
|
14447
|
+
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp3(track));
|
14448
|
+
}
|
14448
14449
|
} else {
|
14449
|
-
|
14450
|
+
if (track.pps && track.sps) {
|
14451
|
+
if (segmentCodec === 'avc') {
|
14452
|
+
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.avc1(track));
|
14453
|
+
}
|
14454
|
+
if (segmentCodec === 'hevc' && track.vps) {
|
14455
|
+
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.hvc1(track));
|
14456
|
+
}
|
14457
|
+
} else {
|
14458
|
+
throw new Error("video track missing pps or sps");
|
14459
|
+
}
|
14450
14460
|
}
|
14461
|
+
throw new Error("unsupported " + track.type + " segment codec (" + segmentCodec + "/" + track.codec + ")");
|
14451
14462
|
};
|
14452
14463
|
MP4.tkhd = function tkhd(track) {
|
14453
14464
|
var id = track.id;
|
14454
|
-
var duration = track.duration * track.timescale;
|
14455
|
-
var width = track.width;
|
14456
|
-
var height = track.height;
|
14465
|
+
var duration = (track.duration || 0) * (track.timescale || 0);
|
14466
|
+
var width = track.width || 0;
|
14467
|
+
var height = track.height || 0;
|
14457
14468
|
var upperWordDuration = Math.floor(duration / (UINT32_MAX + 1));
|
14458
14469
|
var lowerWordDuration = Math.floor(duration % (UINT32_MAX + 1));
|
14459
14470
|
return MP4.box(MP4.types.tkhd, new Uint8Array([0x01,
|
@@ -14712,6 +14723,21 @@
|
|
14712
14723
|
var AC3_SAMPLES_PER_FRAME = 1536;
|
14713
14724
|
var chromeVersion = null;
|
14714
14725
|
var safariWebkitVersion = null;
|
14726
|
+
function createMp4Sample(isKeyframe, duration, size, cts) {
|
14727
|
+
return {
|
14728
|
+
duration: duration,
|
14729
|
+
size: size,
|
14730
|
+
cts: cts,
|
14731
|
+
flags: {
|
14732
|
+
isLeading: 0,
|
14733
|
+
isDependedOn: 0,
|
14734
|
+
hasRedundancy: 0,
|
14735
|
+
degradPrio: 0,
|
14736
|
+
dependsOn: isKeyframe ? 2 : 1,
|
14737
|
+
isNonSync: isKeyframe ? 0 : 1
|
14738
|
+
}
|
14739
|
+
};
|
14740
|
+
}
|
14715
14741
|
var MP4Remuxer = /*#__PURE__*/function () {
|
14716
14742
|
function MP4Remuxer(observer, config, typeSupported, logger) {
|
14717
14743
|
this.logger = void 0;
|
@@ -15211,7 +15237,7 @@
|
|
15211
15237
|
maxDtsDelta = Math.max(maxDtsDelta, mp4SampleDuration);
|
15212
15238
|
minPtsDelta = Math.min(minPtsDelta, ptsDelta);
|
15213
15239
|
maxPtsDelta = Math.max(maxPtsDelta, ptsDelta);
|
15214
|
-
outputSamples.push(
|
15240
|
+
outputSamples.push(createMp4Sample(VideoSample.key, mp4SampleDuration, mp4SampleLength, compositionTimeOffset));
|
15215
15241
|
}
|
15216
15242
|
if (outputSamples.length) {
|
15217
15243
|
if (chromeVersion) {
|
@@ -15248,7 +15274,7 @@
|
|
15248
15274
|
this.nextAvcDts = nextAvcDts = lastDTS + mp4SampleDuration;
|
15249
15275
|
this.videoSampleDuration = mp4SampleDuration;
|
15250
15276
|
this.isVideoContiguous = true;
|
15251
|
-
var moof = MP4.moof(track.sequenceNumber++, firstDTS, _extends(
|
15277
|
+
var moof = MP4.moof(track.sequenceNumber++, firstDTS, _extends(track, {
|
15252
15278
|
samples: outputSamples
|
15253
15279
|
}));
|
15254
15280
|
var type = 'video';
|
@@ -15452,7 +15478,7 @@
|
|
15452
15478
|
// Default the sample's duration to the computed mp4SampleDuration, which will either be 1024 for AAC or 1152 for MPEG
|
15453
15479
|
// In the case that we have 1 sample, this will be the duration. If we have more than one sample, the duration
|
15454
15480
|
// becomes the PTS diff with the previous sample
|
15455
|
-
outputSamples.push(
|
15481
|
+
outputSamples.push(createMp4Sample(true, mp4SampleDuration, unitLen, 0));
|
15456
15482
|
lastPTS = _pts2;
|
15457
15483
|
}
|
15458
15484
|
|
@@ -15561,23 +15587,6 @@
|
|
15561
15587
|
samples: samples
|
15562
15588
|
};
|
15563
15589
|
}
|
15564
|
-
var Mp4Sample = function Mp4Sample(isKeyframe, duration, size, cts) {
|
15565
|
-
this.size = void 0;
|
15566
|
-
this.duration = void 0;
|
15567
|
-
this.cts = void 0;
|
15568
|
-
this.flags = void 0;
|
15569
|
-
this.duration = duration;
|
15570
|
-
this.size = size;
|
15571
|
-
this.cts = cts;
|
15572
|
-
this.flags = {
|
15573
|
-
isLeading: 0,
|
15574
|
-
isDependedOn: 0,
|
15575
|
-
hasRedundancy: 0,
|
15576
|
-
degradPrio: 0,
|
15577
|
-
dependsOn: isKeyframe ? 2 : 1,
|
15578
|
-
isNonSync: isKeyframe ? 0 : 1
|
15579
|
-
};
|
15580
|
-
};
|
15581
15590
|
|
15582
15591
|
var PassThroughRemuxer = /*#__PURE__*/function () {
|
15583
15592
|
function PassThroughRemuxer(observer, config, typeSupported, logger) {
|
@@ -16311,7 +16320,7 @@
|
|
16311
16320
|
return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
|
16312
16321
|
}
|
16313
16322
|
|
16314
|
-
var version = "1.6.0-beta.2.0.canary.
|
16323
|
+
var version = "1.6.0-beta.2.0.canary.10876";
|
16315
16324
|
|
16316
16325
|
// ensure the worker ends up in the bundle
|
16317
16326
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -29742,7 +29751,6 @@
|
|
29742
29751
|
}
|
29743
29752
|
stats.loading.start = self.performance.now();
|
29744
29753
|
var initParams = getRequestParameters(context, this.controller.signal);
|
29745
|
-
var onProgress = callbacks.onProgress;
|
29746
29754
|
var isArrayBuffer = context.responseType === 'arraybuffer';
|
29747
29755
|
var LENGTH = isArrayBuffer ? 'byteLength' : 'length';
|
29748
29756
|
var _config$loadPolicy = config.loadPolicy,
|
@@ -29755,18 +29763,23 @@
|
|
29755
29763
|
self.clearTimeout(this.requestTimeout);
|
29756
29764
|
config.timeout = maxTimeToFirstByteMs && isFiniteNumber(maxTimeToFirstByteMs) ? maxTimeToFirstByteMs : maxLoadTimeMs;
|
29757
29765
|
this.requestTimeout = self.setTimeout(function () {
|
29758
|
-
_this.
|
29759
|
-
|
29766
|
+
if (_this.callbacks) {
|
29767
|
+
_this.abortInternal();
|
29768
|
+
_this.callbacks.onTimeout(stats, context, _this.response);
|
29769
|
+
}
|
29760
29770
|
}, config.timeout);
|
29761
29771
|
var fetchPromise = isPromise(this.request) ? this.request.then(self.fetch) : self.fetch(this.request);
|
29762
29772
|
fetchPromise.then(function (response) {
|
29773
|
+
var _this$callbacks2;
|
29763
29774
|
_this.response = _this.loader = response;
|
29764
29775
|
var first = Math.max(self.performance.now(), stats.loading.start);
|
29765
29776
|
self.clearTimeout(_this.requestTimeout);
|
29766
29777
|
config.timeout = maxLoadTimeMs;
|
29767
29778
|
_this.requestTimeout = self.setTimeout(function () {
|
29768
|
-
_this.
|
29769
|
-
|
29779
|
+
if (_this.callbacks) {
|
29780
|
+
_this.abortInternal();
|
29781
|
+
_this.callbacks.onTimeout(stats, context, _this.response);
|
29782
|
+
}
|
29770
29783
|
}, maxLoadTimeMs - (first - stats.loading.start));
|
29771
29784
|
if (!response.ok) {
|
29772
29785
|
var status = response.status,
|
@@ -29775,6 +29788,7 @@
|
|
29775
29788
|
}
|
29776
29789
|
stats.loading.first = first;
|
29777
29790
|
stats.total = getContentLength(response.headers) || stats.total;
|
29791
|
+
var onProgress = (_this$callbacks2 = _this.callbacks) == null ? void 0 : _this$callbacks2.onProgress;
|
29778
29792
|
if (onProgress && isFiniteNumber(config.highWaterMark)) {
|
29779
29793
|
return _this.loadProgressively(response, stats, context, config.highWaterMark, onProgress);
|
29780
29794
|
}
|
@@ -29786,6 +29800,7 @@
|
|
29786
29800
|
}
|
29787
29801
|
return response.text();
|
29788
29802
|
}).then(function (responseData) {
|
29803
|
+
var _this$callbacks3, _this$callbacks4;
|
29789
29804
|
var response = _this.response;
|
29790
29805
|
if (!response) {
|
29791
29806
|
throw new Error('loader destroyed');
|
@@ -29801,11 +29816,13 @@
|
|
29801
29816
|
data: responseData,
|
29802
29817
|
code: response.status
|
29803
29818
|
};
|
29819
|
+
var onProgress = (_this$callbacks3 = _this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
|
29804
29820
|
if (onProgress && !isFiniteNumber(config.highWaterMark)) {
|
29805
29821
|
onProgress(stats, context, responseData, response);
|
29806
29822
|
}
|
29807
|
-
callbacks.onSuccess(loaderResponse, stats, context, response);
|
29823
|
+
(_this$callbacks4 = _this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(loaderResponse, stats, context, response);
|
29808
29824
|
}).catch(function (error) {
|
29825
|
+
var _this$callbacks5;
|
29809
29826
|
self.clearTimeout(_this.requestTimeout);
|
29810
29827
|
if (stats.aborted) {
|
29811
29828
|
return;
|
@@ -29814,7 +29831,7 @@
|
|
29814
29831
|
// when destroying, 'error' itself can be undefined
|
29815
29832
|
var code = !error ? 0 : error.code || 0;
|
29816
29833
|
var text = !error ? null : error.message;
|
29817
|
-
callbacks.onError({
|
29834
|
+
(_this$callbacks5 = _this.callbacks) == null ? void 0 : _this$callbacks5.onError({
|
29818
29835
|
code: code,
|
29819
29836
|
text: text
|
29820
29837
|
}, context, error ? error.details : null, stats);
|
@@ -30000,8 +30017,9 @@
|
|
30000
30017
|
if (_this.loader !== xhr || _this.stats.aborted) return;
|
30001
30018
|
_this.openAndSendXhr(xhr, context, config);
|
30002
30019
|
}).catch(function (error) {
|
30020
|
+
var _this$callbacks2;
|
30003
30021
|
// IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS
|
30004
|
-
_this.callbacks.onError({
|
30022
|
+
(_this$callbacks2 = _this.callbacks) == null ? void 0 : _this$callbacks2.onError({
|
30005
30023
|
code: xhr.status,
|
30006
30024
|
text: error.message
|
30007
30025
|
}, context, xhr, stats);
|
@@ -30072,26 +30090,21 @@
|
|
30072
30090
|
if (_status >= 200 && _status < 300) {
|
30073
30091
|
var data = useResponseText != null ? useResponseText : xhr.response;
|
30074
30092
|
if (data != null) {
|
30093
|
+
var _this$callbacks3, _this$callbacks4;
|
30075
30094
|
stats.loading.end = Math.max(self.performance.now(), stats.loading.first);
|
30076
30095
|
var len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
|
30077
30096
|
stats.loaded = stats.total = len;
|
30078
30097
|
stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
|
30079
|
-
|
30080
|
-
return;
|
30081
|
-
}
|
30082
|
-
var onProgress = this.callbacks.onProgress;
|
30098
|
+
var onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
|
30083
30099
|
if (onProgress) {
|
30084
30100
|
onProgress(stats, context, data, xhr);
|
30085
30101
|
}
|
30086
|
-
if (!this.callbacks) {
|
30087
|
-
return;
|
30088
|
-
}
|
30089
30102
|
var _response = {
|
30090
30103
|
url: xhr.responseURL,
|
30091
30104
|
data: data,
|
30092
30105
|
code: _status
|
30093
30106
|
};
|
30094
|
-
this.callbacks.onSuccess(_response, stats, context, xhr);
|
30107
|
+
(_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(_response, stats, context, xhr);
|
30095
30108
|
return;
|
30096
30109
|
}
|
30097
30110
|
}
|
@@ -30108,8 +30121,9 @@
|
|
30108
30121
|
if (shouldRetry(retryConfig, retryCount, false, response)) {
|
30109
30122
|
this.retry(retryConfig);
|
30110
30123
|
} else {
|
30124
|
+
var _this$callbacks5;
|
30111
30125
|
logger.error(_status + " while loading " + context.url);
|
30112
|
-
this.callbacks.onError({
|
30126
|
+
(_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
|
30113
30127
|
code: _status,
|
30114
30128
|
text: xhr.statusText
|
30115
30129
|
}, context, xhr, stats);
|