@livo-tv/blocks 1.20.0 → 1.21.0
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/index.cjs +14 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3256,7 +3256,7 @@ function parseThumbnailsVtt(text, vttUrl) {
|
|
|
3256
3256
|
return cues;
|
|
3257
3257
|
}
|
|
3258
3258
|
function cueAtTime(cues, time) {
|
|
3259
|
-
if (cues.length === 0) return null;
|
|
3259
|
+
if (cues.length === 0 || !Number.isFinite(time)) return null;
|
|
3260
3260
|
const hit = cues.find((cue) => time >= cue.start && time < cue.end);
|
|
3261
3261
|
if (hit) return hit;
|
|
3262
3262
|
const last = cues[cues.length - 1];
|
|
@@ -3264,10 +3264,18 @@ function cueAtTime(cues, time) {
|
|
|
3264
3264
|
return cues[0] ?? null;
|
|
3265
3265
|
}
|
|
3266
3266
|
function hoverTimeFromClientX(clientX, rect, duration) {
|
|
3267
|
-
if (rect.width <= 0 || duration <= 0) return 0;
|
|
3267
|
+
if (rect.width <= 0 || !Number.isFinite(duration) || duration <= 0) return 0;
|
|
3268
3268
|
const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));
|
|
3269
3269
|
return ratio * duration;
|
|
3270
3270
|
}
|
|
3271
|
+
function finitePlaybackDuration(duration, seekable, mode) {
|
|
3272
|
+
if (Number.isFinite(duration) && duration > 0) return duration;
|
|
3273
|
+
if (mode === "vod" && seekable.length > 0) {
|
|
3274
|
+
const span = seekable.end(seekable.length - 1) - seekable.start(0);
|
|
3275
|
+
if (Number.isFinite(span) && span > 0) return span;
|
|
3276
|
+
}
|
|
3277
|
+
return 0;
|
|
3278
|
+
}
|
|
3271
3279
|
async function loadThumbnailsVtt(src) {
|
|
3272
3280
|
const vttUrl = thumbnailsVttUrlFromPlayback(src);
|
|
3273
3281
|
if (!vttUrl) return [];
|
|
@@ -3311,7 +3319,7 @@ function SeekBar({
|
|
|
3311
3319
|
},
|
|
3312
3320
|
[duration]
|
|
3313
3321
|
);
|
|
3314
|
-
const cue = hoverTime !== null && cues && cues.length > 0 ? cueAtTime(cues, hoverTime) : null;
|
|
3322
|
+
const cue = hoverTime !== null && Number.isFinite(duration) && duration > 0 && cues && cues.length > 0 ? cueAtTime(cues, hoverTime) : null;
|
|
3315
3323
|
const hoverPercent = hoverTime !== null && duration > 0 ? Math.min(100, Math.max(0, hoverTime / duration * 100)) : 0;
|
|
3316
3324
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3317
3325
|
"div",
|
|
@@ -3436,7 +3444,8 @@ function createLiveHlsConfig() {
|
|
|
3436
3444
|
}
|
|
3437
3445
|
function createVodHlsConfig() {
|
|
3438
3446
|
return {
|
|
3439
|
-
enableWorker: true
|
|
3447
|
+
enableWorker: true,
|
|
3448
|
+
startPosition: 0
|
|
3440
3449
|
};
|
|
3441
3450
|
}
|
|
3442
3451
|
|
|
@@ -4540,7 +4549,7 @@ function VideoPlayer({
|
|
|
4540
4549
|
}
|
|
4541
4550
|
}
|
|
4542
4551
|
};
|
|
4543
|
-
const onDuration = () => setDuration(video.duration);
|
|
4552
|
+
const onDuration = () => setDuration(finitePlaybackDuration(video.duration, video.seekable, mode));
|
|
4544
4553
|
const onVolume = () => {
|
|
4545
4554
|
setIsMuted(video.muted);
|
|
4546
4555
|
setVolume(video.volume);
|