@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.cjs
CHANGED
|
@@ -3142,7 +3142,7 @@ function WaitingRoom({
|
|
|
3142
3142
|
alt: "",
|
|
3143
3143
|
className: "size-10 rounded-lg object-cover"
|
|
3144
3144
|
}
|
|
3145
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-10 items-center justify-center rounded-lg bg-
|
|
3145
|
+
) : /* @__PURE__ */ jsxRuntime.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() }),
|
|
3146
3146
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3147
3147
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold tracking-tight", children: title }),
|
|
3148
3148
|
organizationName ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-white/80", children: organizationName }) : null
|
|
@@ -4031,6 +4031,9 @@ function remainderAfterOverlap(previous, next) {
|
|
|
4031
4031
|
}
|
|
4032
4032
|
return null;
|
|
4033
4033
|
}
|
|
4034
|
+
function liveCaptionRow(text, receivedAt, speaker) {
|
|
4035
|
+
return speaker == null ? { text, receivedAt } : { text, receivedAt, speaker };
|
|
4036
|
+
}
|
|
4034
4037
|
function coalesceLiveCaptionCues(cues) {
|
|
4035
4038
|
const out = [];
|
|
4036
4039
|
for (const cue of cues) {
|
|
@@ -4038,26 +4041,31 @@ function coalesceLiveCaptionCues(cues) {
|
|
|
4038
4041
|
if (!text) continue;
|
|
4039
4042
|
const last = out[out.length - 1];
|
|
4040
4043
|
if (!last) {
|
|
4041
|
-
out.push(
|
|
4044
|
+
out.push(liveCaptionRow(text, cue.receivedAt, cue.speaker));
|
|
4045
|
+
continue;
|
|
4046
|
+
}
|
|
4047
|
+
if (last.speaker !== cue.speaker && (last.speaker != null || cue.speaker != null)) {
|
|
4048
|
+
out.push(liveCaptionRow(text, cue.receivedAt, cue.speaker));
|
|
4042
4049
|
continue;
|
|
4043
4050
|
}
|
|
4044
4051
|
const lastNorm = normalizeLiveCaptionText(last.text);
|
|
4045
4052
|
const nextNorm = normalizeLiveCaptionText(text);
|
|
4046
4053
|
if (lastNorm === nextNorm) continue;
|
|
4047
4054
|
if (nextNorm.startsWith(lastNorm) || lastNorm.startsWith(nextNorm)) {
|
|
4048
|
-
out[out.length - 1] =
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4055
|
+
out[out.length - 1] = liveCaptionRow(
|
|
4056
|
+
nextNorm.length >= lastNorm.length ? text : last.text,
|
|
4057
|
+
cue.receivedAt,
|
|
4058
|
+
cue.speaker ?? last.speaker
|
|
4059
|
+
);
|
|
4052
4060
|
continue;
|
|
4053
4061
|
}
|
|
4054
4062
|
const remainder = remainderAfterOverlap(last.text, text);
|
|
4055
4063
|
if (remainder !== null) {
|
|
4056
4064
|
if (!remainder) continue;
|
|
4057
|
-
out.push(
|
|
4065
|
+
out.push(liveCaptionRow(remainder, cue.receivedAt, cue.speaker));
|
|
4058
4066
|
continue;
|
|
4059
4067
|
}
|
|
4060
|
-
out.push(
|
|
4068
|
+
out.push(liveCaptionRow(text, cue.receivedAt, cue.speaker));
|
|
4061
4069
|
}
|
|
4062
4070
|
return out;
|
|
4063
4071
|
}
|
|
@@ -4112,7 +4120,14 @@ async function loadLiveCaptions(url) {
|
|
|
4112
4120
|
if (typeof record.receivedAt !== "number" || !Number.isFinite(record.receivedAt)) {
|
|
4113
4121
|
continue;
|
|
4114
4122
|
}
|
|
4115
|
-
|
|
4123
|
+
const parsed = {
|
|
4124
|
+
text: record.text.trim(),
|
|
4125
|
+
receivedAt: record.receivedAt
|
|
4126
|
+
};
|
|
4127
|
+
if (typeof record.speaker === "number" && Number.isFinite(record.speaker)) {
|
|
4128
|
+
parsed.speaker = record.speaker;
|
|
4129
|
+
}
|
|
4130
|
+
cues.push(parsed);
|
|
4116
4131
|
}
|
|
4117
4132
|
return { ok: true, cues };
|
|
4118
4133
|
} catch {
|
|
@@ -4185,6 +4200,10 @@ function LiveCaptionStack({
|
|
|
4185
4200
|
}, [lastReceivedAt, prefersReduced, cues.length]);
|
|
4186
4201
|
if (cues.length === 0) return null;
|
|
4187
4202
|
const windowed = variant === "window";
|
|
4203
|
+
const distinctSpeakers = new Set(
|
|
4204
|
+
cues.map((cue) => cue.speaker).filter((speaker) => speaker != null)
|
|
4205
|
+
);
|
|
4206
|
+
const showTurns = distinctSpeakers.size >= 2;
|
|
4188
4207
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4189
4208
|
"div",
|
|
4190
4209
|
{
|
|
@@ -4230,13 +4249,16 @@ function LiveCaptionStack({
|
|
|
4230
4249
|
const fromEnd = cues.length - 1 - index;
|
|
4231
4250
|
const opacity = fromEnd === 0 ? 1 : fromEnd === 1 ? 0.75 : 0.45;
|
|
4232
4251
|
const newest = fromEnd === 0;
|
|
4252
|
+
const previous = cues[index - 1];
|
|
4253
|
+
const turnStart = showTurns && (index === 0 || previous?.speaker !== cue.speaker);
|
|
4233
4254
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4234
4255
|
"span",
|
|
4235
4256
|
{
|
|
4236
4257
|
style: { opacity },
|
|
4237
4258
|
"aria-live": newest ? "polite" : void 0,
|
|
4238
4259
|
children: [
|
|
4239
|
-
index > 0 ? " " : "",
|
|
4260
|
+
turnStart && index > 0 ? /* @__PURE__ */ jsxRuntime.jsx("br", {}) : index > 0 ? " " : "",
|
|
4261
|
+
turnStart ? "\u2013 " : "",
|
|
4240
4262
|
cue.text
|
|
4241
4263
|
]
|
|
4242
4264
|
},
|
|
@@ -5012,7 +5034,7 @@ function VideoPlayer({
|
|
|
5012
5034
|
{
|
|
5013
5035
|
type: "button",
|
|
5014
5036
|
onClick: retry,
|
|
5015
|
-
className: "inline-flex items-center gap-2 rounded-md bg-
|
|
5037
|
+
className: "inline-flex items-center gap-2 rounded-md bg-primary/15 px-3 py-1.5 text-sm hover:bg-primary/25",
|
|
5016
5038
|
children: [
|
|
5017
5039
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCw, { className: "size-4" }),
|
|
5018
5040
|
t.retry
|
|
@@ -5124,7 +5146,7 @@ function VideoPlayer({
|
|
|
5124
5146
|
{
|
|
5125
5147
|
type: "button",
|
|
5126
5148
|
onClick: goToLiveEdge,
|
|
5127
|
-
className: "ml-1 flex shrink-0 items-center gap-1 rounded bg-
|
|
5149
|
+
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",
|
|
5128
5150
|
children: [
|
|
5129
5151
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-1.5 rounded-full bg-red-500" }),
|
|
5130
5152
|
t.goLive
|
|
@@ -5309,7 +5331,7 @@ function VideoPlayer({
|
|
|
5309
5331
|
onSelect: () => setMorePane("quality")
|
|
5310
5332
|
}
|
|
5311
5333
|
),
|
|
5312
|
-
(mode === "vod" || showQuality) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1 h-px bg-
|
|
5334
|
+
(mode === "vod" || showQuality) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1 h-px bg-primary/15" }),
|
|
5313
5335
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5314
5336
|
MenuAction,
|
|
5315
5337
|
{
|
|
@@ -5365,7 +5387,7 @@ function ControlButton({
|
|
|
5365
5387
|
"aria-label": label,
|
|
5366
5388
|
title: label,
|
|
5367
5389
|
onClick,
|
|
5368
|
-
className: "flex size-8 items-center justify-center rounded-md text-white/90 outline-none hover:bg-
|
|
5390
|
+
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",
|
|
5369
5391
|
children
|
|
5370
5392
|
}
|
|
5371
5393
|
);
|
|
@@ -5388,7 +5410,7 @@ function MenuControl({
|
|
|
5388
5410
|
"aria-expanded": open,
|
|
5389
5411
|
title: label,
|
|
5390
5412
|
onClick: () => onOpenChange(!open),
|
|
5391
|
-
className: "flex h-8 items-center gap-1 rounded-md px-1.5 text-white/90 outline-none hover:bg-
|
|
5413
|
+
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",
|
|
5392
5414
|
children: [
|
|
5393
5415
|
trigger,
|
|
5394
5416
|
triggerBadge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-medium", children: triggerBadge })
|
|
@@ -5417,7 +5439,7 @@ function MenuItem({
|
|
|
5417
5439
|
role: "menuitemradio",
|
|
5418
5440
|
"aria-checked": selected,
|
|
5419
5441
|
onClick: onSelect,
|
|
5420
|
-
className: "flex w-full items-center justify-between gap-3 rounded px-2 py-2.5 text-left text-white/90 hover:bg-
|
|
5442
|
+
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",
|
|
5421
5443
|
children: [
|
|
5422
5444
|
children,
|
|
5423
5445
|
selected && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-4" })
|
|
@@ -5438,7 +5460,7 @@ function MenuNavRow({
|
|
|
5438
5460
|
role: "menuitem",
|
|
5439
5461
|
"aria-label": `${label}, ${value}`,
|
|
5440
5462
|
onClick: onSelect,
|
|
5441
|
-
className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-
|
|
5463
|
+
className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
|
|
5442
5464
|
children: [
|
|
5443
5465
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white/70", children: icon }),
|
|
5444
5466
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: label }),
|
|
@@ -5460,7 +5482,7 @@ function MenuBack({
|
|
|
5460
5482
|
role: "menuitem",
|
|
5461
5483
|
"aria-label": label,
|
|
5462
5484
|
onClick: onSelect,
|
|
5463
|
-
className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-
|
|
5485
|
+
className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
|
|
5464
5486
|
children: [
|
|
5465
5487
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "size-4" }),
|
|
5466
5488
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: title })
|
|
@@ -5481,7 +5503,7 @@ function MenuAction({
|
|
|
5481
5503
|
role: "menuitem",
|
|
5482
5504
|
onClick: onSelect,
|
|
5483
5505
|
className: cn(
|
|
5484
|
-
"flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-
|
|
5506
|
+
"flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
|
|
5485
5507
|
active && "text-primary"
|
|
5486
5508
|
),
|
|
5487
5509
|
children: [
|