hls.js 1.6.0-beta.2.0.canary.10873 → 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 +52 -43
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +43 -114
- 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 +45 -116
- 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 +54 -45
- 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/dist/hls.mjs
CHANGED
@@ -401,7 +401,7 @@ function enableLogs(debugConfig, context, id) {
|
|
401
401
|
// Some browsers don't allow to use bind on console object anyway
|
402
402
|
// fallback to default if needed
|
403
403
|
try {
|
404
|
-
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.
|
404
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.10876"}`);
|
405
405
|
} catch (e) {
|
406
406
|
/* log fn threw an exception. All logger methods are no-ops. */
|
407
407
|
return createLogger();
|
@@ -9847,7 +9847,7 @@ var eventemitter3 = {exports: {}};
|
|
9847
9847
|
var eventemitter3Exports = eventemitter3.exports;
|
9848
9848
|
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
9849
9849
|
|
9850
|
-
const version = "1.6.0-beta.2.0.canary.
|
9850
|
+
const version = "1.6.0-beta.2.0.canary.10876";
|
9851
9851
|
|
9852
9852
|
// ensure the worker ends up in the bundle
|
9853
9853
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -12257,9 +12257,7 @@ class HevcVideoParser extends BaseVideoParser {
|
|
12257
12257
|
track.params[prop] = config.params[prop];
|
12258
12258
|
}
|
12259
12259
|
}
|
12260
|
-
|
12261
|
-
track.sps.push(unit.data);
|
12262
|
-
}
|
12260
|
+
this.pushParameterSet(track.sps, unit.data, track.vps);
|
12263
12261
|
if (!VideoSample) {
|
12264
12262
|
VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts);
|
12265
12263
|
}
|
@@ -12277,9 +12275,7 @@ class HevcVideoParser extends BaseVideoParser {
|
|
12277
12275
|
track.params[prop] = config[prop];
|
12278
12276
|
}
|
12279
12277
|
}
|
12280
|
-
|
12281
|
-
track.pps.push(unit.data);
|
12282
|
-
}
|
12278
|
+
this.pushParameterSet(track.pps, unit.data, track.vps);
|
12283
12279
|
}
|
12284
12280
|
break;
|
12285
12281
|
|
@@ -12310,6 +12306,11 @@ class HevcVideoParser extends BaseVideoParser {
|
|
12310
12306
|
this.VideoSample = null;
|
12311
12307
|
}
|
12312
12308
|
}
|
12309
|
+
pushParameterSet(parameterSets, data, vps) {
|
12310
|
+
if (vps && vps[0] === this.initVPS || !vps && !parameterSets.length) {
|
12311
|
+
parameterSets.push(data);
|
12312
|
+
}
|
12313
|
+
}
|
12313
12314
|
getNALuType(data, offset) {
|
12314
12315
|
return (data[offset] & 0x7e) >>> 1;
|
12315
12316
|
}
|
@@ -13375,7 +13376,6 @@ function parsePMT(data, offset, typeSupported, isSampleAes, observer, logger) {
|
|
13375
13376
|
// logger.log('AVC PID:' + pid);
|
13376
13377
|
if (result.videoPid === -1) {
|
13377
13378
|
result.videoPid = pid;
|
13378
|
-
result.segmentVideoCodec = 'avc';
|
13379
13379
|
}
|
13380
13380
|
break;
|
13381
13381
|
|
@@ -13812,7 +13812,7 @@ class MP4 {
|
|
13812
13812
|
0x00, 0x00]));
|
13813
13813
|
}
|
13814
13814
|
static mdia(track) {
|
13815
|
-
return MP4.box(MP4.types.mdia, MP4.mdhd(track.timescale, track.duration), MP4.hdlr(track.type), MP4.minf(track));
|
13815
|
+
return MP4.box(MP4.types.mdia, MP4.mdhd(track.timescale || 0, track.duration || 0), MP4.hdlr(track.type), MP4.minf(track));
|
13816
13816
|
}
|
13817
13817
|
static mfhd(sequenceNumber) {
|
13818
13818
|
return MP4.box(MP4.types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00,
|
@@ -13836,7 +13836,7 @@ class MP4 {
|
|
13836
13836
|
while (i--) {
|
13837
13837
|
boxes[i] = MP4.trak(tracks[i]);
|
13838
13838
|
}
|
13839
|
-
return MP4.box.apply(null, [MP4.types.moov, MP4.mvhd(tracks[0].timescale, tracks[0].duration)].concat(boxes).concat(MP4.mvex(tracks)));
|
13839
|
+
return MP4.box.apply(null, [MP4.types.moov, MP4.mvhd(tracks[0].timescale || 0, tracks[0].duration || 0)].concat(boxes).concat(MP4.mvex(tracks)));
|
13840
13840
|
}
|
13841
13841
|
static mvex(tracks) {
|
13842
13842
|
let i = tracks.length;
|
@@ -14022,7 +14022,7 @@ class MP4 {
|
|
14022
14022
|
]);
|
14023
14023
|
}
|
14024
14024
|
static audioStsd(track) {
|
14025
|
-
const samplerate = track.samplerate;
|
14025
|
+
const samplerate = track.samplerate || 0;
|
14026
14026
|
return new Uint8Array([0x00, 0x00, 0x00,
|
14027
14027
|
// reserved
|
14028
14028
|
0x00, 0x00, 0x00,
|
@@ -14031,7 +14031,7 @@ class MP4 {
|
|
14031
14031
|
// data_reference_index
|
14032
14032
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
14033
14033
|
// reserved
|
14034
|
-
0x00, track.channelCount,
|
14034
|
+
0x00, track.channelCount || 0,
|
14035
14035
|
// channelcount
|
14036
14036
|
0x00, 0x10,
|
14037
14037
|
// sampleSize:16bits
|
@@ -14051,25 +14051,38 @@ class MP4 {
|
|
14051
14051
|
return MP4.box(MP4.types['ac-3'], MP4.audioStsd(track), MP4.box(MP4.types.dac3, track.config));
|
14052
14052
|
}
|
14053
14053
|
static stsd(track) {
|
14054
|
+
const {
|
14055
|
+
segmentCodec
|
14056
|
+
} = track;
|
14054
14057
|
if (track.type === 'audio') {
|
14055
|
-
if (
|
14056
|
-
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.
|
14058
|
+
if (segmentCodec === 'aac') {
|
14059
|
+
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp4a(track));
|
14057
14060
|
}
|
14058
|
-
if (
|
14061
|
+
if (segmentCodec === 'ac3' && track.config) {
|
14059
14062
|
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.ac3(track));
|
14060
14063
|
}
|
14061
|
-
|
14062
|
-
|
14063
|
-
|
14064
|
+
if (segmentCodec === 'mp3' && track.codec === 'mp3') {
|
14065
|
+
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp3(track));
|
14066
|
+
}
|
14064
14067
|
} else {
|
14065
|
-
|
14068
|
+
if (track.pps && track.sps) {
|
14069
|
+
if (segmentCodec === 'avc') {
|
14070
|
+
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.avc1(track));
|
14071
|
+
}
|
14072
|
+
if (segmentCodec === 'hevc' && track.vps) {
|
14073
|
+
return MP4.box(MP4.types.stsd, MP4.STSD, MP4.hvc1(track));
|
14074
|
+
}
|
14075
|
+
} else {
|
14076
|
+
throw new Error(`video track missing pps or sps`);
|
14077
|
+
}
|
14066
14078
|
}
|
14079
|
+
throw new Error(`unsupported ${track.type} segment codec (${segmentCodec}/${track.codec})`);
|
14067
14080
|
}
|
14068
14081
|
static tkhd(track) {
|
14069
14082
|
const id = track.id;
|
14070
|
-
const duration = track.duration * track.timescale;
|
14071
|
-
const width = track.width;
|
14072
|
-
const height = track.height;
|
14083
|
+
const duration = (track.duration || 0) * (track.timescale || 0);
|
14084
|
+
const width = track.width || 0;
|
14085
|
+
const height = track.height || 0;
|
14073
14086
|
const upperWordDuration = Math.floor(duration / (UINT32_MAX + 1));
|
14074
14087
|
const lowerWordDuration = Math.floor(duration % (UINT32_MAX + 1));
|
14075
14088
|
return MP4.box(MP4.types.tkhd, new Uint8Array([0x01,
|
@@ -14312,6 +14325,21 @@ const MPEG_AUDIO_SAMPLE_PER_FRAME = 1152;
|
|
14312
14325
|
const AC3_SAMPLES_PER_FRAME = 1536;
|
14313
14326
|
let chromeVersion = null;
|
14314
14327
|
let safariWebkitVersion = null;
|
14328
|
+
function createMp4Sample(isKeyframe, duration, size, cts) {
|
14329
|
+
return {
|
14330
|
+
duration,
|
14331
|
+
size,
|
14332
|
+
cts,
|
14333
|
+
flags: {
|
14334
|
+
isLeading: 0,
|
14335
|
+
isDependedOn: 0,
|
14336
|
+
hasRedundancy: 0,
|
14337
|
+
degradPrio: 0,
|
14338
|
+
dependsOn: isKeyframe ? 2 : 1,
|
14339
|
+
isNonSync: isKeyframe ? 0 : 1
|
14340
|
+
}
|
14341
|
+
};
|
14342
|
+
}
|
14315
14343
|
class MP4Remuxer {
|
14316
14344
|
constructor(observer, config, typeSupported, logger) {
|
14317
14345
|
this.logger = void 0;
|
@@ -14810,7 +14838,7 @@ class MP4Remuxer {
|
|
14810
14838
|
maxDtsDelta = Math.max(maxDtsDelta, mp4SampleDuration);
|
14811
14839
|
minPtsDelta = Math.min(minPtsDelta, ptsDelta);
|
14812
14840
|
maxPtsDelta = Math.max(maxPtsDelta, ptsDelta);
|
14813
|
-
outputSamples.push(
|
14841
|
+
outputSamples.push(createMp4Sample(VideoSample.key, mp4SampleDuration, mp4SampleLength, compositionTimeOffset));
|
14814
14842
|
}
|
14815
14843
|
if (outputSamples.length) {
|
14816
14844
|
if (chromeVersion) {
|
@@ -14847,7 +14875,7 @@ class MP4Remuxer {
|
|
14847
14875
|
this.nextAvcDts = nextAvcDts = lastDTS + mp4SampleDuration;
|
14848
14876
|
this.videoSampleDuration = mp4SampleDuration;
|
14849
14877
|
this.isVideoContiguous = true;
|
14850
|
-
const moof = MP4.moof(track.sequenceNumber++, firstDTS, _extends(
|
14878
|
+
const moof = MP4.moof(track.sequenceNumber++, firstDTS, _extends(track, {
|
14851
14879
|
samples: outputSamples
|
14852
14880
|
}));
|
14853
14881
|
const type = 'video';
|
@@ -15049,7 +15077,7 @@ class MP4Remuxer {
|
|
15049
15077
|
// Default the sample's duration to the computed mp4SampleDuration, which will either be 1024 for AAC or 1152 for MPEG
|
15050
15078
|
// In the case that we have 1 sample, this will be the duration. If we have more than one sample, the duration
|
15051
15079
|
// becomes the PTS diff with the previous sample
|
15052
|
-
outputSamples.push(
|
15080
|
+
outputSamples.push(createMp4Sample(true, mp4SampleDuration, unitLen, 0));
|
15053
15081
|
lastPTS = pts;
|
15054
15082
|
}
|
15055
15083
|
|
@@ -15155,25 +15183,6 @@ function flushTextTrackUserdataCueSamples(track, timeOffset, initPTS) {
|
|
15155
15183
|
samples
|
15156
15184
|
};
|
15157
15185
|
}
|
15158
|
-
class Mp4Sample {
|
15159
|
-
constructor(isKeyframe, duration, size, cts) {
|
15160
|
-
this.size = void 0;
|
15161
|
-
this.duration = void 0;
|
15162
|
-
this.cts = void 0;
|
15163
|
-
this.flags = void 0;
|
15164
|
-
this.duration = duration;
|
15165
|
-
this.size = size;
|
15166
|
-
this.cts = cts;
|
15167
|
-
this.flags = {
|
15168
|
-
isLeading: 0,
|
15169
|
-
isDependedOn: 0,
|
15170
|
-
hasRedundancy: 0,
|
15171
|
-
degradPrio: 0,
|
15172
|
-
dependsOn: isKeyframe ? 2 : 1,
|
15173
|
-
isNonSync: isKeyframe ? 0 : 1
|
15174
|
-
};
|
15175
|
-
}
|
15176
|
-
}
|
15177
15186
|
|
15178
15187
|
class PassThroughRemuxer {
|
15179
15188
|
constructor(observer, config, typeSupported, logger) {
|