@codenkay/video-nsgplayer-ui 5.0.0 → 5.3.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/CHANGELOG.md +38 -0
- package/README.md +6 -0
- package/dist/index.cjs +855 -245
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -21
- package/dist/index.d.ts +119 -21
- package/dist/index.js +847 -240
- package/dist/index.js.map +1 -1
- package/dist/player-ui.css +203 -1
- package/package.json +3 -3
- package/styles.css +203 -1
package/dist/index.cjs
CHANGED
|
@@ -22,8 +22,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
22
|
var index_exports = {};
|
|
23
23
|
__export(index_exports, {
|
|
24
24
|
AudioTrackSelector: () => AudioTrackSelector,
|
|
25
|
+
GENERIC_ERROR_MESSAGE: () => GENERIC_ERROR_MESSAGE,
|
|
25
26
|
LiveBadgeButton: () => LiveBadgeButton,
|
|
26
27
|
NsgVideoPlayerWithControls: () => NsgVideoPlayerWithControls,
|
|
28
|
+
PREPARING_MESSAGE: () => PREPARING_MESSAGE,
|
|
27
29
|
PlayIconPreset: () => PlayIconPreset,
|
|
28
30
|
PlaybackSpeedSelector: () => PlaybackSpeedSelector,
|
|
29
31
|
PlayerCenterOverlay: () => PlayerCenterOverlay,
|
|
@@ -35,8 +37,10 @@ __export(index_exports, {
|
|
|
35
37
|
QUALITY_PREFERENCE_STORAGE_KEY: () => QUALITY_PREFERENCE_STORAGE_KEY,
|
|
36
38
|
QualitySelector: () => QualitySelector,
|
|
37
39
|
SeekBar: () => SeekBar,
|
|
40
|
+
SettingsMenu: () => SettingsMenu,
|
|
38
41
|
TextTrackSelector: () => TextTrackSelector,
|
|
39
42
|
ZOOM_STEPS: () => ZOOM_STEPS,
|
|
43
|
+
describePlayerError: () => describePlayerError,
|
|
40
44
|
formatPlaybackTime: () => formatPlaybackTime,
|
|
41
45
|
matchQualityPreference: () => matchQualityPreference,
|
|
42
46
|
nextZoom: () => nextZoom,
|
|
@@ -50,17 +54,18 @@ __export(index_exports, {
|
|
|
50
54
|
snapPlaybackRate: () => snapPlaybackRate,
|
|
51
55
|
usePlaybackWatermark: () => usePlaybackWatermark,
|
|
52
56
|
usePlayerControls: () => usePlayerControls,
|
|
57
|
+
useRestoreSubtitleSelection: () => useRestoreSubtitleSelection,
|
|
53
58
|
writeQualityPreference: () => writeQualityPreference
|
|
54
59
|
});
|
|
55
60
|
module.exports = __toCommonJS(index_exports);
|
|
56
61
|
|
|
57
62
|
// src/NsgVideoPlayerWithControls.tsx
|
|
58
|
-
var
|
|
59
|
-
var
|
|
63
|
+
var import_react10 = require("react");
|
|
64
|
+
var import_video_nsgplayer_core4 = require("@codenkay/video-nsgplayer-core");
|
|
60
65
|
var import_video_nsgplayer_react = require("@codenkay/video-nsgplayer-react");
|
|
61
66
|
|
|
62
67
|
// src/components/PlayerChrome.tsx
|
|
63
|
-
var
|
|
68
|
+
var import_react7 = require("react");
|
|
64
69
|
|
|
65
70
|
// src/hooks/usePlayerControls.ts
|
|
66
71
|
var import_react = require("react");
|
|
@@ -113,6 +118,7 @@ function snapPlaybackRate(rate, visible) {
|
|
|
113
118
|
function resolvePlayerOverlay(input) {
|
|
114
119
|
if (!input.showControls) return "none";
|
|
115
120
|
if (!input.isPlaying) return "play";
|
|
121
|
+
if (input.mediaMode === "audio") return "return-video";
|
|
116
122
|
if (input.muted || input.volume <= 0) return "unmute";
|
|
117
123
|
return "none";
|
|
118
124
|
}
|
|
@@ -404,6 +410,9 @@ function usePlayerControls(options) {
|
|
|
404
410
|
const zoomOut = (0, import_react.useCallback)(() => {
|
|
405
411
|
setZoom((prev) => nextZoom(prev, -1));
|
|
406
412
|
}, []);
|
|
413
|
+
const setZoomLevel = (0, import_react.useCallback)((level) => {
|
|
414
|
+
setZoom(ZOOM_STEPS.includes(level) ? level : 1);
|
|
415
|
+
}, []);
|
|
407
416
|
return {
|
|
408
417
|
isPlaying,
|
|
409
418
|
currentTime,
|
|
@@ -437,10 +446,38 @@ function usePlayerControls(options) {
|
|
|
437
446
|
toggleFullscreen,
|
|
438
447
|
goToLive,
|
|
439
448
|
zoomIn,
|
|
440
|
-
zoomOut
|
|
449
|
+
zoomOut,
|
|
450
|
+
setZoom: setZoomLevel
|
|
441
451
|
};
|
|
442
452
|
}
|
|
443
453
|
|
|
454
|
+
// src/utils/edgeProgress.ts
|
|
455
|
+
function edgeProgressPercent(input) {
|
|
456
|
+
const { currentTime, duration, bufferedEnd, isLive, atLiveEdge } = input;
|
|
457
|
+
if (Number.isFinite(duration) && duration > 0) {
|
|
458
|
+
return Math.min(100, Math.max(0, currentTime / duration * 100));
|
|
459
|
+
}
|
|
460
|
+
if (isLive) {
|
|
461
|
+
if (atLiveEdge) {
|
|
462
|
+
return 100;
|
|
463
|
+
}
|
|
464
|
+
if (Number.isFinite(bufferedEnd) && bufferedEnd > 0) {
|
|
465
|
+
return Math.min(100, Math.max(0, currentTime / bufferedEnd * 100));
|
|
466
|
+
}
|
|
467
|
+
return 100;
|
|
468
|
+
}
|
|
469
|
+
return 0;
|
|
470
|
+
}
|
|
471
|
+
function canShowEdgeProgress(input) {
|
|
472
|
+
if (!input.showControls || input.toolbarVisible) {
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
if (input.isLive) {
|
|
476
|
+
return true;
|
|
477
|
+
}
|
|
478
|
+
return Number.isFinite(input.duration) && input.duration > 0;
|
|
479
|
+
}
|
|
480
|
+
|
|
444
481
|
// src/components/PlayIconPreset.tsx
|
|
445
482
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
446
483
|
function PlayIconPreset({
|
|
@@ -465,43 +502,53 @@ function PlayIconPreset({
|
|
|
465
502
|
// src/components/PlayerCenterOverlay.tsx
|
|
466
503
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
467
504
|
var ENABLE_AUDIO_PROMPT = "Tap to enable audio";
|
|
505
|
+
var ENABLE_VIDEO_PROMPT = "Tap to enable video";
|
|
468
506
|
function PlayerCenterOverlay({
|
|
469
507
|
kind,
|
|
470
508
|
playIconPreset,
|
|
471
509
|
onPlay,
|
|
472
|
-
onEnableAudio
|
|
510
|
+
onEnableAudio,
|
|
511
|
+
onReturnToVideo
|
|
473
512
|
}) {
|
|
474
513
|
if (kind === "none") return null;
|
|
475
514
|
const isPlay = kind === "play";
|
|
515
|
+
const isReturnVideo = kind === "return-video";
|
|
516
|
+
const label = isPlay ? "Play" : isReturnVideo ? ENABLE_VIDEO_PROMPT : ENABLE_AUDIO_PROMPT;
|
|
517
|
+
const activate = () => {
|
|
518
|
+
if (isPlay) onPlay();
|
|
519
|
+
else if (isReturnVideo) onReturnToVideo?.();
|
|
520
|
+
else onEnableAudio();
|
|
521
|
+
};
|
|
476
522
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
477
523
|
"div",
|
|
478
524
|
{
|
|
479
525
|
className: "nsg-player-center-overlay",
|
|
480
526
|
onClick: (event) => {
|
|
481
527
|
event.stopPropagation();
|
|
482
|
-
|
|
483
|
-
else onEnableAudio();
|
|
528
|
+
activate();
|
|
484
529
|
},
|
|
485
530
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
486
531
|
"button",
|
|
487
532
|
{
|
|
488
533
|
type: "button",
|
|
489
534
|
className: "nsg-player-center-btn",
|
|
490
|
-
"aria-label":
|
|
535
|
+
"aria-label": label,
|
|
491
536
|
onClick: (event) => {
|
|
492
537
|
event.stopPropagation();
|
|
493
|
-
|
|
494
|
-
else onEnableAudio();
|
|
538
|
+
activate();
|
|
495
539
|
},
|
|
496
540
|
children: [
|
|
497
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "nsg-player-center-disc", children: isPlay ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlayIconPreset, { preset: playIconPreset, size: 36 }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "34", height: "34", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 10v4h3.2L11 19V5L6.2 10H3zm11.5 2A4.5 4.5 0 0 0 12 8.2v7.6A4.5 4.5 0 0 0 14.5 12zm3.5 0a8 8 0 0 0-3.2-6.4v2.3a5.7 5.7 0 0 1 0 8.2v2.3A8 8 0 0 0 18 12z" }) }) }),
|
|
498
|
-
isPlay ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "nsg-player-center-label", children:
|
|
541
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "nsg-player-center-disc", children: isPlay ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlayIconPreset, { preset: playIconPreset, size: 36 }) : isReturnVideo ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AudioModeGlyph, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "34", height: "34", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 10v4h3.2L11 19V5L6.2 10H3zm11.5 2A4.5 4.5 0 0 0 12 8.2v7.6A4.5 4.5 0 0 0 14.5 12zm3.5 0a8 8 0 0 0-3.2-6.4v2.3a5.7 5.7 0 0 1 0 8.2v2.3A8 8 0 0 0 18 12z" }) }) }),
|
|
542
|
+
isPlay ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "nsg-player-center-label", children: label })
|
|
499
543
|
]
|
|
500
544
|
}
|
|
501
545
|
)
|
|
502
546
|
}
|
|
503
547
|
);
|
|
504
548
|
}
|
|
549
|
+
function AudioModeGlyph() {
|
|
550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "34", height: "34", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 3a9 9 0 0 0-9 9v7a2 2 0 0 0 2 2h2v-8H5v-1a7 7 0 0 1 14 0v1h-2v8h2a2 2 0 0 0 2-2v-7a9 9 0 0 0-9-9z" }) });
|
|
551
|
+
}
|
|
505
552
|
|
|
506
553
|
// src/components/PlayerMenu.tsx
|
|
507
554
|
var import_react2 = require("react");
|
|
@@ -722,49 +769,9 @@ function PlaybackSpeedSelector({
|
|
|
722
769
|
)) });
|
|
723
770
|
}
|
|
724
771
|
|
|
725
|
-
// src/components/QualitySelector.tsx
|
|
726
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
727
|
-
function QualitySelector({
|
|
728
|
-
qualities,
|
|
729
|
-
selection,
|
|
730
|
-
activeLevel,
|
|
731
|
-
onSelect
|
|
732
|
-
}) {
|
|
733
|
-
if (qualities.length <= 1) return null;
|
|
734
|
-
const sorted = [...qualities].sort(
|
|
735
|
-
(a, b) => b.height - a.height || b.bitrate - a.bitrate
|
|
736
|
-
);
|
|
737
|
-
const activeLabel = activeLevel >= 0 ? qualities.find((q) => q.index === activeLevel)?.label : void 0;
|
|
738
|
-
const buttonLabel = selection === "auto" ? activeLabel ? `Auto (${activeLabel})` : "Auto" : qualities.find((q) => q.index === selection)?.label ?? "Quality";
|
|
739
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(PlayerMenu, { label: "Quality", buttonLabel, menuKind: "quality", children: [
|
|
740
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
741
|
-
PlayerMenuItem,
|
|
742
|
-
{
|
|
743
|
-
active: selection === "auto",
|
|
744
|
-
menuKind: "quality",
|
|
745
|
-
onSelect: () => onSelect("auto"),
|
|
746
|
-
children: [
|
|
747
|
-
"Auto",
|
|
748
|
-
activeLabel ? ` (${activeLabel})` : ""
|
|
749
|
-
]
|
|
750
|
-
}
|
|
751
|
-
),
|
|
752
|
-
sorted.map((level) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
753
|
-
PlayerMenuItem,
|
|
754
|
-
{
|
|
755
|
-
active: selection === level.index,
|
|
756
|
-
menuKind: "quality",
|
|
757
|
-
onSelect: () => onSelect(level.index),
|
|
758
|
-
children: level.label
|
|
759
|
-
},
|
|
760
|
-
level.index
|
|
761
|
-
))
|
|
762
|
-
] });
|
|
763
|
-
}
|
|
764
|
-
|
|
765
772
|
// src/components/SeekBar.tsx
|
|
766
773
|
var import_react5 = require("react");
|
|
767
|
-
var
|
|
774
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
768
775
|
var INITIAL_HOVER = {
|
|
769
776
|
visible: false,
|
|
770
777
|
time: 0,
|
|
@@ -824,7 +831,7 @@ function SeekBar({
|
|
|
824
831
|
onSeek(max);
|
|
825
832
|
}
|
|
826
833
|
};
|
|
827
|
-
return /* @__PURE__ */ (0,
|
|
834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
828
835
|
"div",
|
|
829
836
|
{
|
|
830
837
|
ref: trackRef,
|
|
@@ -835,28 +842,28 @@ function SeekBar({
|
|
|
835
842
|
onPointerDown,
|
|
836
843
|
role: "presentation",
|
|
837
844
|
children: [
|
|
838
|
-
/* @__PURE__ */ (0,
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
839
846
|
"div",
|
|
840
847
|
{
|
|
841
848
|
className: "nsg-player-seek__buffered",
|
|
842
849
|
style: { width: `${bufferedPct}%` }
|
|
843
850
|
}
|
|
844
851
|
),
|
|
845
|
-
/* @__PURE__ */ (0,
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
846
853
|
"div",
|
|
847
854
|
{
|
|
848
855
|
className: "nsg-player-seek__played",
|
|
849
856
|
style: { width: `${playedPct}%` }
|
|
850
857
|
}
|
|
851
858
|
),
|
|
852
|
-
hover.visible && max > 0 ? /* @__PURE__ */ (0,
|
|
859
|
+
hover.visible && max > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
853
860
|
"div",
|
|
854
861
|
{
|
|
855
862
|
className: "nsg-player-seek__tooltip",
|
|
856
863
|
style: { left: `${hover.percent}%` },
|
|
857
864
|
role: "tooltip",
|
|
858
865
|
children: [
|
|
859
|
-
previewUrl ? /* @__PURE__ */ (0,
|
|
866
|
+
previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
860
867
|
"img",
|
|
861
868
|
{
|
|
862
869
|
className: "nsg-player-seek__preview",
|
|
@@ -869,7 +876,7 @@ function SeekBar({
|
|
|
869
876
|
]
|
|
870
877
|
}
|
|
871
878
|
) : null,
|
|
872
|
-
/* @__PURE__ */ (0,
|
|
879
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
873
880
|
"input",
|
|
874
881
|
{
|
|
875
882
|
ref: seekInputRef,
|
|
@@ -890,38 +897,273 @@ function SeekBar({
|
|
|
890
897
|
);
|
|
891
898
|
}
|
|
892
899
|
|
|
893
|
-
// src/components/
|
|
894
|
-
var
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
900
|
+
// src/components/SettingsMenu.tsx
|
|
901
|
+
var import_react6 = require("react");
|
|
902
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
903
|
+
function SettingsMenu({
|
|
904
|
+
showQuality,
|
|
905
|
+
qualities,
|
|
906
|
+
qualitySelection,
|
|
907
|
+
activeLevel,
|
|
908
|
+
onQualityChange,
|
|
909
|
+
showZoom,
|
|
910
|
+
zoom,
|
|
911
|
+
onZoomChange,
|
|
912
|
+
captions,
|
|
913
|
+
selectedCaption,
|
|
914
|
+
onCaptionChange,
|
|
915
|
+
textTracks,
|
|
916
|
+
selectedTextTrack,
|
|
917
|
+
onTextTrackChange,
|
|
918
|
+
captionStatus
|
|
899
919
|
}) {
|
|
900
|
-
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
920
|
+
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
921
|
+
const [panel, setPanel] = (0, import_react6.useState)("root");
|
|
922
|
+
const rootRef = (0, import_react6.useRef)(null);
|
|
923
|
+
const menuId = (0, import_react6.useId)();
|
|
924
|
+
const qualityLevels = showQuality && qualities.length > 1 ? [...qualities].sort((a, b) => b.height - a.height || b.bitrate - a.bitrate) : [];
|
|
925
|
+
const showQualityRow = qualityLevels.length > 0;
|
|
926
|
+
const showSubtitleRow = captions.length > 0 || textTracks.length > 0;
|
|
927
|
+
const showZoomRow = showZoom;
|
|
928
|
+
const hasRows = showQualityRow || showZoomRow || showSubtitleRow;
|
|
929
|
+
const activeQuality = activeLevel >= 0 ? qualities.find((level) => level.index === activeLevel)?.label : void 0;
|
|
930
|
+
const qualityValue = qualitySelection === "auto" ? activeQuality ? `Auto (${activeQuality})` : "Auto" : qualities.find((level) => level.index === qualitySelection)?.label ?? "Auto";
|
|
931
|
+
const captionValue = selectedCaption ? captions.find((track) => track.language === selectedCaption)?.label ?? "On" : selectedTextTrack === "off" ? "Off" : textTracks.find((track) => track.index === selectedTextTrack)?.label ?? "On";
|
|
932
|
+
(0, import_react6.useEffect)(() => {
|
|
933
|
+
if (!open) return;
|
|
934
|
+
const onPointerDown = (event) => {
|
|
935
|
+
if (!rootRef.current?.contains(event.target)) {
|
|
936
|
+
setOpen(false);
|
|
937
|
+
setPanel("root");
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
const onKeyDown = (event) => {
|
|
941
|
+
if (event.key === "Escape") {
|
|
942
|
+
setOpen(false);
|
|
943
|
+
setPanel("root");
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
document.addEventListener("mousedown", onPointerDown);
|
|
947
|
+
document.addEventListener("keydown", onKeyDown);
|
|
948
|
+
return () => {
|
|
949
|
+
document.removeEventListener("mousedown", onPointerDown);
|
|
950
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
951
|
+
};
|
|
952
|
+
}, [open]);
|
|
953
|
+
if (!hasRows) return null;
|
|
954
|
+
const title = panel === "quality" ? "Quality" : panel === "zoom" ? "Zoom" : panel === "subtitles" ? "Subtitles" : "Settings";
|
|
955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref: rootRef, className: "nsg-player-menu", children: [
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
957
|
+
"button",
|
|
905
958
|
{
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
959
|
+
type: "button",
|
|
960
|
+
className: "nsg-player-btn",
|
|
961
|
+
"aria-label": "Settings",
|
|
962
|
+
"aria-haspopup": "menu",
|
|
963
|
+
"aria-expanded": open,
|
|
964
|
+
"aria-controls": menuId,
|
|
965
|
+
onClick: (event) => {
|
|
966
|
+
event.stopPropagation();
|
|
967
|
+
setOpen((current) => {
|
|
968
|
+
if (current) setPanel("root");
|
|
969
|
+
return !current;
|
|
970
|
+
});
|
|
971
|
+
},
|
|
972
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SettingsIcon, {})
|
|
909
973
|
}
|
|
910
974
|
),
|
|
911
|
-
|
|
912
|
-
|
|
975
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
976
|
+
"div",
|
|
913
977
|
{
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
978
|
+
id: menuId,
|
|
979
|
+
role: "menu",
|
|
980
|
+
"aria-label": title,
|
|
981
|
+
className: "nsg-player-menu__panel nsg-player-settings",
|
|
982
|
+
onClick: (event) => event.stopPropagation(),
|
|
983
|
+
children: panel === "root" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
984
|
+
showQualityRow ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
985
|
+
"button",
|
|
986
|
+
{
|
|
987
|
+
type: "button",
|
|
988
|
+
role: "menuitem",
|
|
989
|
+
className: "nsg-player-menu__item nsg-player-settings__row",
|
|
990
|
+
onClick: () => setPanel("quality"),
|
|
991
|
+
children: [
|
|
992
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "nsg-player-settings__name", children: [
|
|
993
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(QualityIcon, {}),
|
|
994
|
+
"Quality"
|
|
995
|
+
] }),
|
|
996
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "nsg-player-settings__value", children: qualityValue })
|
|
997
|
+
]
|
|
998
|
+
}
|
|
999
|
+
) : null,
|
|
1000
|
+
showZoomRow ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1001
|
+
"button",
|
|
1002
|
+
{
|
|
1003
|
+
type: "button",
|
|
1004
|
+
role: "menuitem",
|
|
1005
|
+
className: "nsg-player-menu__item nsg-player-settings__row",
|
|
1006
|
+
onClick: () => setPanel("zoom"),
|
|
1007
|
+
children: [
|
|
1008
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "nsg-player-settings__name", children: [
|
|
1009
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ZoomIcon, {}),
|
|
1010
|
+
"Zoom"
|
|
1011
|
+
] }),
|
|
1012
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "nsg-player-settings__value", children: [
|
|
1013
|
+
zoom,
|
|
1014
|
+
"\xD7"
|
|
1015
|
+
] })
|
|
1016
|
+
]
|
|
1017
|
+
}
|
|
1018
|
+
) : null,
|
|
1019
|
+
showSubtitleRow ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1020
|
+
"button",
|
|
1021
|
+
{
|
|
1022
|
+
type: "button",
|
|
1023
|
+
role: "menuitem",
|
|
1024
|
+
className: "nsg-player-menu__item nsg-player-settings__row",
|
|
1025
|
+
onClick: () => setPanel("subtitles"),
|
|
1026
|
+
children: [
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "nsg-player-settings__name", children: [
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SubtitlesIcon, {}),
|
|
1029
|
+
"Subtitles"
|
|
1030
|
+
] }),
|
|
1031
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "nsg-player-settings__value", children: captionValue })
|
|
1032
|
+
]
|
|
1033
|
+
}
|
|
1034
|
+
) : null
|
|
1035
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1036
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "nsg-player-settings__header", children: [
|
|
1037
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1038
|
+
"button",
|
|
1039
|
+
{
|
|
1040
|
+
type: "button",
|
|
1041
|
+
className: "nsg-player-settings__back",
|
|
1042
|
+
"aria-label": "Back",
|
|
1043
|
+
onClick: () => setPanel("root"),
|
|
1044
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BackIcon, {})
|
|
1045
|
+
}
|
|
1046
|
+
),
|
|
1047
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: title })
|
|
1048
|
+
] }),
|
|
1049
|
+
panel === "quality" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1051
|
+
Option,
|
|
1052
|
+
{
|
|
1053
|
+
active: qualitySelection === "auto",
|
|
1054
|
+
onSelect: () => onQualityChange("auto"),
|
|
1055
|
+
children: [
|
|
1056
|
+
"Auto",
|
|
1057
|
+
activeQuality ? ` (${activeQuality})` : ""
|
|
1058
|
+
]
|
|
1059
|
+
}
|
|
1060
|
+
),
|
|
1061
|
+
qualityLevels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1062
|
+
Option,
|
|
1063
|
+
{
|
|
1064
|
+
active: qualitySelection === level.index,
|
|
1065
|
+
onSelect: () => onQualityChange(level.index),
|
|
1066
|
+
children: level.label
|
|
1067
|
+
},
|
|
1068
|
+
level.index
|
|
1069
|
+
))
|
|
1070
|
+
] }) : null,
|
|
1071
|
+
panel === "zoom" ? ZOOM_STEPS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1072
|
+
Option,
|
|
1073
|
+
{
|
|
1074
|
+
active: zoom === level,
|
|
1075
|
+
onSelect: () => onZoomChange(level),
|
|
1076
|
+
children: [
|
|
1077
|
+
level,
|
|
1078
|
+
"\xD7"
|
|
1079
|
+
]
|
|
1080
|
+
},
|
|
1081
|
+
level
|
|
1082
|
+
)) : null,
|
|
1083
|
+
panel === "subtitles" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1085
|
+
Option,
|
|
1086
|
+
{
|
|
1087
|
+
active: !selectedCaption && selectedTextTrack === "off",
|
|
1088
|
+
onSelect: () => {
|
|
1089
|
+
onCaptionChange?.(null);
|
|
1090
|
+
onTextTrackChange("off");
|
|
1091
|
+
},
|
|
1092
|
+
children: "Off"
|
|
1093
|
+
}
|
|
1094
|
+
),
|
|
1095
|
+
captions.map((track) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1096
|
+
Option,
|
|
1097
|
+
{
|
|
1098
|
+
active: selectedCaption === track.language,
|
|
1099
|
+
onSelect: () => {
|
|
1100
|
+
onTextTrackChange("off");
|
|
1101
|
+
onCaptionChange?.(track.language);
|
|
1102
|
+
},
|
|
1103
|
+
children: [
|
|
1104
|
+
track.label,
|
|
1105
|
+
track.generated ? " (auto)" : ""
|
|
1106
|
+
]
|
|
1107
|
+
},
|
|
1108
|
+
track.language
|
|
1109
|
+
)),
|
|
1110
|
+
captions.length === 0 ? textTracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1111
|
+
Option,
|
|
1112
|
+
{
|
|
1113
|
+
active: selectedTextTrack === track.index,
|
|
1114
|
+
onSelect: () => onTextTrackChange(track.index),
|
|
1115
|
+
children: track.label
|
|
1116
|
+
},
|
|
1117
|
+
track.id
|
|
1118
|
+
)) : null,
|
|
1119
|
+
captionStatus ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "nsg-player-settings__status", children: captionStatus }) : null
|
|
1120
|
+
] }) : null
|
|
1121
|
+
] })
|
|
1122
|
+
}
|
|
1123
|
+
) : null
|
|
920
1124
|
] });
|
|
921
1125
|
}
|
|
1126
|
+
function Option({
|
|
1127
|
+
active,
|
|
1128
|
+
children,
|
|
1129
|
+
onSelect
|
|
1130
|
+
}) {
|
|
1131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1132
|
+
"button",
|
|
1133
|
+
{
|
|
1134
|
+
type: "button",
|
|
1135
|
+
role: "menuitemradio",
|
|
1136
|
+
"aria-checked": active,
|
|
1137
|
+
className: "nsg-player-menu__item nsg-player-settings__row",
|
|
1138
|
+
onClick: (event) => {
|
|
1139
|
+
event.stopPropagation();
|
|
1140
|
+
onSelect();
|
|
1141
|
+
},
|
|
1142
|
+
children: [
|
|
1143
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "nsg-player-settings__check", "aria-hidden": true, children: active ? "\u2713" : "" }),
|
|
1144
|
+
children
|
|
1145
|
+
]
|
|
1146
|
+
}
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
function QualityIcon() {
|
|
1150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M4 6h16v10H4V6zm2 2v6h12V8H6zm3 10h6v2H9v-2z" }) });
|
|
1151
|
+
}
|
|
1152
|
+
function ZoomIcon() {
|
|
1153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M15.5 14h-.8l-.3-.3a6 6 0 1 0-.7.7l.3.3v.8l4.5 4.5 1.5-1.5-4.5-4.5zM10 14.5A4.5 4.5 0 1 1 10 5.5a4.5 4.5 0 0 1 0 9z" }) });
|
|
1154
|
+
}
|
|
1155
|
+
function SubtitlesIcon() {
|
|
1156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M4 5h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zm1.5 5.5h5v1.5h-5v-1.5zm7 0h6v1.5h-6v-1.5zm-7 3.5h3.5V15.5H5.5V14zm5 0H18.5v1.5h-8V14z" }) });
|
|
1157
|
+
}
|
|
1158
|
+
function SettingsIcon() {
|
|
1159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M19.4 13a7.8 7.8 0 0 0 .1-1 7.8 7.8 0 0 0-.1-1l2.1-1.6a.5.5 0 0 0 .1-.7l-2-3.4a.5.5 0 0 0-.6-.2l-2.5 1a7.3 7.3 0 0 0-1.7-1l-.4-2.6a.5.5 0 0 0-.5-.4h-4a.5.5 0 0 0-.5.4l-.4 2.6a7.3 7.3 0 0 0-1.7 1l-2.5-1a.5.5 0 0 0-.6.2l-2 3.4a.5.5 0 0 0 .1.7L4.6 11a7.8 7.8 0 0 0-.1 1 7.8 7.8 0 0 0 .1 1l-2.1 1.6a.5.5 0 0 0-.1.7l2 3.4a.5.5 0 0 0 .6.2l2.5-1a7.3 7.3 0 0 0 1.7 1l.4 2.6a.5.5 0 0 0 .5.4h4a.5.5 0 0 0 .5-.4l.4-2.6a7.3 7.3 0 0 0 1.7-1l2.5 1a.5.5 0 0 0 .6-.2l2-3.4a.5.5 0 0 0-.1-.7L19.4 13zM12 15.5A3.5 3.5 0 1 1 12 8a3.5 3.5 0 0 1 0 7.5z" }) });
|
|
1160
|
+
}
|
|
1161
|
+
function BackIcon() {
|
|
1162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M15.4 7.4 14 6l-6 6 6 6 1.4-1.4L10.8 12z" }) });
|
|
1163
|
+
}
|
|
922
1164
|
|
|
923
1165
|
// src/components/PlayerControlBar.tsx
|
|
924
|
-
var
|
|
1166
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
925
1167
|
function PlayerControlBar(props) {
|
|
926
1168
|
const {
|
|
927
1169
|
config,
|
|
@@ -954,22 +1196,36 @@ function PlayerControlBar(props) {
|
|
|
954
1196
|
onTextTrackChange,
|
|
955
1197
|
onAudioTrackChange,
|
|
956
1198
|
onToggleFullscreen,
|
|
957
|
-
|
|
958
|
-
onZoomOut,
|
|
1199
|
+
onZoomChange,
|
|
959
1200
|
seekBarRef,
|
|
960
|
-
getSeekPreview
|
|
1201
|
+
getSeekPreview,
|
|
1202
|
+
mediaMode = "video",
|
|
1203
|
+
audioAvailable = false,
|
|
1204
|
+
onMediaModeChange,
|
|
1205
|
+
sidecarCaptions = [],
|
|
1206
|
+
selectedSidecar = null,
|
|
1207
|
+
onSidecarChange,
|
|
1208
|
+
captionStatus = null,
|
|
1209
|
+
onPointerEnter,
|
|
1210
|
+
onPointerLeave,
|
|
1211
|
+
onFocusCapture,
|
|
1212
|
+
onBlurCapture
|
|
961
1213
|
} = props;
|
|
962
1214
|
const controls = config.controls;
|
|
963
1215
|
const showZoom = config.player.zoomEnabled && controls.showZoom;
|
|
964
1216
|
const skipSeconds = config.player.skipSeconds;
|
|
965
|
-
return /* @__PURE__ */ (0,
|
|
1217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
966
1218
|
"div",
|
|
967
1219
|
{
|
|
968
1220
|
className: "nsg-player-control-bar",
|
|
969
1221
|
onClick: (event) => event.stopPropagation(),
|
|
970
1222
|
onKeyDown: (event) => event.stopPropagation(),
|
|
1223
|
+
onPointerEnter,
|
|
1224
|
+
onPointerLeave,
|
|
1225
|
+
onFocusCapture,
|
|
1226
|
+
onBlurCapture,
|
|
971
1227
|
children: [
|
|
972
|
-
/* @__PURE__ */ (0,
|
|
1228
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
973
1229
|
SeekBar,
|
|
974
1230
|
{
|
|
975
1231
|
currentTime,
|
|
@@ -980,19 +1236,19 @@ function PlayerControlBar(props) {
|
|
|
980
1236
|
getSeekPreview
|
|
981
1237
|
}
|
|
982
1238
|
),
|
|
983
|
-
/* @__PURE__ */ (0,
|
|
984
|
-
/* @__PURE__ */ (0,
|
|
1239
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "nsg-player-control-row", children: [
|
|
1240
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
985
1241
|
"button",
|
|
986
1242
|
{
|
|
987
1243
|
type: "button",
|
|
988
1244
|
className: "nsg-player-btn",
|
|
989
1245
|
"aria-label": isPlaying ? "Pause" : "Play",
|
|
990
1246
|
onClick: onTogglePlay,
|
|
991
|
-
children: isPlaying ? /* @__PURE__ */ (0,
|
|
1247
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PauseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PlayIcon, {})
|
|
992
1248
|
}
|
|
993
1249
|
),
|
|
994
|
-
controls.showSkip ? /* @__PURE__ */ (0,
|
|
995
|
-
/* @__PURE__ */ (0,
|
|
1250
|
+
controls.showSkip ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1251
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
996
1252
|
"button",
|
|
997
1253
|
{
|
|
998
1254
|
type: "button",
|
|
@@ -1000,10 +1256,10 @@ function PlayerControlBar(props) {
|
|
|
1000
1256
|
style: { color: "var(--player-skip-icon)" },
|
|
1001
1257
|
"aria-label": `Back ${skipSeconds} seconds`,
|
|
1002
1258
|
onClick: () => onSkip("backward"),
|
|
1003
|
-
children: /* @__PURE__ */ (0,
|
|
1259
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkipIcon, { label: String(skipSeconds), forward: false })
|
|
1004
1260
|
}
|
|
1005
1261
|
),
|
|
1006
|
-
/* @__PURE__ */ (0,
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1007
1263
|
"button",
|
|
1008
1264
|
{
|
|
1009
1265
|
type: "button",
|
|
@@ -1011,12 +1267,12 @@ function PlayerControlBar(props) {
|
|
|
1011
1267
|
style: { color: "var(--player-skip-icon)" },
|
|
1012
1268
|
"aria-label": `Forward ${skipSeconds} seconds`,
|
|
1013
1269
|
onClick: () => onSkip("forward"),
|
|
1014
|
-
children: /* @__PURE__ */ (0,
|
|
1270
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkipIcon, { label: String(skipSeconds), forward: true })
|
|
1015
1271
|
}
|
|
1016
1272
|
)
|
|
1017
1273
|
] }) : null,
|
|
1018
|
-
controls.showVolume ? /* @__PURE__ */ (0,
|
|
1019
|
-
/* @__PURE__ */ (0,
|
|
1274
|
+
controls.showVolume ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "nsg-player-volume", children: [
|
|
1275
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1020
1276
|
"button",
|
|
1021
1277
|
{
|
|
1022
1278
|
type: "button",
|
|
@@ -1024,10 +1280,10 @@ function PlayerControlBar(props) {
|
|
|
1024
1280
|
style: { color: "var(--player-volume-icon)" },
|
|
1025
1281
|
"aria-label": muted || volume === 0 ? "Unmute" : "Mute",
|
|
1026
1282
|
onClick: onToggleMute,
|
|
1027
|
-
children: muted || volume === 0 ? /* @__PURE__ */ (0,
|
|
1283
|
+
children: muted || volume === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MuteIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(VolumeIcon, {})
|
|
1028
1284
|
}
|
|
1029
1285
|
),
|
|
1030
|
-
/* @__PURE__ */ (0,
|
|
1286
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1031
1287
|
"input",
|
|
1032
1288
|
{
|
|
1033
1289
|
type: "range",
|
|
@@ -1041,53 +1297,25 @@ function PlayerControlBar(props) {
|
|
|
1041
1297
|
}
|
|
1042
1298
|
)
|
|
1043
1299
|
] }) : null,
|
|
1044
|
-
/* @__PURE__ */ (0,
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "nsg-player-time", children: [
|
|
1045
1301
|
formatPlaybackTime(currentTime),
|
|
1046
1302
|
" / ",
|
|
1047
1303
|
formatPlaybackTime(duration)
|
|
1048
1304
|
] }),
|
|
1049
|
-
controls.showLive && isLive ? /* @__PURE__ */ (0,
|
|
1050
|
-
/* @__PURE__ */ (0,
|
|
1051
|
-
|
|
1052
|
-
"
|
|
1305
|
+
controls.showLive && isLive ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LiveBadgeButton, { atLiveEdge, onGoToLive }) : null,
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "nsg-player-control-row-end", children: [
|
|
1307
|
+
onMediaModeChange && audioAvailable ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1308
|
+
"button",
|
|
1053
1309
|
{
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
"aria-label":
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { fontVariantNumeric: "tabular-nums" }, children: [
|
|
1061
|
-
zoom,
|
|
1062
|
-
"\xD7"
|
|
1063
|
-
] })
|
|
1064
|
-
] }),
|
|
1065
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1066
|
-
"button",
|
|
1067
|
-
{
|
|
1068
|
-
type: "button",
|
|
1069
|
-
className: "nsg-player-btn",
|
|
1070
|
-
"aria-label": `Zoom out (current ${zoom}\xD7)`,
|
|
1071
|
-
disabled: zoom <= 1,
|
|
1072
|
-
onClick: onZoomOut,
|
|
1073
|
-
children: "\u2212"
|
|
1074
|
-
}
|
|
1075
|
-
),
|
|
1076
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1077
|
-
"button",
|
|
1078
|
-
{
|
|
1079
|
-
type: "button",
|
|
1080
|
-
className: "nsg-player-btn",
|
|
1081
|
-
"aria-label": `Zoom in (current ${zoom}\xD7)`,
|
|
1082
|
-
disabled: zoom >= 2,
|
|
1083
|
-
onClick: onZoomIn,
|
|
1084
|
-
children: "+"
|
|
1085
|
-
}
|
|
1086
|
-
)
|
|
1087
|
-
]
|
|
1310
|
+
type: "button",
|
|
1311
|
+
className: "nsg-player-btn",
|
|
1312
|
+
"aria-label": mediaMode === "audio" ? "Switch to video" : "Listen to audio",
|
|
1313
|
+
"aria-pressed": mediaMode === "audio",
|
|
1314
|
+
onClick: () => onMediaModeChange(mediaMode === "audio" ? "video" : "audio"),
|
|
1315
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AudioModeIcon, { active: mediaMode === "audio" })
|
|
1088
1316
|
}
|
|
1089
1317
|
) : null,
|
|
1090
|
-
controls.showSpeed && !isLive ? /* @__PURE__ */ (0,
|
|
1318
|
+
controls.showSpeed && !isLive ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1091
1319
|
PlaybackSpeedSelector,
|
|
1092
1320
|
{
|
|
1093
1321
|
rate: playbackRate,
|
|
@@ -1095,24 +1323,27 @@ function PlayerControlBar(props) {
|
|
|
1095
1323
|
onSelect: onPlaybackRateChange
|
|
1096
1324
|
}
|
|
1097
1325
|
) : null,
|
|
1098
|
-
|
|
1099
|
-
|
|
1326
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1327
|
+
SettingsMenu,
|
|
1100
1328
|
{
|
|
1329
|
+
showQuality: controls.showQuality && mediaMode !== "audio",
|
|
1101
1330
|
qualities,
|
|
1102
|
-
|
|
1331
|
+
qualitySelection,
|
|
1103
1332
|
activeLevel,
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1333
|
+
onQualityChange,
|
|
1334
|
+
showZoom,
|
|
1335
|
+
zoom,
|
|
1336
|
+
onZoomChange,
|
|
1337
|
+
captions: mediaMode === "audio" ? [] : sidecarCaptions,
|
|
1338
|
+
selectedCaption: selectedSidecar,
|
|
1339
|
+
onCaptionChange: onSidecarChange,
|
|
1340
|
+
textTracks: controls.showCaptions && mediaMode !== "audio" ? textTracks : [],
|
|
1341
|
+
selectedTextTrack,
|
|
1342
|
+
onTextTrackChange,
|
|
1343
|
+
captionStatus
|
|
1113
1344
|
}
|
|
1114
|
-
)
|
|
1115
|
-
controls.showAudio ? /* @__PURE__ */ (0,
|
|
1345
|
+
),
|
|
1346
|
+
controls.showAudio && mediaMode !== "audio" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1116
1347
|
AudioTrackSelector,
|
|
1117
1348
|
{
|
|
1118
1349
|
tracks: audioTracks,
|
|
@@ -1120,7 +1351,7 @@ function PlayerControlBar(props) {
|
|
|
1120
1351
|
onSelect: onAudioTrackChange
|
|
1121
1352
|
}
|
|
1122
1353
|
) : null,
|
|
1123
|
-
controls.showFullscreen ? /* @__PURE__ */ (0,
|
|
1354
|
+
controls.showFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1124
1355
|
"button",
|
|
1125
1356
|
{
|
|
1126
1357
|
type: "button",
|
|
@@ -1136,27 +1367,40 @@ function PlayerControlBar(props) {
|
|
|
1136
1367
|
}
|
|
1137
1368
|
);
|
|
1138
1369
|
}
|
|
1370
|
+
function AudioModeIcon({ active }) {
|
|
1371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1372
|
+
"svg",
|
|
1373
|
+
{
|
|
1374
|
+
width: "18",
|
|
1375
|
+
height: "18",
|
|
1376
|
+
viewBox: "0 0 24 24",
|
|
1377
|
+
fill: active ? "var(--player-quality-active-text, currentColor)" : "currentColor",
|
|
1378
|
+
"aria-hidden": true,
|
|
1379
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M12 3a9 9 0 0 0-9 9v7a2 2 0 0 0 2 2h2v-8H5v-1a7 7 0 0 1 14 0v1h-2v8h2a2 2 0 0 0 2-2v-7a9 9 0 0 0-9-9z" })
|
|
1380
|
+
}
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1139
1383
|
function PlayIcon() {
|
|
1140
|
-
return /* @__PURE__ */ (0,
|
|
1384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M8 5v14l11-7z" }) });
|
|
1141
1385
|
}
|
|
1142
1386
|
function PauseIcon() {
|
|
1143
|
-
return /* @__PURE__ */ (0,
|
|
1387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M6 5h4v14H6zm8 0h4v14h-4z" }) });
|
|
1144
1388
|
}
|
|
1145
1389
|
function SkipIcon({ label, forward }) {
|
|
1146
|
-
return /* @__PURE__ */ (0,
|
|
1147
|
-
/* @__PURE__ */ (0,
|
|
1148
|
-
/* @__PURE__ */ (0,
|
|
1390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { style: { display: "flex", flexDirection: "column", alignItems: "center", lineHeight: 1 }, children: [
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: "16", height: "14", viewBox: "0 0 24 16", fill: "currentColor", "aria-hidden": true, children: forward ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M3 2v12l9-6-9-6zm9 0v12l9-6-9-6z" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M12 2v12L3 8l9-6zm9 0v12l-9-6 9-6z" }) }),
|
|
1392
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { fontSize: 9, fontWeight: 700 }, children: label })
|
|
1149
1393
|
] });
|
|
1150
1394
|
}
|
|
1151
1395
|
function VolumeIcon() {
|
|
1152
|
-
return /* @__PURE__ */ (0,
|
|
1396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M3 10v4h4l5 5V5L7 10H3zm13.5 2a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4z" }) });
|
|
1153
1397
|
}
|
|
1154
1398
|
function MuteIcon() {
|
|
1155
|
-
return /* @__PURE__ */ (0,
|
|
1399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M16.5 12a4.5 4.5 0 0 0-2.5-4v2.2l2.5 2.5V12zm3.5 0c0 .9-.2 1.7-.5 2.5l1.5 1.5c.6-1.2 1-2.6 1-4 0-3.2-1.8-5.9-4.5-7.2v2.2c1.8 1.1 3 3 3 5.2zM3.3 2 2 3.3 7.7 9H3v6h4l5 5v-6.7l6.7 6.7 1.3-1.3L3.3 2zM14 5l-2.1 2.1L14 9.2V5z" }) });
|
|
1156
1400
|
}
|
|
1157
1401
|
|
|
1158
1402
|
// src/components/PlayerSkipCue.tsx
|
|
1159
|
-
var
|
|
1403
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1160
1404
|
function PlayerSkipCue({
|
|
1161
1405
|
direction,
|
|
1162
1406
|
cueId,
|
|
@@ -1165,14 +1409,14 @@ function PlayerSkipCue({
|
|
|
1165
1409
|
if (!direction) return null;
|
|
1166
1410
|
const isForward = direction === "forward";
|
|
1167
1411
|
const label = isForward ? `+${seconds}` : `-${seconds}`;
|
|
1168
|
-
return /* @__PURE__ */ (0,
|
|
1412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1169
1413
|
"div",
|
|
1170
1414
|
{
|
|
1171
1415
|
className: `nsg-player-skip-cue ${isForward ? "nsg-player-skip-cue--forward" : "nsg-player-skip-cue--backward"}`,
|
|
1172
1416
|
"aria-hidden": true,
|
|
1173
|
-
children: /* @__PURE__ */ (0,
|
|
1174
|
-
/* @__PURE__ */ (0,
|
|
1175
|
-
/* @__PURE__ */ (0,
|
|
1417
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "nsg-player-skip-cue-badge", children: [
|
|
1418
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "nsg-player-skip-cue-disc", children: isForward ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M3 6v12l8.5-6L3 6zm9 0v12l8.5-6L12 6z" }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M11.5 12 20 6v12l-8.5-6zm-8.5 0L11 6v12L3 12z" }) }) }),
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: "1.125rem", fontWeight: 600 }, children: label })
|
|
1176
1420
|
] })
|
|
1177
1421
|
},
|
|
1178
1422
|
cueId
|
|
@@ -1180,31 +1424,91 @@ function PlayerSkipCue({
|
|
|
1180
1424
|
}
|
|
1181
1425
|
|
|
1182
1426
|
// src/components/PlayerChrome.tsx
|
|
1183
|
-
var
|
|
1427
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1184
1428
|
function PlayerChrome({
|
|
1185
1429
|
player,
|
|
1186
1430
|
config,
|
|
1187
1431
|
containerRef,
|
|
1188
1432
|
videoSlot,
|
|
1189
1433
|
className,
|
|
1190
|
-
getSeekPreview
|
|
1434
|
+
getSeekPreview,
|
|
1435
|
+
mediaMode,
|
|
1436
|
+
audioAvailable,
|
|
1437
|
+
onMediaModeChange,
|
|
1438
|
+
sidecarCaptions,
|
|
1439
|
+
selectedSidecar,
|
|
1440
|
+
onSidecarChange,
|
|
1441
|
+
captionStatus
|
|
1191
1442
|
}) {
|
|
1192
|
-
const rootRef = (0,
|
|
1193
|
-
const seekBarRef = (0,
|
|
1194
|
-
const skipCueTimerRef = (0,
|
|
1195
|
-
const [skipCue, setSkipCue] = (0,
|
|
1443
|
+
const rootRef = (0, import_react7.useRef)(null);
|
|
1444
|
+
const seekBarRef = (0, import_react7.useRef)(null);
|
|
1445
|
+
const skipCueTimerRef = (0, import_react7.useRef)(null);
|
|
1446
|
+
const [skipCue, setSkipCue] = (0, import_react7.useState)(null);
|
|
1196
1447
|
const controls = usePlayerControls({
|
|
1197
1448
|
player,
|
|
1198
1449
|
config,
|
|
1199
1450
|
containerRef
|
|
1200
1451
|
});
|
|
1452
|
+
const TOOLBAR_IDLE_MS = 5e3;
|
|
1453
|
+
const TOOLBAR_LEAVE_MS = 1200;
|
|
1454
|
+
const [toolbarVisible, setToolbarVisible] = (0, import_react7.useState)(true);
|
|
1455
|
+
const toolbarVisibleRef = (0, import_react7.useRef)(true);
|
|
1456
|
+
const controlsPinnedRef = (0, import_react7.useRef)(false);
|
|
1457
|
+
const idleTimerRef = (0, import_react7.useRef)(null);
|
|
1458
|
+
const clearToolbarIdle = (0, import_react7.useCallback)(() => {
|
|
1459
|
+
if (idleTimerRef.current) {
|
|
1460
|
+
window.clearTimeout(idleTimerRef.current);
|
|
1461
|
+
idleTimerRef.current = null;
|
|
1462
|
+
}
|
|
1463
|
+
}, []);
|
|
1464
|
+
const scheduleToolbarHide = (0, import_react7.useCallback)(
|
|
1465
|
+
(delayMs = TOOLBAR_IDLE_MS) => {
|
|
1466
|
+
clearToolbarIdle();
|
|
1467
|
+
idleTimerRef.current = window.setTimeout(() => {
|
|
1468
|
+
if (controlsPinnedRef.current) return;
|
|
1469
|
+
toolbarVisibleRef.current = false;
|
|
1470
|
+
setToolbarVisible(false);
|
|
1471
|
+
}, delayMs);
|
|
1472
|
+
},
|
|
1473
|
+
[clearToolbarIdle]
|
|
1474
|
+
);
|
|
1475
|
+
const revealToolbar = (0, import_react7.useCallback)(() => {
|
|
1476
|
+
if (!toolbarVisibleRef.current) {
|
|
1477
|
+
toolbarVisibleRef.current = true;
|
|
1478
|
+
setToolbarVisible(true);
|
|
1479
|
+
}
|
|
1480
|
+
if (!controlsPinnedRef.current) scheduleToolbarHide(TOOLBAR_IDLE_MS);
|
|
1481
|
+
}, [scheduleToolbarHide]);
|
|
1482
|
+
(0, import_react7.useEffect)(() => {
|
|
1483
|
+
if (!controls.showControls) {
|
|
1484
|
+
clearToolbarIdle();
|
|
1485
|
+
toolbarVisibleRef.current = false;
|
|
1486
|
+
setToolbarVisible(false);
|
|
1487
|
+
return;
|
|
1488
|
+
}
|
|
1489
|
+
revealToolbar();
|
|
1490
|
+
return clearToolbarIdle;
|
|
1491
|
+
}, [controls.showControls, revealToolbar, clearToolbarIdle]);
|
|
1492
|
+
const pinToolbar = (0, import_react7.useCallback)(() => {
|
|
1493
|
+
controlsPinnedRef.current = true;
|
|
1494
|
+
clearToolbarIdle();
|
|
1495
|
+
if (!toolbarVisibleRef.current) {
|
|
1496
|
+
toolbarVisibleRef.current = true;
|
|
1497
|
+
setToolbarVisible(true);
|
|
1498
|
+
}
|
|
1499
|
+
}, [clearToolbarIdle]);
|
|
1500
|
+
const releaseToolbar = (0, import_react7.useCallback)(() => {
|
|
1501
|
+
controlsPinnedRef.current = false;
|
|
1502
|
+
scheduleToolbarHide(TOOLBAR_IDLE_MS);
|
|
1503
|
+
}, [scheduleToolbarHide]);
|
|
1201
1504
|
const overlay = resolvePlayerOverlay({
|
|
1202
1505
|
showControls: controls.showControls,
|
|
1203
1506
|
isPlaying: controls.isPlaying,
|
|
1204
1507
|
muted: controls.muted,
|
|
1205
|
-
volume: controls.volume
|
|
1508
|
+
volume: controls.volume,
|
|
1509
|
+
mediaMode
|
|
1206
1510
|
});
|
|
1207
|
-
const flashSkipCue = (0,
|
|
1511
|
+
const flashSkipCue = (0, import_react7.useCallback)(
|
|
1208
1512
|
(direction) => {
|
|
1209
1513
|
setSkipCue({ direction, id: Date.now() });
|
|
1210
1514
|
if (skipCueTimerRef.current) window.clearTimeout(skipCueTimerRef.current);
|
|
@@ -1215,7 +1519,7 @@ function PlayerChrome({
|
|
|
1215
1519
|
},
|
|
1216
1520
|
[config.controls.seekCueDurationMs]
|
|
1217
1521
|
);
|
|
1218
|
-
const skip = (0,
|
|
1522
|
+
const skip = (0, import_react7.useCallback)(
|
|
1219
1523
|
(direction) => {
|
|
1220
1524
|
if (!config.controls.showSkip) return;
|
|
1221
1525
|
const delta = direction === "forward" ? config.player.skipSeconds : -config.player.skipSeconds;
|
|
@@ -1229,21 +1533,23 @@ function PlayerChrome({
|
|
|
1229
1533
|
flashSkipCue
|
|
1230
1534
|
]
|
|
1231
1535
|
);
|
|
1232
|
-
(0,
|
|
1536
|
+
(0, import_react7.useEffect)(() => {
|
|
1233
1537
|
return () => {
|
|
1234
1538
|
if (skipCueTimerRef.current) window.clearTimeout(skipCueTimerRef.current);
|
|
1235
1539
|
};
|
|
1236
1540
|
}, []);
|
|
1237
|
-
(0,
|
|
1541
|
+
(0, import_react7.useEffect)(() => {
|
|
1238
1542
|
const root = rootRef.current;
|
|
1239
|
-
if (!root || !controls.showControls
|
|
1543
|
+
if (!root || !controls.showControls) {
|
|
1240
1544
|
return;
|
|
1241
1545
|
}
|
|
1242
1546
|
const onKeyDown = (event) => {
|
|
1547
|
+
revealToolbar();
|
|
1243
1548
|
const target = event.target;
|
|
1244
1549
|
if (target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable)) {
|
|
1245
1550
|
return;
|
|
1246
1551
|
}
|
|
1552
|
+
if (!config.controls.keyboardShortcuts) return;
|
|
1247
1553
|
switch (event.key) {
|
|
1248
1554
|
case " ":
|
|
1249
1555
|
case "k":
|
|
@@ -1300,17 +1606,44 @@ function PlayerChrome({
|
|
|
1300
1606
|
root.tabIndex = 0;
|
|
1301
1607
|
root.addEventListener("keydown", onKeyDown);
|
|
1302
1608
|
return () => root.removeEventListener("keydown", onKeyDown);
|
|
1303
|
-
}, [controls, config, skip]);
|
|
1304
|
-
|
|
1609
|
+
}, [controls, config, skip, revealToolbar]);
|
|
1610
|
+
const showEdge = canShowEdgeProgress({
|
|
1611
|
+
showControls: controls.showControls,
|
|
1612
|
+
toolbarVisible,
|
|
1613
|
+
currentTime: controls.currentTime,
|
|
1614
|
+
duration: controls.duration,
|
|
1615
|
+
bufferedEnd: controls.bufferedEnd,
|
|
1616
|
+
isLive: controls.isLive
|
|
1617
|
+
});
|
|
1618
|
+
const edgePct = edgeProgressPercent({
|
|
1619
|
+
currentTime: controls.currentTime,
|
|
1620
|
+
duration: controls.duration,
|
|
1621
|
+
bufferedEnd: controls.bufferedEnd,
|
|
1622
|
+
isLive: controls.isLive,
|
|
1623
|
+
atLiveEdge: controls.atLiveEdge
|
|
1624
|
+
});
|
|
1625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1305
1626
|
"div",
|
|
1306
1627
|
{
|
|
1307
1628
|
ref: rootRef,
|
|
1308
|
-
className: [
|
|
1629
|
+
className: [
|
|
1630
|
+
"nsg-player-root",
|
|
1631
|
+
toolbarVisible ? "nsg-player-root--toolbar-visible" : "nsg-player-root--toolbar-hidden",
|
|
1632
|
+
className
|
|
1633
|
+
].filter(Boolean).join(" "),
|
|
1634
|
+
"data-toolbar-visible": toolbarVisible ? "true" : "false",
|
|
1309
1635
|
role: "region",
|
|
1310
1636
|
"aria-label": "Video player",
|
|
1637
|
+
onPointerEnter: controls.showControls ? revealToolbar : void 0,
|
|
1638
|
+
onPointerMove: controls.showControls ? revealToolbar : void 0,
|
|
1639
|
+
onPointerDown: controls.showControls ? revealToolbar : void 0,
|
|
1640
|
+
onPointerLeave: controls.showControls ? () => {
|
|
1641
|
+
if (controlsPinnedRef.current) return;
|
|
1642
|
+
scheduleToolbarHide(TOOLBAR_LEAVE_MS);
|
|
1643
|
+
} : void 0,
|
|
1311
1644
|
onClick: controls.showControls ? controls.togglePlay : void 0,
|
|
1312
1645
|
children: [
|
|
1313
|
-
/* @__PURE__ */ (0,
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1314
1647
|
"div",
|
|
1315
1648
|
{
|
|
1316
1649
|
className: "nsg-player-video-wrap",
|
|
@@ -1318,16 +1651,17 @@ function PlayerChrome({
|
|
|
1318
1651
|
children: videoSlot
|
|
1319
1652
|
}
|
|
1320
1653
|
),
|
|
1321
|
-
/* @__PURE__ */ (0,
|
|
1654
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1322
1655
|
PlayerCenterOverlay,
|
|
1323
1656
|
{
|
|
1324
1657
|
kind: overlay,
|
|
1325
1658
|
playIconPreset: config.theme.playIconPreset,
|
|
1326
1659
|
onPlay: controls.togglePlay,
|
|
1327
|
-
onEnableAudio: controls.enableAudio
|
|
1660
|
+
onEnableAudio: controls.enableAudio,
|
|
1661
|
+
onReturnToVideo: () => onMediaModeChange?.("video")
|
|
1328
1662
|
}
|
|
1329
1663
|
),
|
|
1330
|
-
/* @__PURE__ */ (0,
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1331
1665
|
PlayerSkipCue,
|
|
1332
1666
|
{
|
|
1333
1667
|
direction: skipCue?.direction ?? null,
|
|
@@ -1336,43 +1670,87 @@ function PlayerChrome({
|
|
|
1336
1670
|
},
|
|
1337
1671
|
skipCue?.id ?? "idle"
|
|
1338
1672
|
),
|
|
1339
|
-
controls.showControls ? /* @__PURE__ */ (0,
|
|
1340
|
-
|
|
1673
|
+
controls.showControls ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1674
|
+
"div",
|
|
1341
1675
|
{
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1676
|
+
className: [
|
|
1677
|
+
"nsg-player-toolbar-slot",
|
|
1678
|
+
toolbarVisible ? "nsg-player-toolbar-slot--visible" : "nsg-player-toolbar-slot--hidden"
|
|
1679
|
+
].join(" "),
|
|
1680
|
+
"aria-hidden": !toolbarVisible,
|
|
1681
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1682
|
+
PlayerControlBar,
|
|
1683
|
+
{
|
|
1684
|
+
config,
|
|
1685
|
+
isPlaying: controls.isPlaying,
|
|
1686
|
+
currentTime: controls.currentTime,
|
|
1687
|
+
duration: controls.duration,
|
|
1688
|
+
bufferedEnd: controls.bufferedEnd,
|
|
1689
|
+
volume: controls.volume,
|
|
1690
|
+
muted: controls.muted,
|
|
1691
|
+
playbackRate: controls.playbackRate,
|
|
1692
|
+
isFullscreen: controls.isFullscreen,
|
|
1693
|
+
zoom: controls.zoom,
|
|
1694
|
+
qualities: controls.qualities,
|
|
1695
|
+
qualitySelection: controls.qualitySelection,
|
|
1696
|
+
activeLevel: controls.activeLevel,
|
|
1697
|
+
textTracks: controls.textTracks,
|
|
1698
|
+
selectedTextTrack: controls.selectedTextTrack,
|
|
1699
|
+
audioTracks: controls.audioTracks,
|
|
1700
|
+
selectedAudioTrack: controls.selectedAudioTrack,
|
|
1701
|
+
onTogglePlay: controls.togglePlay,
|
|
1702
|
+
onSeek: controls.seekTo,
|
|
1703
|
+
onSkip: skip,
|
|
1704
|
+
isLive: controls.isLive,
|
|
1705
|
+
atLiveEdge: controls.atLiveEdge,
|
|
1706
|
+
onGoToLive: controls.goToLive,
|
|
1707
|
+
onVolumeChange: controls.setVolume,
|
|
1708
|
+
onToggleMute: controls.toggleMute,
|
|
1709
|
+
onPlaybackRateChange: controls.setPlaybackRate,
|
|
1710
|
+
onQualityChange: controls.setQuality,
|
|
1711
|
+
onTextTrackChange: controls.setTextTrack,
|
|
1712
|
+
onAudioTrackChange: controls.setAudioTrack,
|
|
1713
|
+
onToggleFullscreen: () => void controls.toggleFullscreen(),
|
|
1714
|
+
onZoomChange: controls.setZoom,
|
|
1715
|
+
seekBarRef,
|
|
1716
|
+
mediaMode,
|
|
1717
|
+
audioAvailable,
|
|
1718
|
+
onMediaModeChange,
|
|
1719
|
+
sidecarCaptions,
|
|
1720
|
+
selectedSidecar,
|
|
1721
|
+
onSidecarChange,
|
|
1722
|
+
captionStatus,
|
|
1723
|
+
getSeekPreview,
|
|
1724
|
+
onPointerEnter: pinToolbar,
|
|
1725
|
+
onPointerLeave: releaseToolbar,
|
|
1726
|
+
onFocusCapture: pinToolbar,
|
|
1727
|
+
onBlurCapture: (event) => {
|
|
1728
|
+
const next = event.relatedTarget;
|
|
1729
|
+
if (next instanceof Node && event.currentTarget.contains(next)) {
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1732
|
+
releaseToolbar();
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
)
|
|
1736
|
+
}
|
|
1737
|
+
) : null,
|
|
1738
|
+
showEdge ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1739
|
+
"div",
|
|
1740
|
+
{
|
|
1741
|
+
className: "nsg-player-edge-progress",
|
|
1742
|
+
"aria-hidden": true,
|
|
1743
|
+
onPointerDown: (event) => {
|
|
1744
|
+
event.stopPropagation();
|
|
1745
|
+
revealToolbar();
|
|
1746
|
+
},
|
|
1747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1748
|
+
"div",
|
|
1749
|
+
{
|
|
1750
|
+
className: "nsg-player-edge-progress__played",
|
|
1751
|
+
style: { width: `${edgePct}%` }
|
|
1752
|
+
}
|
|
1753
|
+
)
|
|
1376
1754
|
}
|
|
1377
1755
|
) : null
|
|
1378
1756
|
]
|
|
@@ -1381,7 +1759,7 @@ function PlayerChrome({
|
|
|
1381
1759
|
}
|
|
1382
1760
|
|
|
1383
1761
|
// src/hooks/usePlaybackWatermark.ts
|
|
1384
|
-
var
|
|
1762
|
+
var import_react8 = require("react");
|
|
1385
1763
|
|
|
1386
1764
|
// src/utils/watermarkSchedule.ts
|
|
1387
1765
|
var WATERMARK_TOP_MIN_PCT = 8;
|
|
@@ -1431,11 +1809,11 @@ function usePlaybackWatermark({
|
|
|
1431
1809
|
intervalMaxMs,
|
|
1432
1810
|
reducedMotion = false
|
|
1433
1811
|
}) {
|
|
1434
|
-
const [state, setState] = (0,
|
|
1435
|
-
const showTimerRef = (0,
|
|
1436
|
-
const hideTimerRef = (0,
|
|
1437
|
-
const generationRef = (0,
|
|
1438
|
-
(0,
|
|
1812
|
+
const [state, setState] = (0, import_react8.useState)(HIDDEN);
|
|
1813
|
+
const showTimerRef = (0, import_react8.useRef)(null);
|
|
1814
|
+
const hideTimerRef = (0, import_react8.useRef)(null);
|
|
1815
|
+
const generationRef = (0, import_react8.useRef)(0);
|
|
1816
|
+
(0, import_react8.useEffect)(() => {
|
|
1439
1817
|
const clearTimers = () => {
|
|
1440
1818
|
if (showTimerRef.current !== null) {
|
|
1441
1819
|
window.clearTimeout(showTimerRef.current);
|
|
@@ -1486,14 +1864,82 @@ function usePlaybackWatermark({
|
|
|
1486
1864
|
return state;
|
|
1487
1865
|
}
|
|
1488
1866
|
|
|
1867
|
+
// src/hooks/useRestoreSubtitleSelection.ts
|
|
1868
|
+
var import_video_nsgplayer_core2 = require("@codenkay/video-nsgplayer-core");
|
|
1869
|
+
var import_react9 = require("react");
|
|
1870
|
+
function useRestoreSubtitleSelection({
|
|
1871
|
+
player,
|
|
1872
|
+
videoRef,
|
|
1873
|
+
language
|
|
1874
|
+
}) {
|
|
1875
|
+
(0, import_react9.useEffect)(() => {
|
|
1876
|
+
if (language === void 0) return;
|
|
1877
|
+
const video = videoRef.current;
|
|
1878
|
+
const apply = () => {
|
|
1879
|
+
const el = videoRef.current;
|
|
1880
|
+
if (el) (0, import_video_nsgplayer_core2.restoreSubtitleSelection)(el, language);
|
|
1881
|
+
};
|
|
1882
|
+
apply();
|
|
1883
|
+
const offs = [];
|
|
1884
|
+
if (player) {
|
|
1885
|
+
let previous = player.getState();
|
|
1886
|
+
offs.push(
|
|
1887
|
+
player.on("ready", apply),
|
|
1888
|
+
player.on("statechange", ({ state }) => {
|
|
1889
|
+
if (previous === "renewing" && state !== "renewing") apply();
|
|
1890
|
+
previous = state;
|
|
1891
|
+
})
|
|
1892
|
+
);
|
|
1893
|
+
}
|
|
1894
|
+
video?.addEventListener("loadedmetadata", apply);
|
|
1895
|
+
return () => {
|
|
1896
|
+
for (const off of offs) off();
|
|
1897
|
+
video?.removeEventListener("loadedmetadata", apply);
|
|
1898
|
+
};
|
|
1899
|
+
}, [player, videoRef, language]);
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
// src/utils/playerError.ts
|
|
1903
|
+
var import_video_nsgplayer_core3 = require("@codenkay/video-nsgplayer-core");
|
|
1904
|
+
var PREPARING_MESSAGE = "Live video is preparing. Please retry shortly.";
|
|
1905
|
+
var GENERIC_ERROR_MESSAGE = "Unable to play this video.";
|
|
1906
|
+
var PLATFORM_LABELS = {
|
|
1907
|
+
android: "Android",
|
|
1908
|
+
ios: "iOS",
|
|
1909
|
+
web: "Web"
|
|
1910
|
+
};
|
|
1911
|
+
function describePlayerError(error) {
|
|
1912
|
+
if (!error) return null;
|
|
1913
|
+
const message = error.message?.trim();
|
|
1914
|
+
if (error.code === import_video_nsgplayer_core3.PLAYBACK_NOT_READY) {
|
|
1915
|
+
return { kind: "preparing", code: error.code, message: message || PREPARING_MESSAGE };
|
|
1916
|
+
}
|
|
1917
|
+
if (error.code === import_video_nsgplayer_core3.PLATFORM_IN_USE) {
|
|
1918
|
+
const label = error.activePlatform ? PLATFORM_LABELS[error.activePlatform] : void 0;
|
|
1919
|
+
return {
|
|
1920
|
+
kind: "platform-in-use",
|
|
1921
|
+
code: error.code,
|
|
1922
|
+
message: message || (label ? `You are already watching video on ${label}.` : "You are already watching video on another device.")
|
|
1923
|
+
};
|
|
1924
|
+
}
|
|
1925
|
+
return {
|
|
1926
|
+
kind: "error",
|
|
1927
|
+
code: error.code,
|
|
1928
|
+
message: message || GENERIC_ERROR_MESSAGE
|
|
1929
|
+
};
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1489
1932
|
// src/NsgVideoPlayerWithControls.tsx
|
|
1490
|
-
var
|
|
1491
|
-
var NsgVideoPlayerWithControls = (0,
|
|
1492
|
-
const containerRef = (0,
|
|
1493
|
-
const onWatchTimeRef = (0,
|
|
1933
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1934
|
+
var NsgVideoPlayerWithControls = (0, import_react10.forwardRef)(function NsgVideoPlayerWithControls2(props, ref) {
|
|
1935
|
+
const containerRef = (0, import_react10.useRef)(null);
|
|
1936
|
+
const onWatchTimeRef = (0, import_react10.useRef)(props.onWatchTime);
|
|
1494
1937
|
onWatchTimeRef.current = props.onWatchTime;
|
|
1495
|
-
const
|
|
1496
|
-
|
|
1938
|
+
const pendingSwitchRef = (0, import_react10.useRef)(null);
|
|
1939
|
+
const switchGenerationRef = (0, import_react10.useRef)(0);
|
|
1940
|
+
const videoIdRef = (0, import_react10.useRef)(props.videoId);
|
|
1941
|
+
const resolvedConfig = (0, import_react10.useMemo)(
|
|
1942
|
+
() => (0, import_video_nsgplayer_core4.mergePlayerConfig)({
|
|
1497
1943
|
...props.config,
|
|
1498
1944
|
controls: {
|
|
1499
1945
|
enabled: true,
|
|
@@ -1515,8 +1961,60 @@ var NsgVideoPlayerWithControls = (0, import_react8.forwardRef)(function NsgVideo
|
|
|
1515
1961
|
onPause: props.onPause,
|
|
1516
1962
|
onAuthError: props.onAuthError
|
|
1517
1963
|
});
|
|
1518
|
-
(0,
|
|
1519
|
-
|
|
1964
|
+
(0, import_react10.useImperativeHandle)(ref, () => player, [player]);
|
|
1965
|
+
const requestMediaMode = (mode) => {
|
|
1966
|
+
if (mode === (props.mediaMode ?? "video")) return;
|
|
1967
|
+
const volume = player?.getVolume() ?? 1;
|
|
1968
|
+
const audible = volume > 0 ? volume : 1;
|
|
1969
|
+
const video = videoRef.current;
|
|
1970
|
+
if (video) {
|
|
1971
|
+
video.muted = false;
|
|
1972
|
+
video.volume = audible;
|
|
1973
|
+
}
|
|
1974
|
+
const playbackState = player?.getState();
|
|
1975
|
+
pendingSwitchRef.current = {
|
|
1976
|
+
time: player?.getCurrentTime() ?? 0,
|
|
1977
|
+
rate: player?.getPlaybackRate() ?? 1,
|
|
1978
|
+
volume: audible,
|
|
1979
|
+
playing: playbackState === "playing" || playbackState === "buffering"
|
|
1980
|
+
};
|
|
1981
|
+
props.onMediaModeChange?.(mode);
|
|
1982
|
+
};
|
|
1983
|
+
(0, import_react10.useEffect)(() => {
|
|
1984
|
+
if (videoIdRef.current !== props.videoId) {
|
|
1985
|
+
videoIdRef.current = props.videoId;
|
|
1986
|
+
pendingSwitchRef.current = null;
|
|
1987
|
+
return;
|
|
1988
|
+
}
|
|
1989
|
+
const pending = pendingSwitchRef.current;
|
|
1990
|
+
if (!pending || !player) return;
|
|
1991
|
+
pendingSwitchRef.current = null;
|
|
1992
|
+
const generation = ++switchGenerationRef.current;
|
|
1993
|
+
player.updateConfig({
|
|
1994
|
+
player: {
|
|
1995
|
+
startPosition: pending.time > 0.25 ? pending.time : 0,
|
|
1996
|
+
startMuted: false,
|
|
1997
|
+
volume: pending.volume,
|
|
1998
|
+
autoplay: pending.playing
|
|
1999
|
+
}
|
|
2000
|
+
});
|
|
2001
|
+
void player.reload().then(() => {
|
|
2002
|
+
if (generation !== switchGenerationRef.current) return;
|
|
2003
|
+
try {
|
|
2004
|
+
if (!player.isLive()) {
|
|
2005
|
+
player.setPlaybackRate(pending.rate);
|
|
2006
|
+
if (pending.time > 0.25 && Math.abs(player.getCurrentTime() - pending.time) > 1.5) {
|
|
2007
|
+
player.seek(pending.time);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
player.unmute();
|
|
2011
|
+
if (player.getVolume() <= 0) player.setVolume(pending.volume);
|
|
2012
|
+
if (pending.playing) void player.play();
|
|
2013
|
+
} catch {
|
|
2014
|
+
}
|
|
2015
|
+
});
|
|
2016
|
+
}, [player, props.mediaMode, props.videoId]);
|
|
2017
|
+
(0, import_react10.useEffect)(() => {
|
|
1520
2018
|
if (!player) return;
|
|
1521
2019
|
const report = () => {
|
|
1522
2020
|
const t = player.getCurrentTime();
|
|
@@ -1533,18 +2031,25 @@ var NsgVideoPlayerWithControls = (0, import_react8.forwardRef)(function NsgVideo
|
|
|
1533
2031
|
window.removeEventListener("beforeunload", onBeforeUnload);
|
|
1534
2032
|
};
|
|
1535
2033
|
}, [player]);
|
|
2034
|
+
useRestoreSubtitleSelection({
|
|
2035
|
+
player,
|
|
2036
|
+
videoRef,
|
|
2037
|
+
language: props.selectedSidecar
|
|
2038
|
+
});
|
|
2039
|
+
const errorDisplay = describePlayerError(error ?? props.leaseError);
|
|
2040
|
+
const watermarkLabel = props.watermarkText?.trim() || resolvedConfig.watermark.text?.trim() || null;
|
|
1536
2041
|
const watermarkActive = state === "playing" || state === "paused" || state === "buffering";
|
|
1537
2042
|
const watermark = usePlaybackWatermark({
|
|
1538
2043
|
enabled: resolvedConfig.watermark.enabled,
|
|
1539
|
-
label:
|
|
2044
|
+
label: watermarkLabel,
|
|
1540
2045
|
active: watermarkActive,
|
|
1541
2046
|
durationMs: resolvedConfig.watermark.durationMs,
|
|
1542
2047
|
intervalMaxMs: resolvedConfig.watermark.intervalMaxMs,
|
|
1543
2048
|
reducedMotion: resolvedConfig.accessibility.reducedMotion
|
|
1544
2049
|
});
|
|
1545
|
-
const cssVars = (0,
|
|
2050
|
+
const cssVars = (0, import_video_nsgplayer_core4.themeToCssVars)(resolvedConfig.theme);
|
|
1546
2051
|
const showBootstrap = state === "loading" || state === "idle";
|
|
1547
|
-
return /* @__PURE__ */ (0,
|
|
2052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1548
2053
|
"div",
|
|
1549
2054
|
{
|
|
1550
2055
|
ref: containerRef,
|
|
@@ -1561,25 +2066,39 @@ var NsgVideoPlayerWithControls = (0, import_react8.forwardRef)(function NsgVideo
|
|
|
1561
2066
|
...props.style
|
|
1562
2067
|
},
|
|
1563
2068
|
children: [
|
|
1564
|
-
/* @__PURE__ */ (0,
|
|
2069
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1565
2070
|
PlayerChrome,
|
|
1566
2071
|
{
|
|
1567
2072
|
player,
|
|
1568
2073
|
config: resolvedConfig,
|
|
1569
2074
|
containerRef,
|
|
1570
2075
|
getSeekPreview: props.getSeekPreview,
|
|
1571
|
-
|
|
2076
|
+
mediaMode: props.mediaMode,
|
|
2077
|
+
audioAvailable: props.audioAvailable,
|
|
2078
|
+
onMediaModeChange: requestMediaMode,
|
|
2079
|
+
sidecarCaptions: props.sidecarCaptions,
|
|
2080
|
+
selectedSidecar: props.selectedSidecar,
|
|
2081
|
+
onSidecarChange: props.onSidecarChange,
|
|
2082
|
+
captionStatus: props.captionStatus,
|
|
2083
|
+
videoSlot: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1572
2084
|
"video",
|
|
1573
2085
|
{
|
|
1574
2086
|
ref: videoRef,
|
|
1575
2087
|
playsInline: true,
|
|
1576
2088
|
preload: "metadata",
|
|
1577
|
-
|
|
2089
|
+
poster: props.mediaMode === "audio" ? props.poster : void 0,
|
|
2090
|
+
style: {
|
|
2091
|
+
width: "100%",
|
|
2092
|
+
height: "100%",
|
|
2093
|
+
display: "block",
|
|
2094
|
+
objectFit: "contain",
|
|
2095
|
+
background: "#000"
|
|
2096
|
+
}
|
|
1578
2097
|
}
|
|
1579
2098
|
)
|
|
1580
2099
|
}
|
|
1581
2100
|
),
|
|
1582
|
-
watermark.visible ? /* @__PURE__ */ (0,
|
|
2101
|
+
watermark.visible ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1583
2102
|
"div",
|
|
1584
2103
|
{
|
|
1585
2104
|
className: "nsg-player-watermark",
|
|
@@ -1588,20 +2107,108 @@ var NsgVideoPlayerWithControls = (0, import_react8.forwardRef)(function NsgVideo
|
|
|
1588
2107
|
top: `${watermark.topPct}%`,
|
|
1589
2108
|
left: `${watermark.leftPct}%`
|
|
1590
2109
|
},
|
|
1591
|
-
children:
|
|
2110
|
+
children: watermarkLabel
|
|
2111
|
+
}
|
|
2112
|
+
) : null,
|
|
2113
|
+
errorDisplay?.kind === "preparing" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2114
|
+
"p",
|
|
2115
|
+
{
|
|
2116
|
+
className: "nsg-player-status nsg-player-status--preparing",
|
|
2117
|
+
role: "status",
|
|
2118
|
+
"data-error-code": errorDisplay.code,
|
|
2119
|
+
children: errorDisplay.message
|
|
2120
|
+
}
|
|
2121
|
+
) : errorDisplay ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2122
|
+
"p",
|
|
2123
|
+
{
|
|
2124
|
+
className: "nsg-player-error",
|
|
2125
|
+
role: "alert",
|
|
2126
|
+
"data-error-code": errorDisplay.code,
|
|
2127
|
+
children: errorDisplay.message
|
|
1592
2128
|
}
|
|
1593
2129
|
) : null,
|
|
1594
|
-
|
|
1595
|
-
showBootstrap && !error ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "nsg-player-status", children: "Loading video\u2026" }) : null
|
|
2130
|
+
showBootstrap && !errorDisplay ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "nsg-player-status", children: "Loading video\u2026" }) : null
|
|
1596
2131
|
]
|
|
1597
2132
|
}
|
|
1598
2133
|
);
|
|
1599
2134
|
});
|
|
2135
|
+
|
|
2136
|
+
// src/components/QualitySelector.tsx
|
|
2137
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2138
|
+
function QualitySelector({
|
|
2139
|
+
qualities,
|
|
2140
|
+
selection,
|
|
2141
|
+
activeLevel,
|
|
2142
|
+
onSelect
|
|
2143
|
+
}) {
|
|
2144
|
+
if (qualities.length <= 1) return null;
|
|
2145
|
+
const sorted = [...qualities].sort(
|
|
2146
|
+
(a, b) => b.height - a.height || b.bitrate - a.bitrate
|
|
2147
|
+
);
|
|
2148
|
+
const activeLabel = activeLevel >= 0 ? qualities.find((q) => q.index === activeLevel)?.label : void 0;
|
|
2149
|
+
const buttonLabel = selection === "auto" ? activeLabel ? `Auto (${activeLabel})` : "Auto" : qualities.find((q) => q.index === selection)?.label ?? "Quality";
|
|
2150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(PlayerMenu, { label: "Quality", buttonLabel, menuKind: "quality", children: [
|
|
2151
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2152
|
+
PlayerMenuItem,
|
|
2153
|
+
{
|
|
2154
|
+
active: selection === "auto",
|
|
2155
|
+
menuKind: "quality",
|
|
2156
|
+
onSelect: () => onSelect("auto"),
|
|
2157
|
+
children: [
|
|
2158
|
+
"Auto",
|
|
2159
|
+
activeLabel ? ` (${activeLabel})` : ""
|
|
2160
|
+
]
|
|
2161
|
+
}
|
|
2162
|
+
),
|
|
2163
|
+
sorted.map((level) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2164
|
+
PlayerMenuItem,
|
|
2165
|
+
{
|
|
2166
|
+
active: selection === level.index,
|
|
2167
|
+
menuKind: "quality",
|
|
2168
|
+
onSelect: () => onSelect(level.index),
|
|
2169
|
+
children: level.label
|
|
2170
|
+
},
|
|
2171
|
+
level.index
|
|
2172
|
+
))
|
|
2173
|
+
] });
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
// src/components/TextTrackSelector.tsx
|
|
2177
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2178
|
+
function TextTrackSelector({
|
|
2179
|
+
tracks,
|
|
2180
|
+
selection,
|
|
2181
|
+
onSelect
|
|
2182
|
+
}) {
|
|
2183
|
+
if (tracks.length === 0) return null;
|
|
2184
|
+
const buttonLabel = selection === "off" ? "CC" : tracks.find((t) => t.index === selection)?.label ?? "CC";
|
|
2185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(PlayerMenu, { label: "Captions", buttonLabel, children: [
|
|
2186
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2187
|
+
PlayerMenuItem,
|
|
2188
|
+
{
|
|
2189
|
+
active: selection === "off",
|
|
2190
|
+
onSelect: () => onSelect("off"),
|
|
2191
|
+
children: "Off"
|
|
2192
|
+
}
|
|
2193
|
+
),
|
|
2194
|
+
tracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2195
|
+
PlayerMenuItem,
|
|
2196
|
+
{
|
|
2197
|
+
active: selection === track.index,
|
|
2198
|
+
onSelect: () => onSelect(track.index),
|
|
2199
|
+
children: track.label
|
|
2200
|
+
},
|
|
2201
|
+
track.id
|
|
2202
|
+
))
|
|
2203
|
+
] });
|
|
2204
|
+
}
|
|
1600
2205
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1601
2206
|
0 && (module.exports = {
|
|
1602
2207
|
AudioTrackSelector,
|
|
2208
|
+
GENERIC_ERROR_MESSAGE,
|
|
1603
2209
|
LiveBadgeButton,
|
|
1604
2210
|
NsgVideoPlayerWithControls,
|
|
2211
|
+
PREPARING_MESSAGE,
|
|
1605
2212
|
PlayIconPreset,
|
|
1606
2213
|
PlaybackSpeedSelector,
|
|
1607
2214
|
PlayerCenterOverlay,
|
|
@@ -1613,8 +2220,10 @@ var NsgVideoPlayerWithControls = (0, import_react8.forwardRef)(function NsgVideo
|
|
|
1613
2220
|
QUALITY_PREFERENCE_STORAGE_KEY,
|
|
1614
2221
|
QualitySelector,
|
|
1615
2222
|
SeekBar,
|
|
2223
|
+
SettingsMenu,
|
|
1616
2224
|
TextTrackSelector,
|
|
1617
2225
|
ZOOM_STEPS,
|
|
2226
|
+
describePlayerError,
|
|
1618
2227
|
formatPlaybackTime,
|
|
1619
2228
|
matchQualityPreference,
|
|
1620
2229
|
nextZoom,
|
|
@@ -1628,6 +2237,7 @@ var NsgVideoPlayerWithControls = (0, import_react8.forwardRef)(function NsgVideo
|
|
|
1628
2237
|
snapPlaybackRate,
|
|
1629
2238
|
usePlaybackWatermark,
|
|
1630
2239
|
usePlayerControls,
|
|
2240
|
+
useRestoreSubtitleSelection,
|
|
1631
2241
|
writeQualityPreference
|
|
1632
2242
|
});
|
|
1633
2243
|
//# sourceMappingURL=index.cjs.map
|