hls.js 1.6.0-beta.1.0.canary.10809 → 1.6.0-beta.1.0.canary.10811
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 +26 -17
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +19 -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 +19 -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 +26 -17
- 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-track-controller.ts +4 -4
- package/src/controller/interstitials-controller.ts +4 -0
- package/src/controller/stream-controller.ts +4 -4
- package/src/remux/mp4-remuxer.ts +11 -7
- package/src/utils/rendition-helper.ts +5 -0
package/dist/hls.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.10811"}`);
|
404
404
|
} catch (e) {
|
405
405
|
/* log fn threw an exception. All logger methods are no-ops. */
|
406
406
|
return createLogger();
|
@@ -1305,6 +1305,10 @@ function searchDownAndUpList(arr, searchIndex, predicate) {
|
|
1305
1305
|
}
|
1306
1306
|
return -1;
|
1307
1307
|
}
|
1308
|
+
function useAlternateAudio(audioTrackUrl, hls) {
|
1309
|
+
var _hls$levels$hls$loadL;
|
1310
|
+
return !!audioTrackUrl && audioTrackUrl !== ((_hls$levels$hls$loadL = hls.levels[hls.loadLevel]) == null ? void 0 : _hls$levels$hls$loadL.uri);
|
1311
|
+
}
|
1308
1312
|
|
1309
1313
|
class AbrController extends Logger {
|
1310
1314
|
constructor(_hls) {
|
@@ -9831,7 +9835,7 @@ var eventemitter3 = {exports: {}};
|
|
9831
9835
|
var eventemitter3Exports = eventemitter3.exports;
|
9832
9836
|
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
9833
9837
|
|
9834
|
-
const version = "1.6.0-beta.1.0.canary.
|
9838
|
+
const version = "1.6.0-beta.1.0.canary.10811";
|
9835
9839
|
|
9836
9840
|
// ensure the worker ends up in the bundle
|
9837
9841
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -14342,19 +14346,23 @@ class MP4Remuxer {
|
|
14342
14346
|
this.videoTrackConfig = undefined;
|
14343
14347
|
}
|
14344
14348
|
getVideoStartPts(videoSamples) {
|
14349
|
+
// Get the minimum PTS value relative to the first sample's PTS, normalized for 33-bit wrapping
|
14345
14350
|
let rolloverDetected = false;
|
14351
|
+
const firstPts = videoSamples[0].pts;
|
14346
14352
|
const startPTS = videoSamples.reduce((minPTS, sample) => {
|
14347
|
-
|
14353
|
+
let pts = sample.pts;
|
14354
|
+
let delta = pts - minPTS;
|
14348
14355
|
if (delta < -4294967296) {
|
14349
14356
|
// 2^32, see PTSNormalize for reasoning, but we're hitting a rollover here, and we don't want that to impact the timeOffset calculation
|
14350
14357
|
rolloverDetected = true;
|
14351
|
-
|
14352
|
-
|
14358
|
+
pts = normalizePts(pts, firstPts);
|
14359
|
+
delta = pts - minPTS;
|
14360
|
+
}
|
14361
|
+
if (delta > 0) {
|
14353
14362
|
return minPTS;
|
14354
|
-
} else {
|
14355
|
-
return sample.pts;
|
14356
14363
|
}
|
14357
|
-
|
14364
|
+
return pts;
|
14365
|
+
}, firstPts);
|
14358
14366
|
if (rolloverDetected) {
|
14359
14367
|
this.logger.debug('PTS rollover detected');
|
14360
14368
|
}
|
@@ -17438,17 +17446,15 @@ class AudioTrackController extends BasePlaylistController {
|
|
17438
17446
|
return -1;
|
17439
17447
|
}
|
17440
17448
|
loadPlaylist(hlsUrlParameters) {
|
17441
|
-
var _this$hls$levels$this;
|
17442
17449
|
super.loadPlaylist();
|
17443
17450
|
const audioTrack = this.currentTrack;
|
17444
17451
|
if (!this.shouldLoadPlaylist(audioTrack)) {
|
17445
17452
|
return;
|
17446
17453
|
}
|
17447
|
-
|
17448
|
-
|
17449
|
-
|
17454
|
+
// Do not load audio rendition with URI matching main variant URI
|
17455
|
+
if (useAlternateAudio(audioTrack.url, this.hls)) {
|
17456
|
+
this.scheduleLoading(audioTrack, hlsUrlParameters);
|
17450
17457
|
}
|
17451
|
-
this.scheduleLoading(audioTrack, hlsUrlParameters);
|
17452
17458
|
}
|
17453
17459
|
loadingPlaylist(audioTrack, hlsUrlParameters) {
|
17454
17460
|
super.loadingPlaylist(audioTrack, hlsUrlParameters);
|
@@ -24581,6 +24587,10 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
|
|
24581
24587
|
this.hls.on(Events.BUFFER_CODECS, this.onBufferCodecs, this);
|
24582
24588
|
}
|
24583
24589
|
onLevelUpdated(event, data) {
|
24590
|
+
if (data.level === -1) {
|
24591
|
+
// level was removed
|
24592
|
+
return;
|
24593
|
+
}
|
24584
24594
|
const main = this.hls.levels[data.level];
|
24585
24595
|
const currentSelection = _objectSpread2(_objectSpread2({}, this.mediaSelection || this.altSelection), {}, {
|
24586
24596
|
main
|
@@ -31715,9 +31725,10 @@ class StreamController extends BaseStreamController {
|
|
31715
31725
|
transmuxer.push(payload, initSegmentData, audioCodec, videoCodec, frag, part, details.totalduration, accurateTimeOffset, chunkMeta, initPTS);
|
31716
31726
|
}
|
31717
31727
|
onAudioTrackSwitching(event, data) {
|
31728
|
+
const hls = this.hls;
|
31718
31729
|
// if any URL found on new audio track, it is an alternate audio track
|
31719
31730
|
const fromAltAudio = this.altAudio === 2;
|
31720
|
-
const altAudio =
|
31731
|
+
const altAudio = useAlternateAudio(data.url, hls);
|
31721
31732
|
// if we switch on main audio, ensure that main fragment scheduling is synced with media.buffered
|
31722
31733
|
// don't do anything if we switch to alt audio: audio stream controller is handling it.
|
31723
31734
|
// we will just have to change buffer scheduling on audioTrackSwitched
|
@@ -31740,7 +31751,6 @@ class StreamController extends BaseStreamController {
|
|
31740
31751
|
// Reset audio transmuxer so when switching back to main audio we're not still appending where we left off
|
31741
31752
|
this.resetTransmuxer();
|
31742
31753
|
}
|
31743
|
-
const hls = this.hls;
|
31744
31754
|
// If switching from alt to main audio, flush all audio and trigger track switched
|
31745
31755
|
if (fromAltAudio) {
|
31746
31756
|
hls.trigger(Events.BUFFER_FLUSHING, {
|
@@ -31756,8 +31766,7 @@ class StreamController extends BaseStreamController {
|
|
31756
31766
|
}
|
31757
31767
|
}
|
31758
31768
|
onAudioTrackSwitched(event, data) {
|
31759
|
-
const
|
31760
|
-
const altAudio = !!this.hls.audioTracks[trackId].url;
|
31769
|
+
const altAudio = useAlternateAudio(data.url, this.hls);
|
31761
31770
|
if (altAudio) {
|
31762
31771
|
const videoBuffer = this.videoBuffer;
|
31763
31772
|
// if we switched on alternate audio, ensure that main fragment scheduling is synced with video sourcebuffer buffered
|