@livo-tv/blocks 1.21.0 → 1.23.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 +41 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3116,7 +3116,7 @@ function WaitingRoom({
|
|
|
3116
3116
|
alt: "",
|
|
3117
3117
|
className: "size-10 rounded-lg object-cover"
|
|
3118
3118
|
}
|
|
3119
|
-
) : /* @__PURE__ */ jsx("div", { className: "flex size-10 items-center justify-center rounded-lg bg-
|
|
3119
|
+
) : /* @__PURE__ */ jsx("div", { className: "flex size-10 items-center justify-center rounded-lg bg-primary/15 text-sm font-semibold", children: (organizationName ?? title).slice(0, 1).toUpperCase() }),
|
|
3120
3120
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
3121
3121
|
/* @__PURE__ */ jsx("p", { className: "text-lg font-semibold tracking-tight", children: title }),
|
|
3122
3122
|
organizationName ? /* @__PURE__ */ jsx("p", { className: "text-sm text-white/80", children: organizationName }) : null
|
|
@@ -4005,6 +4005,9 @@ function remainderAfterOverlap(previous, next) {
|
|
|
4005
4005
|
}
|
|
4006
4006
|
return null;
|
|
4007
4007
|
}
|
|
4008
|
+
function liveCaptionRow(text, receivedAt, speaker) {
|
|
4009
|
+
return speaker == null ? { text, receivedAt } : { text, receivedAt, speaker };
|
|
4010
|
+
}
|
|
4008
4011
|
function coalesceLiveCaptionCues(cues) {
|
|
4009
4012
|
const out = [];
|
|
4010
4013
|
for (const cue of cues) {
|
|
@@ -4012,26 +4015,31 @@ function coalesceLiveCaptionCues(cues) {
|
|
|
4012
4015
|
if (!text) continue;
|
|
4013
4016
|
const last = out[out.length - 1];
|
|
4014
4017
|
if (!last) {
|
|
4015
|
-
out.push(
|
|
4018
|
+
out.push(liveCaptionRow(text, cue.receivedAt, cue.speaker));
|
|
4019
|
+
continue;
|
|
4020
|
+
}
|
|
4021
|
+
if (last.speaker !== cue.speaker && (last.speaker != null || cue.speaker != null)) {
|
|
4022
|
+
out.push(liveCaptionRow(text, cue.receivedAt, cue.speaker));
|
|
4016
4023
|
continue;
|
|
4017
4024
|
}
|
|
4018
4025
|
const lastNorm = normalizeLiveCaptionText(last.text);
|
|
4019
4026
|
const nextNorm = normalizeLiveCaptionText(text);
|
|
4020
4027
|
if (lastNorm === nextNorm) continue;
|
|
4021
4028
|
if (nextNorm.startsWith(lastNorm) || lastNorm.startsWith(nextNorm)) {
|
|
4022
|
-
out[out.length - 1] =
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4029
|
+
out[out.length - 1] = liveCaptionRow(
|
|
4030
|
+
nextNorm.length >= lastNorm.length ? text : last.text,
|
|
4031
|
+
cue.receivedAt,
|
|
4032
|
+
cue.speaker ?? last.speaker
|
|
4033
|
+
);
|
|
4026
4034
|
continue;
|
|
4027
4035
|
}
|
|
4028
4036
|
const remainder = remainderAfterOverlap(last.text, text);
|
|
4029
4037
|
if (remainder !== null) {
|
|
4030
4038
|
if (!remainder) continue;
|
|
4031
|
-
out.push(
|
|
4039
|
+
out.push(liveCaptionRow(remainder, cue.receivedAt, cue.speaker));
|
|
4032
4040
|
continue;
|
|
4033
4041
|
}
|
|
4034
|
-
out.push(
|
|
4042
|
+
out.push(liveCaptionRow(text, cue.receivedAt, cue.speaker));
|
|
4035
4043
|
}
|
|
4036
4044
|
return out;
|
|
4037
4045
|
}
|
|
@@ -4086,7 +4094,14 @@ async function loadLiveCaptions(url) {
|
|
|
4086
4094
|
if (typeof record.receivedAt !== "number" || !Number.isFinite(record.receivedAt)) {
|
|
4087
4095
|
continue;
|
|
4088
4096
|
}
|
|
4089
|
-
|
|
4097
|
+
const parsed = {
|
|
4098
|
+
text: record.text.trim(),
|
|
4099
|
+
receivedAt: record.receivedAt
|
|
4100
|
+
};
|
|
4101
|
+
if (typeof record.speaker === "number" && Number.isFinite(record.speaker)) {
|
|
4102
|
+
parsed.speaker = record.speaker;
|
|
4103
|
+
}
|
|
4104
|
+
cues.push(parsed);
|
|
4090
4105
|
}
|
|
4091
4106
|
return { ok: true, cues };
|
|
4092
4107
|
} catch {
|
|
@@ -4159,6 +4174,10 @@ function LiveCaptionStack({
|
|
|
4159
4174
|
}, [lastReceivedAt, prefersReduced, cues.length]);
|
|
4160
4175
|
if (cues.length === 0) return null;
|
|
4161
4176
|
const windowed = variant === "window";
|
|
4177
|
+
const distinctSpeakers = new Set(
|
|
4178
|
+
cues.map((cue) => cue.speaker).filter((speaker) => speaker != null)
|
|
4179
|
+
);
|
|
4180
|
+
const showTurns = distinctSpeakers.size >= 2;
|
|
4162
4181
|
return /* @__PURE__ */ jsx(
|
|
4163
4182
|
"div",
|
|
4164
4183
|
{
|
|
@@ -4204,13 +4223,16 @@ function LiveCaptionStack({
|
|
|
4204
4223
|
const fromEnd = cues.length - 1 - index;
|
|
4205
4224
|
const opacity = fromEnd === 0 ? 1 : fromEnd === 1 ? 0.75 : 0.45;
|
|
4206
4225
|
const newest = fromEnd === 0;
|
|
4226
|
+
const previous = cues[index - 1];
|
|
4227
|
+
const turnStart = showTurns && (index === 0 || previous?.speaker !== cue.speaker);
|
|
4207
4228
|
return /* @__PURE__ */ jsxs(
|
|
4208
4229
|
"span",
|
|
4209
4230
|
{
|
|
4210
4231
|
style: { opacity },
|
|
4211
4232
|
"aria-live": newest ? "polite" : void 0,
|
|
4212
4233
|
children: [
|
|
4213
|
-
index > 0 ? " " : "",
|
|
4234
|
+
turnStart && index > 0 ? /* @__PURE__ */ jsx("br", {}) : index > 0 ? " " : "",
|
|
4235
|
+
turnStart ? "\u2013 " : "",
|
|
4214
4236
|
cue.text
|
|
4215
4237
|
]
|
|
4216
4238
|
},
|
|
@@ -4986,7 +5008,7 @@ function VideoPlayer({
|
|
|
4986
5008
|
{
|
|
4987
5009
|
type: "button",
|
|
4988
5010
|
onClick: retry,
|
|
4989
|
-
className: "inline-flex items-center gap-2 rounded-md bg-
|
|
5011
|
+
className: "inline-flex items-center gap-2 rounded-md bg-primary/15 px-3 py-1.5 text-sm hover:bg-primary/25",
|
|
4990
5012
|
children: [
|
|
4991
5013
|
/* @__PURE__ */ jsx(RotateCw, { className: "size-4" }),
|
|
4992
5014
|
t.retry
|
|
@@ -5098,7 +5120,7 @@ function VideoPlayer({
|
|
|
5098
5120
|
{
|
|
5099
5121
|
type: "button",
|
|
5100
5122
|
onClick: goToLiveEdge,
|
|
5101
|
-
className: "ml-1 flex shrink-0 items-center gap-1 rounded bg-
|
|
5123
|
+
className: "ml-1 flex shrink-0 items-center gap-1 rounded bg-primary/15 px-2 py-0.5 text-xs hover:bg-primary/25",
|
|
5102
5124
|
children: [
|
|
5103
5125
|
/* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-red-500" }),
|
|
5104
5126
|
t.goLive
|
|
@@ -5283,7 +5305,7 @@ function VideoPlayer({
|
|
|
5283
5305
|
onSelect: () => setMorePane("quality")
|
|
5284
5306
|
}
|
|
5285
5307
|
),
|
|
5286
|
-
(mode === "vod" || showQuality) && /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-
|
|
5308
|
+
(mode === "vod" || showQuality) && /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-primary/15" }),
|
|
5287
5309
|
/* @__PURE__ */ jsx(
|
|
5288
5310
|
MenuAction,
|
|
5289
5311
|
{
|
|
@@ -5339,7 +5361,7 @@ function ControlButton({
|
|
|
5339
5361
|
"aria-label": label,
|
|
5340
5362
|
title: label,
|
|
5341
5363
|
onClick,
|
|
5342
|
-
className: "flex size-8 items-center justify-center rounded-md text-white/90 outline-none hover:bg-
|
|
5364
|
+
className: "flex size-8 items-center justify-center rounded-md text-white/90 outline-none hover:bg-primary/15 hover:text-white focus-visible:ring-2 focus-visible:ring-white/60",
|
|
5343
5365
|
children
|
|
5344
5366
|
}
|
|
5345
5367
|
);
|
|
@@ -5362,7 +5384,7 @@ function MenuControl({
|
|
|
5362
5384
|
"aria-expanded": open,
|
|
5363
5385
|
title: label,
|
|
5364
5386
|
onClick: () => onOpenChange(!open),
|
|
5365
|
-
className: "flex h-8 items-center gap-1 rounded-md px-1.5 text-white/90 outline-none hover:bg-
|
|
5387
|
+
className: "flex h-8 items-center gap-1 rounded-md px-1.5 text-white/90 outline-none hover:bg-primary/15 hover:text-white focus-visible:ring-2 focus-visible:ring-white/60",
|
|
5366
5388
|
children: [
|
|
5367
5389
|
trigger,
|
|
5368
5390
|
triggerBadge && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium", children: triggerBadge })
|
|
@@ -5391,7 +5413,7 @@ function MenuItem({
|
|
|
5391
5413
|
role: "menuitemradio",
|
|
5392
5414
|
"aria-checked": selected,
|
|
5393
5415
|
onClick: onSelect,
|
|
5394
|
-
className: "flex w-full items-center justify-between gap-3 rounded px-2 py-2.5 text-left text-white/90 hover:bg-
|
|
5416
|
+
className: "flex w-full items-center justify-between gap-3 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
|
|
5395
5417
|
children: [
|
|
5396
5418
|
children,
|
|
5397
5419
|
selected && /* @__PURE__ */ jsx(Check, { className: "size-4" })
|
|
@@ -5412,7 +5434,7 @@ function MenuNavRow({
|
|
|
5412
5434
|
role: "menuitem",
|
|
5413
5435
|
"aria-label": `${label}, ${value}`,
|
|
5414
5436
|
onClick: onSelect,
|
|
5415
|
-
className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-
|
|
5437
|
+
className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
|
|
5416
5438
|
children: [
|
|
5417
5439
|
/* @__PURE__ */ jsx("span", { className: "text-white/70", children: icon }),
|
|
5418
5440
|
/* @__PURE__ */ jsx("span", { className: "flex-1", children: label }),
|
|
@@ -5434,7 +5456,7 @@ function MenuBack({
|
|
|
5434
5456
|
role: "menuitem",
|
|
5435
5457
|
"aria-label": label,
|
|
5436
5458
|
onClick: onSelect,
|
|
5437
|
-
className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-
|
|
5459
|
+
className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
|
|
5438
5460
|
children: [
|
|
5439
5461
|
/* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" }),
|
|
5440
5462
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: title })
|
|
@@ -5455,7 +5477,7 @@ function MenuAction({
|
|
|
5455
5477
|
role: "menuitem",
|
|
5456
5478
|
onClick: onSelect,
|
|
5457
5479
|
className: cn(
|
|
5458
|
-
"flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-
|
|
5480
|
+
"flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
|
|
5459
5481
|
active && "text-primary"
|
|
5460
5482
|
),
|
|
5461
5483
|
children: [
|