hls.js 1.5.7-0.canary.10022 → 1.5.7-0.canary.10024
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 +17 -30
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +17 -30
- 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 -32
- 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 +17 -32
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +1 -1
- package/src/controller/stream-controller.ts +3 -0
- package/src/utils/buffer-helper.ts +12 -31
package/dist/hls.mjs
CHANGED
@@ -512,7 +512,7 @@ function enableLogs(debugConfig, context, id) {
|
|
512
512
|
// Some browsers don't allow to use bind on console object anyway
|
513
513
|
// fallback to default if needed
|
514
514
|
try {
|
515
|
-
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.7-0.canary.
|
515
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.7-0.canary.10024"}`);
|
516
516
|
} catch (e) {
|
517
517
|
/* log fn threw an exception. All logger methods are no-ops. */
|
518
518
|
return createLogger();
|
@@ -8064,40 +8064,29 @@ class BufferHelper {
|
|
8064
8064
|
* Return true if `media`'s buffered include `position`
|
8065
8065
|
*/
|
8066
8066
|
static isBuffered(media, position) {
|
8067
|
-
|
8068
|
-
|
8069
|
-
|
8070
|
-
|
8071
|
-
|
8072
|
-
return true;
|
8073
|
-
}
|
8067
|
+
if (media) {
|
8068
|
+
const buffered = BufferHelper.getBuffered(media);
|
8069
|
+
for (let i = buffered.length; i--;) {
|
8070
|
+
if (position >= buffered.start(i) && position <= buffered.end(i)) {
|
8071
|
+
return true;
|
8074
8072
|
}
|
8075
8073
|
}
|
8076
|
-
} catch (error) {
|
8077
|
-
// this is to catch
|
8078
|
-
// InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer':
|
8079
|
-
// This SourceBuffer has been removed from the parent media source
|
8080
8074
|
}
|
8081
8075
|
return false;
|
8082
8076
|
}
|
8083
8077
|
static bufferInfo(media, pos, maxHoleDuration) {
|
8084
|
-
|
8085
|
-
|
8086
|
-
|
8078
|
+
if (media) {
|
8079
|
+
const vbuffered = BufferHelper.getBuffered(media);
|
8080
|
+
if (vbuffered.length) {
|
8087
8081
|
const buffered = [];
|
8088
|
-
let i;
|
8089
|
-
for (i = 0; i < vbuffered.length; i++) {
|
8082
|
+
for (let i = 0; i < vbuffered.length; i++) {
|
8090
8083
|
buffered.push({
|
8091
8084
|
start: vbuffered.start(i),
|
8092
8085
|
end: vbuffered.end(i)
|
8093
8086
|
});
|
8094
8087
|
}
|
8095
|
-
return
|
8088
|
+
return BufferHelper.bufferedInfo(buffered, pos, maxHoleDuration);
|
8096
8089
|
}
|
8097
|
-
} catch (error) {
|
8098
|
-
// this is to catch
|
8099
|
-
// InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer':
|
8100
|
-
// This SourceBuffer has been removed from the parent media source
|
8101
8090
|
}
|
8102
8091
|
return {
|
8103
8092
|
len: 0,
|
@@ -8109,14 +8098,7 @@ class BufferHelper {
|
|
8109
8098
|
static bufferedInfo(buffered, pos, maxHoleDuration) {
|
8110
8099
|
pos = Math.max(0, pos);
|
8111
8100
|
// sort on buffer.start/smaller end (IE does not always return sorted buffered range)
|
8112
|
-
buffered.sort(
|
8113
|
-
const diff = a.start - b.start;
|
8114
|
-
if (diff) {
|
8115
|
-
return diff;
|
8116
|
-
} else {
|
8117
|
-
return b.end - a.end;
|
8118
|
-
}
|
8119
|
-
});
|
8101
|
+
buffered.sort((a, b) => a.start - b.start || b.end - a.end);
|
8120
8102
|
let buffered2 = [];
|
8121
8103
|
if (maxHoleDuration) {
|
8122
8104
|
// there might be some small holes between buffer time range
|
@@ -8183,7 +8165,7 @@ class BufferHelper {
|
|
8183
8165
|
*/
|
8184
8166
|
static getBuffered(media) {
|
8185
8167
|
try {
|
8186
|
-
return media.buffered;
|
8168
|
+
return media.buffered || noopBuffered;
|
8187
8169
|
} catch (e) {
|
8188
8170
|
logger.log('failed to get media.buffered', e);
|
8189
8171
|
return noopBuffered;
|
@@ -27726,6 +27708,9 @@ class StreamController extends BaseStreamController {
|
|
27726
27708
|
this.checkFragmentChanged();
|
27727
27709
|
}
|
27728
27710
|
doTickIdle() {
|
27711
|
+
if (!this.buffering) {
|
27712
|
+
return;
|
27713
|
+
}
|
27729
27714
|
const {
|
27730
27715
|
hls,
|
27731
27716
|
levelLastLoaded,
|
@@ -28716,7 +28701,7 @@ class Hls {
|
|
28716
28701
|
* Get the video-dev/hls.js package version.
|
28717
28702
|
*/
|
28718
28703
|
static get version() {
|
28719
|
-
return "1.5.7-0.canary.
|
28704
|
+
return "1.5.7-0.canary.10024";
|
28720
28705
|
}
|
28721
28706
|
|
28722
28707
|
/**
|