@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.js
CHANGED
|
@@ -3230,7 +3230,7 @@ function parseThumbnailsVtt(text, vttUrl) {
|
|
|
3230
3230
|
return cues;
|
|
3231
3231
|
}
|
|
3232
3232
|
function cueAtTime(cues, time) {
|
|
3233
|
-
if (cues.length === 0) return null;
|
|
3233
|
+
if (cues.length === 0 || !Number.isFinite(time)) return null;
|
|
3234
3234
|
const hit = cues.find((cue) => time >= cue.start && time < cue.end);
|
|
3235
3235
|
if (hit) return hit;
|
|
3236
3236
|
const last = cues[cues.length - 1];
|
|
@@ -3238,10 +3238,18 @@ function cueAtTime(cues, time) {
|
|
|
3238
3238
|
return cues[0] ?? null;
|
|
3239
3239
|
}
|
|
3240
3240
|
function hoverTimeFromClientX(clientX, rect, duration) {
|
|
3241
|
-
if (rect.width <= 0 || duration <= 0) return 0;
|
|
3241
|
+
if (rect.width <= 0 || !Number.isFinite(duration) || duration <= 0) return 0;
|
|
3242
3242
|
const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));
|
|
3243
3243
|
return ratio * duration;
|
|
3244
3244
|
}
|
|
3245
|
+
function finitePlaybackDuration(duration, seekable, mode) {
|
|
3246
|
+
if (Number.isFinite(duration) && duration > 0) return duration;
|
|
3247
|
+
if (mode === "vod" && seekable.length > 0) {
|
|
3248
|
+
const span = seekable.end(seekable.length - 1) - seekable.start(0);
|
|
3249
|
+
if (Number.isFinite(span) && span > 0) return span;
|
|
3250
|
+
}
|
|
3251
|
+
return 0;
|
|
3252
|
+
}
|
|
3245
3253
|
async function loadThumbnailsVtt(src) {
|
|
3246
3254
|
const vttUrl = thumbnailsVttUrlFromPlayback(src);
|
|
3247
3255
|
if (!vttUrl) return [];
|
|
@@ -3285,7 +3293,7 @@ function SeekBar({
|
|
|
3285
3293
|
},
|
|
3286
3294
|
[duration]
|
|
3287
3295
|
);
|
|
3288
|
-
const cue = hoverTime !== null && cues && cues.length > 0 ? cueAtTime(cues, hoverTime) : null;
|
|
3296
|
+
const cue = hoverTime !== null && Number.isFinite(duration) && duration > 0 && cues && cues.length > 0 ? cueAtTime(cues, hoverTime) : null;
|
|
3289
3297
|
const hoverPercent = hoverTime !== null && duration > 0 ? Math.min(100, Math.max(0, hoverTime / duration * 100)) : 0;
|
|
3290
3298
|
return /* @__PURE__ */ jsxs(
|
|
3291
3299
|
"div",
|
|
@@ -3410,7 +3418,8 @@ function createLiveHlsConfig() {
|
|
|
3410
3418
|
}
|
|
3411
3419
|
function createVodHlsConfig() {
|
|
3412
3420
|
return {
|
|
3413
|
-
enableWorker: true
|
|
3421
|
+
enableWorker: true,
|
|
3422
|
+
startPosition: 0
|
|
3414
3423
|
};
|
|
3415
3424
|
}
|
|
3416
3425
|
|
|
@@ -4514,7 +4523,7 @@ function VideoPlayer({
|
|
|
4514
4523
|
}
|
|
4515
4524
|
}
|
|
4516
4525
|
};
|
|
4517
|
-
const onDuration = () => setDuration(video.duration);
|
|
4526
|
+
const onDuration = () => setDuration(finitePlaybackDuration(video.duration, video.seekable, mode));
|
|
4518
4527
|
const onVolume = () => {
|
|
4519
4528
|
setIsMuted(video.muted);
|
|
4520
4529
|
setVolume(video.volume);
|