hls.js 1.6.0-beta.2.0.canary.10892 → 1.6.0-beta.2.0.canary.10895
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 +55 -49
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +2 -2
- package/dist/hls.light.min.js +1 -1
- package/dist/hls.light.mjs +2 -2
- package/dist/hls.min.js +1 -1
- package/dist/hls.min.js.map +1 -1
- package/dist/hls.mjs +55 -52
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +2 -2
- package/src/controller/audio-stream-controller.ts +27 -31
package/dist/hls.mjs
CHANGED
@@ -402,7 +402,7 @@ function enableLogs(debugConfig, context, id) {
|
|
402
402
|
// Some browsers don't allow to use bind on console object anyway
|
403
403
|
// fallback to default if needed
|
404
404
|
try {
|
405
|
-
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.
|
405
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.10895"}`);
|
406
406
|
} catch (e) {
|
407
407
|
/* log fn threw an exception. All logger methods are no-ops. */
|
408
408
|
return createLogger();
|
@@ -9835,7 +9835,7 @@ var eventemitter3 = {exports: {}};
|
|
9835
9835
|
var eventemitter3Exports = eventemitter3.exports;
|
9836
9836
|
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
9837
9837
|
|
9838
|
-
const version = "1.6.0-beta.2.0.canary.
|
9838
|
+
const version = "1.6.0-beta.2.0.canary.10895";
|
9839
9839
|
|
9840
9840
|
// ensure the worker ends up in the bundle
|
9841
9841
|
// If the worker should not be included this gets aliased to empty.js
|
@@ -16082,30 +16082,6 @@ class TransmuxerInterface {
|
|
16082
16082
|
}
|
16083
16083
|
}
|
16084
16084
|
|
16085
|
-
function subtitleOptionsIdentical(trackList1, trackList2) {
|
16086
|
-
if (trackList1.length !== trackList2.length) {
|
16087
|
-
return false;
|
16088
|
-
}
|
16089
|
-
for (let i = 0; i < trackList1.length; i++) {
|
16090
|
-
if (!mediaAttributesIdentical(trackList1[i].attrs, trackList2[i].attrs)) {
|
16091
|
-
return false;
|
16092
|
-
}
|
16093
|
-
}
|
16094
|
-
return true;
|
16095
|
-
}
|
16096
|
-
function mediaAttributesIdentical(attrs1, attrs2, customAttributes) {
|
16097
|
-
// Media options with the same rendition ID must be bit identical
|
16098
|
-
const stableRenditionId = attrs1['STABLE-RENDITION-ID'];
|
16099
|
-
if (stableRenditionId && !customAttributes) {
|
16100
|
-
return stableRenditionId === attrs2['STABLE-RENDITION-ID'];
|
16101
|
-
}
|
16102
|
-
// When rendition ID is not present, compare attributes
|
16103
|
-
return !(customAttributes || ['LANGUAGE', 'NAME', 'CHARACTERISTICS', 'AUTOSELECT', 'DEFAULT', 'FORCED', 'ASSOC-LANGUAGE']).some(subtitleAttribute => attrs1[subtitleAttribute] !== attrs2[subtitleAttribute]);
|
16104
|
-
}
|
16105
|
-
function subtitleTrackMatchesTextTrack(subtitleTrack, textTrack) {
|
16106
|
-
return textTrack.label.toLowerCase() === subtitleTrack.name.toLowerCase() && (!textTrack.language || textTrack.language.toLowerCase() === (subtitleTrack.lang || '').toLowerCase());
|
16107
|
-
}
|
16108
|
-
|
16109
16085
|
const TICK_INTERVAL$2 = 100; // how often to tick in ms
|
16110
16086
|
|
16111
16087
|
class AudioStreamController extends BaseStreamController {
|
@@ -16369,11 +16345,7 @@ class AudioStreamController extends BaseStreamController {
|
|
16369
16345
|
if (bufferInfo === null) {
|
16370
16346
|
return;
|
16371
16347
|
}
|
16372
|
-
|
16373
|
-
bufferedTrack,
|
16374
|
-
switchingTrack
|
16375
|
-
} = this;
|
16376
|
-
if (!switchingTrack && this._streamEnded(bufferInfo, trackDetails)) {
|
16348
|
+
if (!this.switchingTrack && this._streamEnded(bufferInfo, trackDetails)) {
|
16377
16349
|
hls.trigger(Events.BUFFER_EOS, {
|
16378
16350
|
type: 'audio'
|
16379
16351
|
});
|
@@ -16385,13 +16357,9 @@ class AudioStreamController extends BaseStreamController {
|
|
16385
16357
|
const fragments = trackDetails.fragments;
|
16386
16358
|
const start = fragments[0].start;
|
16387
16359
|
const loadPosition = this.getLoadPosition();
|
16388
|
-
|
16389
|
-
if (switchingTrack && media) {
|
16360
|
+
const targetBufferTime = this.flushing ? loadPosition : bufferInfo.end;
|
16361
|
+
if (this.switchingTrack && media) {
|
16390
16362
|
const pos = loadPosition;
|
16391
|
-
// STABLE
|
16392
|
-
if (bufferedTrack && !mediaAttributesIdentical(switchingTrack.attrs, bufferedTrack.attrs)) {
|
16393
|
-
targetBufferTime = pos;
|
16394
|
-
}
|
16395
16363
|
// if currentTime (pos) is less than alt audio playlist start time, it means that alt audio is ahead of currentTime
|
16396
16364
|
if (trackDetails.PTSKnown && pos < start) {
|
16397
16365
|
// if everything is buffered from pos to start or if audio buffer upfront, let's seek to start
|
@@ -16403,7 +16371,7 @@ class AudioStreamController extends BaseStreamController {
|
|
16403
16371
|
}
|
16404
16372
|
|
16405
16373
|
// if buffer length is less than maxBufLen, or near the end, find a fragment to load
|
16406
|
-
if (bufferLen >= maxBufLen && !switchingTrack && targetBufferTime < fragments[fragments.length - 1].start) {
|
16374
|
+
if (bufferLen >= maxBufLen && !this.switchingTrack && targetBufferTime < fragments[fragments.length - 1].start) {
|
16407
16375
|
return;
|
16408
16376
|
}
|
16409
16377
|
let frag = this.getNextFragment(targetBufferTime, trackDetails);
|
@@ -16897,20 +16865,31 @@ class AudioStreamController extends BaseStreamController {
|
|
16897
16865
|
}
|
16898
16866
|
}
|
16899
16867
|
flushAudioIfNeeded(switchingTrack) {
|
16900
|
-
|
16901
|
-
|
16902
|
-
|
16903
|
-
|
16904
|
-
|
16905
|
-
|
16906
|
-
|
16907
|
-
|
16908
|
-
|
16909
|
-
|
16910
|
-
|
16911
|
-
|
16912
|
-
|
16913
|
-
|
16868
|
+
if (this.media && this.bufferedTrack) {
|
16869
|
+
const {
|
16870
|
+
name,
|
16871
|
+
lang,
|
16872
|
+
assocLang,
|
16873
|
+
characteristics,
|
16874
|
+
audioCodec,
|
16875
|
+
channels
|
16876
|
+
} = this.bufferedTrack;
|
16877
|
+
if (!matchesOption({
|
16878
|
+
name,
|
16879
|
+
lang,
|
16880
|
+
assocLang,
|
16881
|
+
characteristics,
|
16882
|
+
audioCodec,
|
16883
|
+
channels
|
16884
|
+
}, switchingTrack, audioMatchPredicate)) {
|
16885
|
+
if (useAlternateAudio(switchingTrack.url, this.hls)) {
|
16886
|
+
this.log('Switching audio track : flushing all audio');
|
16887
|
+
super.flushMainBuffer(0, Number.POSITIVE_INFINITY, 'audio');
|
16888
|
+
this.bufferedTrack = null;
|
16889
|
+
} else {
|
16890
|
+
// Main is being buffered. Set bufferedTrack so that it is flushed when switching back to alt-audio
|
16891
|
+
this.bufferedTrack = switchingTrack;
|
16892
|
+
}
|
16914
16893
|
}
|
16915
16894
|
}
|
16916
16895
|
}
|
@@ -17182,6 +17161,30 @@ class BasePlaylistController extends Logger {
|
|
17182
17161
|
}
|
17183
17162
|
}
|
17184
17163
|
|
17164
|
+
function subtitleOptionsIdentical(trackList1, trackList2) {
|
17165
|
+
if (trackList1.length !== trackList2.length) {
|
17166
|
+
return false;
|
17167
|
+
}
|
17168
|
+
for (let i = 0; i < trackList1.length; i++) {
|
17169
|
+
if (!mediaAttributesIdentical(trackList1[i].attrs, trackList2[i].attrs)) {
|
17170
|
+
return false;
|
17171
|
+
}
|
17172
|
+
}
|
17173
|
+
return true;
|
17174
|
+
}
|
17175
|
+
function mediaAttributesIdentical(attrs1, attrs2, customAttributes) {
|
17176
|
+
// Media options with the same rendition ID must be bit identical
|
17177
|
+
const stableRenditionId = attrs1['STABLE-RENDITION-ID'];
|
17178
|
+
if (stableRenditionId && !customAttributes) {
|
17179
|
+
return stableRenditionId === attrs2['STABLE-RENDITION-ID'];
|
17180
|
+
}
|
17181
|
+
// When rendition ID is not present, compare attributes
|
17182
|
+
return !(customAttributes || ['LANGUAGE', 'NAME', 'CHARACTERISTICS', 'AUTOSELECT', 'DEFAULT', 'FORCED', 'ASSOC-LANGUAGE']).some(subtitleAttribute => attrs1[subtitleAttribute] !== attrs2[subtitleAttribute]);
|
17183
|
+
}
|
17184
|
+
function subtitleTrackMatchesTextTrack(subtitleTrack, textTrack) {
|
17185
|
+
return textTrack.label.toLowerCase() === subtitleTrack.name.toLowerCase() && (!textTrack.language || textTrack.language.toLowerCase() === (subtitleTrack.lang || '').toLowerCase());
|
17186
|
+
}
|
17187
|
+
|
17185
17188
|
class AudioTrackController extends BasePlaylistController {
|
17186
17189
|
constructor(hls) {
|
17187
17190
|
super(hls, 'audio-track-controller');
|