hls.js 1.6.0-beta.1.0.canary.10808 → 1.6.0-beta.1.0.canary.10810
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 +32 -23
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +17 -12
- 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 +17 -12
- 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 +32 -23
- 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/audio-stream-controller.ts +1 -1
- package/src/controller/audio-track-controller.ts +4 -4
- package/src/controller/eme-controller.ts +6 -6
- package/src/controller/interstitials-controller.ts +4 -0
- package/src/controller/stream-controller.ts +4 -4
- package/src/controller/timeline-controller.ts +1 -1
- package/src/crypt/decrypter.ts +2 -1
- package/src/demux/chunk-cache.ts +1 -1
- package/src/demux/transmuxer.ts +3 -2
- package/src/types/buffer.ts +9 -0
- package/src/utils/fetch-loader.ts +3 -3
- package/src/utils/rendition-helper.ts +5 -0
package/dist/hls.light.mjs
CHANGED
@@ -400,7 +400,7 @@ function enableLogs(debugConfig, context, id) {
|
|
400
400
|
// Some browsers don't allow to use bind on console object anyway
|
401
401
|
// fallback to default if needed
|
402
402
|
try {
|
403
|
-
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.
|
403
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.10810"}`);
|
404
404
|
} catch (e) {
|
405
405
|
/* log fn threw an exception. All logger methods are no-ops. */
|
406
406
|
return createLogger();
|
@@ -1059,6 +1059,10 @@ function getCodecTiers(levels, audioTracksByGroup, minAutoLevel, maxAutoLevel) {
|
|
1059
1059
|
return tiers;
|
1060
1060
|
}, {});
|
1061
1061
|
}
|
1062
|
+
function useAlternateAudio(audioTrackUrl, hls) {
|
1063
|
+
var _hls$levels$hls$loadL;
|
1064
|
+
return !!audioTrackUrl && audioTrackUrl !== ((_hls$levels$hls$loadL = hls.levels[hls.loadLevel]) == null ? void 0 : _hls$levels$hls$loadL.uri);
|
1065
|
+
}
|
1062
1066
|
|
1063
1067
|
class AbrController extends Logger {
|
1064
1068
|
constructor(_hls) {
|
@@ -6653,7 +6657,8 @@ class Decrypter {
|
|
6653
6657
|
decrypt(data, key, iv, aesMode) {
|
6654
6658
|
if (this.useSoftware) {
|
6655
6659
|
return new Promise((resolve, reject) => {
|
6656
|
-
|
6660
|
+
const dataView = ArrayBuffer.isView(data) ? data : new Uint8Array(data);
|
6661
|
+
this.softwareDecrypt(dataView, key, iv, aesMode);
|
6657
6662
|
const decryptResult = this.flush();
|
6658
6663
|
if (decryptResult) {
|
6659
6664
|
resolve(decryptResult.buffer);
|
@@ -16390,7 +16395,8 @@ class Transmuxer {
|
|
16390
16395
|
// For Low-Latency HLS Parts, decrypt in place, since part parsing is expected on push progress
|
16391
16396
|
const loadingParts = chunkMeta.part > -1;
|
16392
16397
|
if (loadingParts) {
|
16393
|
-
|
16398
|
+
const _data = decrypter.flush();
|
16399
|
+
decryptedData = _data ? _data.buffer : _data;
|
16394
16400
|
}
|
16395
16401
|
if (!decryptedData) {
|
16396
16402
|
stats.executeEnd = now();
|
@@ -16472,7 +16478,7 @@ class Transmuxer {
|
|
16472
16478
|
const decryptedData = decrypter.flush();
|
16473
16479
|
if (decryptedData) {
|
16474
16480
|
// Push always returns a TransmuxerResult if decryptdata is null
|
16475
|
-
transmuxResults.push(this.push(decryptedData, null, chunkMeta));
|
16481
|
+
transmuxResults.push(this.push(decryptedData.buffer, null, chunkMeta));
|
16476
16482
|
}
|
16477
16483
|
}
|
16478
16484
|
const {
|
@@ -16841,7 +16847,7 @@ class FetchLoader {
|
|
16841
16847
|
return reader.read().then(data => {
|
16842
16848
|
if (data.done) {
|
16843
16849
|
if (chunkCache.dataLength) {
|
16844
|
-
onProgress(stats, context, chunkCache.flush(), response);
|
16850
|
+
onProgress(stats, context, chunkCache.flush().buffer, response);
|
16845
16851
|
}
|
16846
16852
|
return Promise.resolve(new ArrayBuffer(0));
|
16847
16853
|
}
|
@@ -16854,12 +16860,12 @@ class FetchLoader {
|
|
16854
16860
|
chunkCache.push(chunk);
|
16855
16861
|
if (chunkCache.dataLength >= highWaterMark) {
|
16856
16862
|
// flush in order to join the typed arrays
|
16857
|
-
onProgress(stats, context, chunkCache.flush(), response);
|
16863
|
+
onProgress(stats, context, chunkCache.flush().buffer, response);
|
16858
16864
|
}
|
16859
16865
|
} else {
|
16860
16866
|
// If there's nothing cached already, and the chache is large enough
|
16861
16867
|
// just emit the progress event
|
16862
|
-
onProgress(stats, context, chunk, response);
|
16868
|
+
onProgress(stats, context, chunk.buffer, response);
|
16863
16869
|
}
|
16864
16870
|
return pump();
|
16865
16871
|
}).catch(() => {
|
@@ -19136,7 +19142,7 @@ class GapController extends Logger {
|
|
19136
19142
|
}
|
19137
19143
|
}
|
19138
19144
|
|
19139
|
-
const version = "1.6.0-beta.1.0.canary.
|
19145
|
+
const version = "1.6.0-beta.1.0.canary.10810";
|
19140
19146
|
|
19141
19147
|
// ensure the worker ends up in the bundle
|
19142
19148
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -20160,9 +20166,10 @@ class StreamController extends BaseStreamController {
|
|
20160
20166
|
transmuxer.push(payload, initSegmentData, audioCodec, videoCodec, frag, part, details.totalduration, accurateTimeOffset, chunkMeta, initPTS);
|
20161
20167
|
}
|
20162
20168
|
onAudioTrackSwitching(event, data) {
|
20169
|
+
const hls = this.hls;
|
20163
20170
|
// if any URL found on new audio track, it is an alternate audio track
|
20164
20171
|
const fromAltAudio = this.altAudio === 2;
|
20165
|
-
const altAudio =
|
20172
|
+
const altAudio = useAlternateAudio(data.url, hls);
|
20166
20173
|
// if we switch on main audio, ensure that main fragment scheduling is synced with media.buffered
|
20167
20174
|
// don't do anything if we switch to alt audio: audio stream controller is handling it.
|
20168
20175
|
// we will just have to change buffer scheduling on audioTrackSwitched
|
@@ -20185,7 +20192,6 @@ class StreamController extends BaseStreamController {
|
|
20185
20192
|
// Reset audio transmuxer so when switching back to main audio we're not still appending where we left off
|
20186
20193
|
this.resetTransmuxer();
|
20187
20194
|
}
|
20188
|
-
const hls = this.hls;
|
20189
20195
|
// If switching from alt to main audio, flush all audio and trigger track switched
|
20190
20196
|
if (fromAltAudio) {
|
20191
20197
|
hls.trigger(Events.BUFFER_FLUSHING, {
|
@@ -20201,8 +20207,7 @@ class StreamController extends BaseStreamController {
|
|
20201
20207
|
}
|
20202
20208
|
}
|
20203
20209
|
onAudioTrackSwitched(event, data) {
|
20204
|
-
const
|
20205
|
-
const altAudio = !!this.hls.audioTracks[trackId].url;
|
20210
|
+
const altAudio = useAlternateAudio(data.url, this.hls);
|
20206
20211
|
if (altAudio) {
|
20207
20212
|
const videoBuffer = this.videoBuffer;
|
20208
20213
|
// if we switched on alternate audio, ensure that main fragment scheduling is synced with video sourcebuffer buffered
|