hls.js 1.5.7-0.canary.10021 → 1.5.7-0.canary.10023
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 +30 -43
- package/dist/hls.js.d.ts +19 -28
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +17 -31
- 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 -33
- 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 +30 -45
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +1 -1
- package/src/controller/audio-stream-controller.ts +27 -20
- package/src/controller/base-stream-controller.ts +3 -1
- package/src/controller/subtitle-stream-controller.ts +14 -11
- package/src/utils/buffer-helper.ts +12 -31
package/dist/hls.js
CHANGED
@@ -644,7 +644,7 @@
|
|
644
644
|
// Some browsers don't allow to use bind on console object anyway
|
645
645
|
// fallback to default if needed
|
646
646
|
try {
|
647
|
-
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.7-0.canary.
|
647
|
+
newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.7-0.canary.10023");
|
648
648
|
} catch (e) {
|
649
649
|
/* log fn threw an exception. All logger methods are no-ops. */
|
650
650
|
return createLogger();
|
@@ -8400,40 +8400,29 @@
|
|
8400
8400
|
* Return true if `media`'s buffered include `position`
|
8401
8401
|
*/
|
8402
8402
|
BufferHelper.isBuffered = function isBuffered(media, position) {
|
8403
|
-
|
8404
|
-
|
8405
|
-
|
8406
|
-
|
8407
|
-
|
8408
|
-
return true;
|
8409
|
-
}
|
8403
|
+
if (media) {
|
8404
|
+
var buffered = BufferHelper.getBuffered(media);
|
8405
|
+
for (var i = buffered.length; i--;) {
|
8406
|
+
if (position >= buffered.start(i) && position <= buffered.end(i)) {
|
8407
|
+
return true;
|
8410
8408
|
}
|
8411
8409
|
}
|
8412
|
-
} catch (error) {
|
8413
|
-
// this is to catch
|
8414
|
-
// InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer':
|
8415
|
-
// This SourceBuffer has been removed from the parent media source
|
8416
8410
|
}
|
8417
8411
|
return false;
|
8418
8412
|
};
|
8419
8413
|
BufferHelper.bufferInfo = function bufferInfo(media, pos, maxHoleDuration) {
|
8420
|
-
|
8421
|
-
|
8422
|
-
|
8414
|
+
if (media) {
|
8415
|
+
var vbuffered = BufferHelper.getBuffered(media);
|
8416
|
+
if (vbuffered.length) {
|
8423
8417
|
var buffered = [];
|
8424
|
-
var i;
|
8425
|
-
for (i = 0; i < vbuffered.length; i++) {
|
8418
|
+
for (var i = 0; i < vbuffered.length; i++) {
|
8426
8419
|
buffered.push({
|
8427
8420
|
start: vbuffered.start(i),
|
8428
8421
|
end: vbuffered.end(i)
|
8429
8422
|
});
|
8430
8423
|
}
|
8431
|
-
return
|
8424
|
+
return BufferHelper.bufferedInfo(buffered, pos, maxHoleDuration);
|
8432
8425
|
}
|
8433
|
-
} catch (error) {
|
8434
|
-
// this is to catch
|
8435
|
-
// InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer':
|
8436
|
-
// This SourceBuffer has been removed from the parent media source
|
8437
8426
|
}
|
8438
8427
|
return {
|
8439
8428
|
len: 0,
|
@@ -8446,12 +8435,7 @@
|
|
8446
8435
|
pos = Math.max(0, pos);
|
8447
8436
|
// sort on buffer.start/smaller end (IE does not always return sorted buffered range)
|
8448
8437
|
buffered.sort(function (a, b) {
|
8449
|
-
|
8450
|
-
if (diff) {
|
8451
|
-
return diff;
|
8452
|
-
} else {
|
8453
|
-
return b.end - a.end;
|
8454
|
-
}
|
8438
|
+
return a.start - b.start || b.end - a.end;
|
8455
8439
|
});
|
8456
8440
|
var buffered2 = [];
|
8457
8441
|
if (maxHoleDuration) {
|
@@ -8519,7 +8503,7 @@
|
|
8519
8503
|
*/;
|
8520
8504
|
BufferHelper.getBuffered = function getBuffered(media) {
|
8521
8505
|
try {
|
8522
|
-
return media.buffered;
|
8506
|
+
return media.buffered || noopBuffered;
|
8523
8507
|
} catch (e) {
|
8524
8508
|
logger.log('failed to get media.buffered', e);
|
8525
8509
|
return noopBuffered;
|
@@ -10743,7 +10727,9 @@
|
|
10743
10727
|
this.log('Reset loading state');
|
10744
10728
|
this.fragCurrent = null;
|
10745
10729
|
this.fragPrevious = null;
|
10746
|
-
this.state
|
10730
|
+
if (this.state !== State.STOPPED) {
|
10731
|
+
this.state = State.IDLE;
|
10732
|
+
}
|
10747
10733
|
};
|
10748
10734
|
_proto.resetStartWhenNotLoaded = function resetStartWhenNotLoaded(level) {
|
10749
10735
|
// if loadedmetadata is not set, it means that first frag request failed
|
@@ -17291,7 +17277,9 @@
|
|
17291
17277
|
this.fragmentTracker.removeFragment(waitingData.frag);
|
17292
17278
|
this.waitingData = null;
|
17293
17279
|
this.waitingVideoCC = -1;
|
17294
|
-
this.state
|
17280
|
+
if (this.state !== State.STOPPED) {
|
17281
|
+
this.state = State.IDLE;
|
17282
|
+
}
|
17295
17283
|
}
|
17296
17284
|
};
|
17297
17285
|
_proto.resetLoadingState = function resetLoadingState() {
|
@@ -17424,26 +17412,25 @@
|
|
17424
17412
|
this.removeUnbufferedFrags(fragCurrent.start);
|
17425
17413
|
}
|
17426
17414
|
this.resetLoadingState();
|
17427
|
-
// destroy useless transmuxer when switching audio to main
|
17428
|
-
if (!altAudio) {
|
17429
|
-
this.resetTransmuxer();
|
17430
|
-
} else {
|
17431
|
-
// switching to audio track, start timer if not already started
|
17432
|
-
this.setInterval(TICK_INTERVAL$2);
|
17433
|
-
}
|
17434
17415
|
|
17435
17416
|
// should we switch tracks ?
|
17436
17417
|
if (altAudio) {
|
17437
17418
|
this.switchingTrack = data;
|
17438
17419
|
// main audio track are handled by stream-controller, just do something if switching to alt audio track
|
17439
|
-
this.state = State.IDLE;
|
17440
17420
|
this.flushAudioIfNeeded(data);
|
17421
|
+
if (this.state !== State.STOPPED) {
|
17422
|
+
// switching to audio track, start timer if not already started
|
17423
|
+
this.setInterval(TICK_INTERVAL$2);
|
17424
|
+
this.state = State.IDLE;
|
17425
|
+
this.tick();
|
17426
|
+
}
|
17441
17427
|
} else {
|
17428
|
+
// destroy useless transmuxer when switching audio to main
|
17429
|
+
this.resetTransmuxer();
|
17442
17430
|
this.switchingTrack = null;
|
17443
17431
|
this.bufferedTrack = data;
|
17444
|
-
this.
|
17432
|
+
this.clearInterval();
|
17445
17433
|
}
|
17446
|
-
this.tick();
|
17447
17434
|
};
|
17448
17435
|
_proto.onManifestLoading = function onManifestLoading() {
|
17449
17436
|
this.fragmentTracker.removeAllFragments();
|
@@ -18342,7 +18329,7 @@
|
|
18342
18329
|
} else {
|
18343
18330
|
this.mediaBuffer = null;
|
18344
18331
|
}
|
18345
|
-
if (currentTrack) {
|
18332
|
+
if (currentTrack && this.state !== State.STOPPED) {
|
18346
18333
|
this.setInterval(TICK_INTERVAL$1);
|
18347
18334
|
}
|
18348
18335
|
}
|
@@ -30217,7 +30204,7 @@
|
|
30217
30204
|
* Get the video-dev/hls.js package version.
|
30218
30205
|
*/
|
30219
30206
|
function get() {
|
30220
|
-
return "1.5.7-0.canary.
|
30207
|
+
return "1.5.7-0.canary.10023";
|
30221
30208
|
}
|
30222
30209
|
}, {
|
30223
30210
|
key: "Events",
|
package/dist/hls.js.d.ts
CHANGED
@@ -121,17 +121,17 @@ export declare class AudioStreamController extends BaseStreamController implemen
|
|
121
121
|
protected resetLoadingState(): void;
|
122
122
|
protected onTickEnd(): void;
|
123
123
|
private doTickIdle;
|
124
|
-
onMediaDetaching(): void;
|
125
|
-
onAudioTracksUpdated
|
126
|
-
onAudioTrackSwitching
|
127
|
-
onManifestLoading(): void;
|
128
|
-
onLevelLoaded
|
129
|
-
onAudioTrackLoaded
|
124
|
+
protected onMediaDetaching(): void;
|
125
|
+
private onAudioTracksUpdated;
|
126
|
+
private onAudioTrackSwitching;
|
127
|
+
protected onManifestLoading(): void;
|
128
|
+
private onLevelLoaded;
|
129
|
+
private onAudioTrackLoaded;
|
130
130
|
_handleFragmentLoadProgress(data: FragLoadedData): void;
|
131
131
|
protected _handleFragmentLoadComplete(fragLoadedData: FragLoadedData): void;
|
132
|
-
onBufferReset
|
133
|
-
onBufferCreated
|
134
|
-
onFragBuffered
|
132
|
+
private onBufferReset;
|
133
|
+
private onBufferCreated;
|
134
|
+
private onFragBuffered;
|
135
135
|
protected onError(event: Events.ERROR, data: ErrorData): void;
|
136
136
|
private onBufferFlushing;
|
137
137
|
private onBufferFlushed;
|
@@ -2762,11 +2762,6 @@ declare class StyledUnicodeChar {
|
|
2762
2762
|
isEmpty(): boolean;
|
2763
2763
|
}
|
2764
2764
|
|
2765
|
-
declare interface SubtitleFragProcessed {
|
2766
|
-
success: boolean;
|
2767
|
-
frag: Fragment;
|
2768
|
-
}
|
2769
|
-
|
2770
2765
|
export declare interface SubtitleFragProcessedData {
|
2771
2766
|
success: boolean;
|
2772
2767
|
frag: Fragment;
|
@@ -2794,16 +2789,16 @@ export declare class SubtitleStreamController extends BaseStreamController imple
|
|
2794
2789
|
protected registerListeners(): void;
|
2795
2790
|
protected unregisterListeners(): void;
|
2796
2791
|
startLoad(startPosition: number): void;
|
2797
|
-
onManifestLoading(): void;
|
2798
|
-
onMediaDetaching(): void;
|
2799
|
-
onLevelLoaded
|
2800
|
-
onSubtitleFragProcessed
|
2801
|
-
onBufferFlushing
|
2802
|
-
onFragBuffered
|
2803
|
-
onError(event: Events.ERROR, data: ErrorData): void;
|
2804
|
-
onSubtitleTracksUpdated
|
2805
|
-
onSubtitleTrackSwitch
|
2806
|
-
onSubtitleTrackLoaded
|
2792
|
+
protected onManifestLoading(): void;
|
2793
|
+
protected onMediaDetaching(): void;
|
2794
|
+
private onLevelLoaded;
|
2795
|
+
private onSubtitleFragProcessed;
|
2796
|
+
private onBufferFlushing;
|
2797
|
+
private onFragBuffered;
|
2798
|
+
protected onError(event: Events.ERROR, data: ErrorData): void;
|
2799
|
+
private onSubtitleTracksUpdated;
|
2800
|
+
private onSubtitleTrackSwitch;
|
2801
|
+
private onSubtitleTrackLoaded;
|
2807
2802
|
_handleFragmentLoadComplete(fragLoadedData: FragLoadedData): void;
|
2808
2803
|
doTick(): void;
|
2809
2804
|
protected loadFragment(frag: Fragment, level: Level, targetBufferTime: number): void;
|
@@ -3043,10 +3038,6 @@ export declare interface TrackSet {
|
|
3043
3038
|
audiovideo?: Track;
|
3044
3039
|
}
|
3045
3040
|
|
3046
|
-
declare interface TrackSwitchedData {
|
3047
|
-
id: number;
|
3048
|
-
}
|
3049
|
-
|
3050
3041
|
declare class TransmuxerInterface {
|
3051
3042
|
error: Error | null;
|
3052
3043
|
private hls;
|