hls.js 1.5.14-0.canary.10567 → 1.5.14-0.canary.10570
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 -0
- package/dist/hls.d.ts +1 -0
- package/dist/hls.js +92 -126
- package/dist/hls.js.d.ts +1 -0
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +35 -95
- 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 +37 -95
- 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 +90 -120
- 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 +2 -2
- package/src/controller/eme-controller.ts +40 -16
- package/src/demux/audio/aacdemuxer.ts +2 -1
- package/src/demux/audio/adts.ts +31 -102
- package/src/demux/tsdemuxer.ts +1 -7
- package/src/loader/level-key.ts +8 -36
- package/src/remux/mp4-generator.ts +37 -34
- package/src/utils/mediakeys-helper.ts +33 -0
package/dist/hls.light.js
CHANGED
@@ -494,7 +494,7 @@
|
|
494
494
|
// Some browsers don't allow to use bind on console object anyway
|
495
495
|
// fallback to default if needed
|
496
496
|
try {
|
497
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.14-0.canary.
|
497
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.14-0.canary.10570");
|
498
498
|
} catch (e) {
|
499
499
|
/* log fn threw an exception. All logger methods are no-ops. */
|
500
500
|
return createLogger();
|
@@ -14453,23 +14453,11 @@
|
|
14453
14453
|
return timeOffset * 90000 + init90kHz;
|
14454
14454
|
};
|
14455
14455
|
|
14456
|
-
|
14457
|
-
* ADTS parser helper
|
14458
|
-
* @link https://wiki.multimedia.cx/index.php?title=ADTS
|
14459
|
-
*/
|
14460
|
-
function getAudioConfig(observer, data, offset, audioCodec) {
|
14461
|
-
var adtsObjectType;
|
14462
|
-
var originalAdtsObjectType;
|
14463
|
-
var adtsExtensionSamplingIndex;
|
14464
|
-
var adtsChannelConfig;
|
14465
|
-
var config;
|
14466
|
-
var userAgent = navigator.userAgent.toLowerCase();
|
14467
|
-
var manifestCodec = audioCodec;
|
14456
|
+
function getAudioConfig(observer, data, offset, manifestCodec) {
|
14468
14457
|
var adtsSamplingRates = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350];
|
14469
|
-
|
14470
|
-
|
14471
|
-
|
14472
|
-
if (adtsSamplingIndex > adtsSamplingRates.length - 1) {
|
14458
|
+
var byte2 = data[offset + 2];
|
14459
|
+
var adtsSamplingIndex = byte2 >> 2 & 0xf;
|
14460
|
+
if (adtsSamplingIndex > 12) {
|
14473
14461
|
var error = new Error("invalid ADTS sampling index:" + adtsSamplingIndex);
|
14474
14462
|
observer.emit(Events.ERROR, Events.ERROR, {
|
14475
14463
|
type: ErrorTypes.MEDIA_ERROR,
|
@@ -14480,53 +14468,12 @@
|
|
14480
14468
|
});
|
14481
14469
|
return;
|
14482
14470
|
}
|
14483
|
-
|
14484
|
-
|
14485
|
-
|
14486
|
-
|
14487
|
-
// Firefox and Pale Moon: freq less than 24kHz = AAC SBR (HE-AAC)
|
14488
|
-
if (/firefox|palemoon/i.test(userAgent)) {
|
14489
|
-
if (adtsSamplingIndex >= 6) {
|
14490
|
-
adtsObjectType = 5;
|
14491
|
-
config = new Array(4);
|
14492
|
-
// HE-AAC uses SBR (Spectral Band Replication) , high frequencies are constructed from low frequencies
|
14493
|
-
// there is a factor 2 between frame sample rate and output sample rate
|
14494
|
-
// multiply frequency by 2 (see table below, equivalent to substract 3)
|
14495
|
-
adtsExtensionSamplingIndex = adtsSamplingIndex - 3;
|
14496
|
-
} else {
|
14497
|
-
adtsObjectType = 2;
|
14498
|
-
config = new Array(2);
|
14499
|
-
adtsExtensionSamplingIndex = adtsSamplingIndex;
|
14500
|
-
}
|
14501
|
-
// Android : always use AAC
|
14502
|
-
} else if (userAgent.indexOf('android') !== -1) {
|
14503
|
-
adtsObjectType = 2;
|
14504
|
-
config = new Array(2);
|
14505
|
-
adtsExtensionSamplingIndex = adtsSamplingIndex;
|
14506
|
-
} else {
|
14507
|
-
/* for other browsers (Chrome/Vivaldi/Opera ...)
|
14508
|
-
always force audio type to be HE-AAC SBR, as some browsers do not support audio codec switch properly (like Chrome ...)
|
14509
|
-
*/
|
14510
|
-
adtsObjectType = 5;
|
14511
|
-
config = new Array(4);
|
14512
|
-
// if (manifest codec is HE-AAC or HE-AACv2) OR (manifest codec not specified AND frequency less than 24kHz)
|
14513
|
-
if (audioCodec && (audioCodec.indexOf('mp4a.40.29') !== -1 || audioCodec.indexOf('mp4a.40.5') !== -1) || !audioCodec && adtsSamplingIndex >= 6) {
|
14514
|
-
// HE-AAC uses SBR (Spectral Band Replication) , high frequencies are constructed from low frequencies
|
14515
|
-
// there is a factor 2 between frame sample rate and output sample rate
|
14516
|
-
// multiply frequency by 2 (see table below, equivalent to substract 3)
|
14517
|
-
adtsExtensionSamplingIndex = adtsSamplingIndex - 3;
|
14518
|
-
} else {
|
14519
|
-
// if (manifest codec is AAC) AND (frequency less than 24kHz AND nb channel is 1) OR (manifest codec not specified and mono audio)
|
14520
|
-
// Chrome fails to play back with low frequency AAC LC mono when initialized with HE-AAC. This is not a problem with stereo.
|
14521
|
-
if (audioCodec && audioCodec.indexOf('mp4a.40.2') !== -1 && (adtsSamplingIndex >= 6 && adtsChannelConfig === 1 || /vivaldi/i.test(userAgent)) || !audioCodec && adtsChannelConfig === 1) {
|
14522
|
-
adtsObjectType = 2;
|
14523
|
-
config = new Array(2);
|
14524
|
-
}
|
14525
|
-
adtsExtensionSamplingIndex = adtsSamplingIndex;
|
14526
|
-
}
|
14527
|
-
}
|
14471
|
+
// MPEG-4 Audio Object Type (profile_ObjectType+1)
|
14472
|
+
var adtsObjectType = (byte2 >> 6 & 0x3) + 1;
|
14473
|
+
var channelCount = data[offset + 3] >> 6 & 0x3 | (byte2 & 1) << 2;
|
14474
|
+
var codec = 'mp4a.40.' + adtsObjectType;
|
14528
14475
|
/* refer to http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio#Audio_Specific_Config
|
14529
|
-
ISO 14496-3
|
14476
|
+
ISO/IEC 14496-3 - Table 1.13 — Syntax of AudioSpecificConfig()
|
14530
14477
|
Audio Profile / Audio Object Type
|
14531
14478
|
0: Null
|
14532
14479
|
1: AAC Main
|
@@ -14559,27 +14506,22 @@
|
|
14559
14506
|
2: 2 channels: front-left, front-right
|
14560
14507
|
*/
|
14561
14508
|
// audioObjectType = profile => profile, the MPEG-4 Audio Object Type minus 1
|
14562
|
-
|
14563
|
-
|
14564
|
-
|
14565
|
-
|
14566
|
-
|
14567
|
-
|
14568
|
-
|
14569
|
-
|
14570
|
-
|
14571
|
-
|
14572
|
-
// adtsObjectType (force to 2, chrome is checking that object type is less than 5 ???
|
14573
|
-
// https://chromium.googlesource.com/chromium/src.git/+/master/media/formats/mp4/aac.cc
|
14574
|
-
config[2] |= 2 << 2;
|
14575
|
-
config[3] = 0;
|
14576
|
-
}
|
14509
|
+
var samplerate = adtsSamplingRates[adtsSamplingIndex];
|
14510
|
+
var aacSampleIndex = adtsSamplingIndex;
|
14511
|
+
if (adtsObjectType === 5 || adtsObjectType === 29) {
|
14512
|
+
// HE-AAC uses SBR (Spectral Band Replication) , high frequencies are constructed from low frequencies
|
14513
|
+
// there is a factor 2 between frame sample rate and output sample rate
|
14514
|
+
// multiply frequency by 2 (see table above, equivalent to substract 3)
|
14515
|
+
aacSampleIndex -= 3;
|
14516
|
+
}
|
14517
|
+
var config = [adtsObjectType << 3 | (aacSampleIndex & 0x0e) >> 1, (aacSampleIndex & 0x01) << 7 | channelCount << 3];
|
14518
|
+
logger.log("manifest codec:" + manifestCodec + ", parsed codec:" + codec + ", channels:" + channelCount + ", rate:" + samplerate + " (ADTS object type:" + adtsObjectType + " sampling index:" + adtsSamplingIndex + ")");
|
14577
14519
|
return {
|
14578
14520
|
config: config,
|
14579
|
-
samplerate:
|
14580
|
-
channelCount:
|
14581
|
-
codec:
|
14582
|
-
parsedCodec:
|
14521
|
+
samplerate: samplerate,
|
14522
|
+
channelCount: channelCount,
|
14523
|
+
codec: codec,
|
14524
|
+
parsedCodec: codec,
|
14583
14525
|
manifestCodec: manifestCodec
|
14584
14526
|
};
|
14585
14527
|
}
|
@@ -14629,13 +14571,7 @@
|
|
14629
14571
|
if (!config) {
|
14630
14572
|
return;
|
14631
14573
|
}
|
14632
|
-
track
|
14633
|
-
track.samplerate = config.samplerate;
|
14634
|
-
track.channelCount = config.channelCount;
|
14635
|
-
track.codec = config.codec;
|
14636
|
-
track.manifestCodec = config.manifestCodec;
|
14637
|
-
track.parsedCodec = config.parsedCodec;
|
14638
|
-
logger.log("parsed codec:" + track.parsedCodec + ", codec:" + track.codec + ", rate:" + config.samplerate + ", channels:" + config.channelCount);
|
14574
|
+
_extends(track, config);
|
14639
14575
|
}
|
14640
14576
|
}
|
14641
14577
|
function getFrameDuration(samplerate) {
|
@@ -17084,7 +17020,7 @@
|
|
17084
17020
|
vSpacing >> 16 & 0xff, vSpacing >> 8 & 0xff, vSpacing & 0xff])));
|
17085
17021
|
};
|
17086
17022
|
MP4.esds = function esds(track) {
|
17087
|
-
var
|
17023
|
+
var config = track.config;
|
17088
17024
|
return new Uint8Array([0x00,
|
17089
17025
|
// version 0
|
17090
17026
|
0x00, 0x00, 0x00,
|
@@ -17092,16 +17028,18 @@
|
|
17092
17028
|
|
17093
17029
|
0x03,
|
17094
17030
|
// descriptor_type
|
17095
|
-
|
17031
|
+
0x19,
|
17096
17032
|
// length
|
17033
|
+
|
17097
17034
|
0x00, 0x01,
|
17098
17035
|
// es_id
|
17036
|
+
|
17099
17037
|
0x00,
|
17100
17038
|
// stream_priority
|
17101
17039
|
|
17102
17040
|
0x04,
|
17103
17041
|
// descriptor_type
|
17104
|
-
|
17042
|
+
0x11,
|
17105
17043
|
// length
|
17106
17044
|
0x40,
|
17107
17045
|
// codec : mpeg4_audio
|
@@ -17114,8 +17052,10 @@
|
|
17114
17052
|
0x00, 0x00, 0x00, 0x00,
|
17115
17053
|
// avgBitrate
|
17116
17054
|
|
17117
|
-
0x05
|
17118
|
-
|
17055
|
+
0x05,
|
17056
|
+
// descriptor_type
|
17057
|
+
0x02].concat(config, [0x06, 0x01, 0x02 // GASpecificConfig)); // length + audio config descriptor
|
17058
|
+
]));
|
17119
17059
|
};
|
17120
17060
|
MP4.audioStsd = function audioStsd(track) {
|
17121
17061
|
var samplerate = track.samplerate;
|
@@ -19344,7 +19284,7 @@
|
|
19344
19284
|
return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
|
19345
19285
|
}
|
19346
19286
|
|
19347
|
-
var version = "1.5.14-0.canary.
|
19287
|
+
var version = "1.5.14-0.canary.10570";
|
19348
19288
|
|
19349
19289
|
// ensure the worker ends up in the bundle
|
19350
19290
|
// If the worker should not be included this gets aliased to empty.js
|