@layers-app/shared 0.4.6 → 0.4.7
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/components/AnimatedFigurePage/AnimatedFigurePage.module.css.js +13 -13
- package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
- package/dist/components/AppContainer/AppContainer.js +79 -72
- package/dist/components/AppContainer/AppContainer.module.css.js +20 -10
- package/dist/components/AppContainer/components/AppsSidebar/DesktopUpdateButton.d.ts +6 -0
- package/dist/components/AppContainer/components/AppsSidebar/DesktopUpdateButton.d.ts.map +1 -0
- package/dist/components/AppContainer/components/AppsSidebar/DesktopUpdateButton.js +161 -0
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.d.ts.map +1 -1
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.js +238 -105
- package/dist/components/AppContainer/components/Main.js +4 -4
- package/dist/components/AppContainer/components/SlideAnimation.js +4 -4
- package/dist/components/AppContainer/components/ToolSidebar.js +9 -9
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.d.ts +62 -1
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.d.ts.map +1 -1
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.js +1107 -137
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.module.css.js +158 -6
- package/dist/components/AppShell/AppShell.module.css.js +5 -5
- package/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.d.ts +2 -0
- package/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.js +22 -17
- package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.d.ts +15 -0
- package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.d.ts.map +1 -0
- package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.js +36 -0
- package/dist/components/AttachmentsGalleryModal/components/GallerySlide.js +22 -22
- package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.d.ts +14 -0
- package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.d.ts.map +1 -0
- package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.js +31 -0
- package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +172 -120
- package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/ShakaPlayer.module.css.js +4 -4
- package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.d.ts +18 -0
- package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.d.ts.map +1 -0
- package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.js +35 -0
- package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.d.ts +33 -0
- package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.d.ts.map +1 -0
- package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.js +70 -0
- package/dist/components/AttachmentsGalleryModal/styles.module.css.js +32 -28
- package/dist/components/AttachmentsPreview/AttachmentsPreview.module.css.js +12 -12
- package/dist/components/BouncingLogo/BouncingLogo.module.css.js +4 -4
- package/dist/components/Chat/CallMessage/CallMessage.module.css.js +8 -8
- package/dist/components/Chat/ChatBubble/ChatBubble.module.css.js +1 -1
- package/dist/components/Chat/ChatHeader/ChatHeader.module.css.js +1 -1
- package/dist/components/Chat/ChatInput/ChatInput.module.css.js +44 -44
- package/dist/components/Chat/ChatLayout/ChatLayout.module.css.js +4 -4
- package/dist/components/Chat/ChatMessage/ChatMessage.module.css.js +10 -10
- package/dist/components/Chat/ChatPill/ChatPill.module.css.js +1 -1
- package/dist/components/Chat/DialogItem/DialogItem.module.css.js +4 -4
- package/dist/components/Chat/DialogList/DialogList.module.css.js +1 -1
- package/dist/components/Chat/MediaDocument/MediaDocument.module.css.js +4 -4
- package/dist/components/Chat/MessageActions/MessageActions.module.css.js +1 -1
- package/dist/components/Chat/MessageActions/index.d.ts.map +1 -1
- package/dist/components/Chat/MessageActions/index.js +38 -37
- package/dist/components/Chat/MessageForward/MessageForward.module.css.js +1 -1
- package/dist/components/Chat/MessageList/MessageList.module.css.js +5 -5
- package/dist/components/Chat/MessageMeta/MessageMeta.module.css.js +3 -3
- package/dist/components/Chat/MessageMeta/index.d.ts.map +1 -1
- package/dist/components/Chat/MessageMeta/index.js +21 -19
- package/dist/components/Chat/MessageReactions/MessageReactions.module.css.js +12 -12
- package/dist/components/Chat/MessageReply/MessageReply.module.css.js +7 -7
- package/dist/components/Chat/MessageStatus/MessageStatus.module.css.js +8 -8
- package/dist/components/Chat/ServiceMessage/ServiceMessage.module.css.js +1 -1
- package/dist/components/CollapsibleContainer/CollapsibleContainer.module.css.js +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +3 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.js +81 -76
- package/dist/components/ColorPicker/ColorPicker.module.css.js +26 -32
- package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerList.js +72 -83
- package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerToolbar.js +64 -67
- package/dist/components/ColorPicker/icons.js +5 -5
- package/dist/components/ColorPicker/types.d.ts +0 -6
- package/dist/components/ColorPicker/types.d.ts.map +1 -1
- package/dist/components/ColorPicker/types.js +11 -53
- package/dist/components/ColorPicker/useRecentColors.d.ts +1 -3
- package/dist/components/ColorPicker/useRecentColors.d.ts.map +1 -1
- package/dist/components/ColorPicker/useRecentColors.js +20 -43
- package/dist/components/CommentComposer/CommentComposer.module.css.js +4 -4
- package/dist/components/CommunitiesDialog/styles.module.css.js +1 -1
- package/dist/components/Copyright/Copyright.module.css.js +1 -1
- package/dist/components/CustomKBD/CustomKBD.module.css.js +1 -1
- package/dist/components/EmojiPicker/EmojiPicker.module.css.js +8 -8
- package/dist/components/EntityTitle/EntityTitle.module.css.js +1 -1
- package/dist/components/ErrorPage/components/Error404.d.ts.map +1 -1
- package/dist/components/FeatureProgress/FeatureProgress.module.css.js +49 -49
- package/dist/components/FilePicker/FilePicker.module.css.js +7 -7
- package/dist/components/FormViewer/FormViewer.module.css.js +20 -20
- package/dist/components/FormViewer/components/fields/DragOptions/DragOptions.module.css.js +1 -1
- package/dist/components/FormViewer/components/fields/DropdownField/DropdownField.module.css.js +1 -1
- package/dist/components/FormViewer/components/fields/EditableContent/EditableContent.module.css.js +1 -1
- package/dist/components/FormViewer/components/fields/SelectableCard/SelectableCard.module.css.js +8 -8
- package/dist/components/FormViewer/components/fields/UploadField/UploadFile/UploadFile.module.css.js +4 -4
- package/dist/components/FormViewer/store/formStore.d.ts.map +1 -1
- package/dist/components/ImageCropper/ImageCropper.module.css.js +38 -38
- package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.d.ts +3 -1
- package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.d.ts.map +1 -1
- package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.js +26 -25
- package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.module.css.js +11 -11
- package/dist/components/LanguagePicker/LanguagePicker.module.css.js +1 -1
- package/dist/components/Loaders/styles.module.css.js +6 -6
- package/dist/components/MediaLibrary/MediaLibrary.module.css.js +2 -2
- package/dist/components/MusicPlayerBar/MusicPlayerBar.module.css.js +23 -23
- package/dist/components/NavMenu/NavMenu.module.css.js +12 -12
- package/dist/components/NavbarResizer/NavbarResizer.module.css.js +2 -2
- package/dist/components/NewToolbar/utils.d.ts +12 -0
- package/dist/components/NewToolbar/utils.d.ts.map +1 -0
- package/dist/components/NotPublicPanel/NotPublicPanel.module.css.js +11 -11
- package/dist/components/Notification/Notification.module.css.js +1 -1
- package/dist/components/OnboardingTour/index.d.ts +1 -1
- package/dist/components/OnboardingTour/index.d.ts.map +1 -1
- package/dist/components/OnboardingTour/useOnboardingTour.d.ts +2 -0
- package/dist/components/OnboardingTour/useOnboardingTour.d.ts.map +1 -1
- package/dist/components/OnboardingTour/useOnboardingTour.js +63 -51
- package/dist/components/PillTabs/PillTabs.module.css.js +1 -1
- package/dist/components/SearchFilters/SearchFilters.module.css.js +1 -1
- package/dist/components/SettingsSection/styles.module.css.js +1 -1
- package/dist/components/StorageUsageProgress/StorageUsageProgress.module.css.js +1 -1
- package/dist/components/TreeIndent/TreeIndent.module.css.js +4 -4
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +24 -0
- package/dist/components/VideoPlayer/VideoPlayer.d.ts.map +1 -0
- package/dist/components/VideoPlayer/VideoPlayer.js +727 -0
- package/dist/components/VideoPlayer/components/MobileDrawer/index.d.ts +8 -0
- package/dist/components/VideoPlayer/components/MobileDrawer/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/MobileDrawer/index.js +67 -0
- package/dist/components/VideoPlayer/components/SelectListOptionButton.d.ts +7 -0
- package/dist/components/VideoPlayer/components/SelectListOptionButton.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/SelectListOptionButton.js +44 -0
- package/dist/components/VideoPlayer/components/StoryboardPreview.d.ts +9 -0
- package/dist/components/VideoPlayer/components/StoryboardPreview.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/StoryboardPreview.js +38 -0
- package/dist/components/VideoPlayer/components/VideoCustomControls.d.ts +33 -0
- package/dist/components/VideoPlayer/components/VideoCustomControls.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoCustomControls.js +601 -0
- package/dist/components/VideoPlayer/components/VideoIcons.d.ts +25 -0
- package/dist/components/VideoPlayer/components/VideoIcons.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoIcons.js +145 -0
- package/dist/components/VideoPlayer/components/VideoMenu.d.ts +27 -0
- package/dist/components/VideoPlayer/components/VideoMenu.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoMenu.js +77 -0
- package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.d.ts +17 -0
- package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.js +289 -0
- package/dist/components/VideoPlayer/components/VideoQualityMenu/index.d.ts +10 -0
- package/dist/components/VideoPlayer/components/VideoQualityMenu/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoQualityMenu/index.js +55 -0
- package/dist/components/VideoPlayer/components/VideoSelect.d.ts +10 -0
- package/dist/components/VideoPlayer/components/VideoSelect.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSelect.js +168 -0
- package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.d.ts +12 -0
- package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.js +48 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.d.ts +25 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.js +384 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.d.ts +21 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.js +264 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.d.ts +10 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.js +39 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.d.ts +14 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.js +360 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitleTrackRow.d.ts +16 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitleTrackRow.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitlesSection.d.ts +14 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitlesSection.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/context.d.ts +4 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/context.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/context.js +14 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/index.d.ts +22 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/index.js +211 -0
- package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.d.ts +11 -0
- package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.js +41 -0
- package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.d.ts +10 -0
- package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.js +69 -0
- package/dist/components/VideoPlayer/hooks/useStoryboard.d.ts +21 -0
- package/dist/components/VideoPlayer/hooks/useStoryboard.d.ts.map +1 -0
- package/dist/components/VideoPlayer/hooks/useStoryboard.js +91 -0
- package/dist/components/VideoPlayer/index.d.ts +11 -0
- package/dist/components/VideoPlayer/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/types.d.ts +101 -0
- package/dist/components/VideoPlayer/types.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/chapters.d.ts +8 -0
- package/dist/components/VideoPlayer/utils/chapters.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/chapters.js +38 -0
- package/dist/components/VideoPlayer/utils/storyboard.d.ts +5 -0
- package/dist/components/VideoPlayer/utils/storyboard.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/storyboard.js +47 -0
- package/dist/components/VideoPlayer/utils/subtitles.d.ts +18 -0
- package/dist/components/VideoPlayer/utils/subtitles.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/subtitles.js +23 -0
- package/dist/components/VideoPlayer/utils/touch.d.ts +3 -0
- package/dist/components/VideoPlayer/utils/touch.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/touch.js +5 -0
- package/dist/components/VideoPlayer/utils/videoPlayerUtils.d.ts +10 -0
- package/dist/components/VideoPlayer/utils/videoPlayerUtils.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/videoPlayerUtils.js +22 -0
- package/dist/components/VideoPlayer/utils/videoSettings.d.ts +69 -0
- package/dist/components/VideoPlayer/utils/videoSettings.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/videoSettings.js +90 -0
- package/dist/components/table/FrontTable.d.ts.map +1 -1
- package/dist/components/table/hooks/useColumnsResizing.d.ts.map +1 -1
- package/dist/config/brand.d.ts.map +1 -1
- package/dist/config/brand.js +29 -29
- package/dist/config/envConfig.d.ts +2 -0
- package/dist/config/envConfig.d.ts.map +1 -1
- package/dist/helpers/showFeatureFeedback.module.css.js +4 -4
- package/dist/helpers/showNotifications.d.ts +8 -14
- package/dist/helpers/showNotifications.d.ts.map +1 -1
- package/dist/helpers/showNotifications.js +107 -111
- package/dist/helpers/showNotifications.module.css.js +4 -16
- package/dist/hooks/useDateUtils.d.ts.map +1 -1
- package/dist/hooks/useDateUtils.js +19 -23
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +589 -575
- package/dist/lang/locales/ui_en.json.js +1 -1
- package/dist/lang/locales/ui_es.json.js +1 -1
- package/dist/lang/locales/ui_ru.json.js +1 -1
- package/dist/videoSettings/createVideoSettingsDataSource.d.ts +19 -0
- package/dist/videoSettings/createVideoSettingsDataSource.d.ts.map +1 -0
- package/dist/videoSettings/createVideoSettingsDataSource.js +127 -0
- package/docs/README.md +499 -499
- package/package.json +79 -78
|
@@ -0,0 +1,727 @@
|
|
|
1
|
+
import { jsx as C, jsxs as me, Fragment as De } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useRef as R, useEffect as d, useCallback as qe, useMemo as Oe } from "react";
|
|
3
|
+
import { useTranslation as We } from "react-i18next";
|
|
4
|
+
import { Flex as Ve } from "@mantine/core";
|
|
5
|
+
import _e from "shaka-player-react";
|
|
6
|
+
import { VideoCustomControls as $e } from "./components/VideoCustomControls.js";
|
|
7
|
+
import { PlayIcon as je } from "./components/VideoIcons.js";
|
|
8
|
+
import { getSettingsSnapshot as x, setSubtitle as ie, setQuality as Xe, setPlaybackRate as Ye } from "./utils/videoSettings.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
function M(T, v) {
|
|
11
|
+
return T ? T.startsWith("http://") || T.startsWith("https://") ? T : T.startsWith("/") ? `${v || window.location.origin}${T}` : T : null;
|
|
12
|
+
}
|
|
13
|
+
function Ge(T) {
|
|
14
|
+
return Array.from(T.textTracks || []).filter(
|
|
15
|
+
(v) => v.kind === "subtitles" || v.kind === "captions"
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function pe(T, v) {
|
|
19
|
+
return T.url ? M(T.url, v) : null;
|
|
20
|
+
}
|
|
21
|
+
function ct({
|
|
22
|
+
source: T,
|
|
23
|
+
videoId: v,
|
|
24
|
+
language: G,
|
|
25
|
+
baseUrl: y,
|
|
26
|
+
storyboard: we,
|
|
27
|
+
chapters: ve,
|
|
28
|
+
subtitles: U,
|
|
29
|
+
onPlayerInfo: ae,
|
|
30
|
+
onFallback: D
|
|
31
|
+
}) {
|
|
32
|
+
const {
|
|
33
|
+
streamUrl: J,
|
|
34
|
+
nativeUrl: B,
|
|
35
|
+
rawUrl: q,
|
|
36
|
+
localBlobUrl: H,
|
|
37
|
+
posterUrl: K,
|
|
38
|
+
optimizedReady: h = !1,
|
|
39
|
+
isProcessing: Ne = !1
|
|
40
|
+
} = T, { t: Q, i18n: Fe } = We(), [m, ye] = b(null), [V, he] = b(null), [ge, ke] = b(null), [L, Z] = b(!1), g = R(null), P = R(null), O = R(null), [s, Ee] = b(null), [W, S] = b(() => x(null, null)), [be, le] = b(!0), [k, se] = b([]), [ce, Te] = b([{ id: null, label: Q("editor.video.settings.off") }]), [z, ue] = b(null), [N, _] = b(null), [Me, Ie] = b(!0), [Se, ee] = b(!1), [te, Ue] = b(0), [oe, de] = b(!1), A = R(!1), ne = R(null), p = R(null), $ = R(null), j = R(
|
|
41
|
+
null
|
|
42
|
+
), re = R([]), Le = R(!1), X = R(/* @__PURE__ */ new Set()), fe = R(null), I = R(!1);
|
|
43
|
+
d(() => {
|
|
44
|
+
G && Fe.changeLanguage(G).catch(() => {
|
|
45
|
+
});
|
|
46
|
+
}, [G]), d(() => {
|
|
47
|
+
if (!v) {
|
|
48
|
+
se([]);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (U != null) {
|
|
52
|
+
const e = (U || []).filter(
|
|
53
|
+
(t) => t.id && !t.isDisabled
|
|
54
|
+
);
|
|
55
|
+
se(e);
|
|
56
|
+
}
|
|
57
|
+
}, [v, U]), d(() => {
|
|
58
|
+
le(!0), fe.current = null;
|
|
59
|
+
}, [v]);
|
|
60
|
+
const Be = qe(() => {
|
|
61
|
+
if (!v || U == null) return;
|
|
62
|
+
const e = (U || []).filter(
|
|
63
|
+
(t) => t.id && !t.isDisabled
|
|
64
|
+
);
|
|
65
|
+
se(e);
|
|
66
|
+
}, [v, U]);
|
|
67
|
+
d(() => {
|
|
68
|
+
if (k.length === 0) {
|
|
69
|
+
Te([
|
|
70
|
+
{ id: null, label: Q("editor.video.settings.off") }
|
|
71
|
+
]), ue(null);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const e = [
|
|
75
|
+
{ id: null, label: Q("editor.video.settings.off") },
|
|
76
|
+
...k.map((t, n) => ({
|
|
77
|
+
id: n,
|
|
78
|
+
label: t.label || t.lang || "Unknown",
|
|
79
|
+
lang: t.lang || void 0,
|
|
80
|
+
isDefault: t.isDefault || !1
|
|
81
|
+
}))
|
|
82
|
+
];
|
|
83
|
+
Te(e), ue(
|
|
84
|
+
(t) => t != null && t >= 0 && t < k.length ? t : null
|
|
85
|
+
);
|
|
86
|
+
}, [k, Q]), d(() => {
|
|
87
|
+
let e = !1;
|
|
88
|
+
const t = g.current?.player || null;
|
|
89
|
+
return h ? (async () => {
|
|
90
|
+
if (!t) return;
|
|
91
|
+
if (z == null) {
|
|
92
|
+
ie(t, null), S(
|
|
93
|
+
x(t, s)
|
|
94
|
+
);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const i = k[z], a = i?.label || i?.lang || "und", l = i?.lang || "und", c = i?.kind || "subtitles", f = t.getTextTracks?.() || [];
|
|
98
|
+
let o = f.find(
|
|
99
|
+
(E) => (E.language || "") === l && (E.label || "") === a && (E.kind || "subtitles") === c
|
|
100
|
+
);
|
|
101
|
+
if (!o && N && (o = f.find(
|
|
102
|
+
(E) => (E.language || "") === N.lang && (E.label || "") === N.label && (E.kind || "subtitles") === N.kind
|
|
103
|
+
)), !o) {
|
|
104
|
+
const E = N && k.length > 0 && k.find(
|
|
105
|
+
(Y) => (Y.lang || "und") === N.lang && (Y.label || Y.lang || "und") === N.label && (Y.kind || "subtitles") === N.kind
|
|
106
|
+
) || null, F = i || E, u = F ? pe(F, y) : null;
|
|
107
|
+
if (!u || typeof t.addTextTrackAsync != "function")
|
|
108
|
+
return;
|
|
109
|
+
let w = null;
|
|
110
|
+
w = await t.addTextTrackAsync(
|
|
111
|
+
u,
|
|
112
|
+
F?.lang || l,
|
|
113
|
+
F?.kind || c,
|
|
114
|
+
"text/vtt",
|
|
115
|
+
void 0,
|
|
116
|
+
F?.label || a
|
|
117
|
+
), w && typeof w.id == "number" && (o = w);
|
|
118
|
+
}
|
|
119
|
+
e || o && (t.selectTextTrack?.(o), t.setTextTrackVisibility?.(!0), S(
|
|
120
|
+
x(t, s)
|
|
121
|
+
));
|
|
122
|
+
})().catch(() => {
|
|
123
|
+
}) : s && (ie(null, z, s), S(x(null, s))), () => {
|
|
124
|
+
e = !0;
|
|
125
|
+
};
|
|
126
|
+
}, [
|
|
127
|
+
z,
|
|
128
|
+
k,
|
|
129
|
+
h,
|
|
130
|
+
s,
|
|
131
|
+
y,
|
|
132
|
+
v,
|
|
133
|
+
N
|
|
134
|
+
]), d(() => {
|
|
135
|
+
if (!m) return;
|
|
136
|
+
let e = !1, t = null;
|
|
137
|
+
const n = (l) => {
|
|
138
|
+
if (e) return;
|
|
139
|
+
M(B, y) || M(q ?? null, y) ? (Z(!0), D?.(!0)) : ke(
|
|
140
|
+
Q("editor.video.player.playbackError", { code: l.code })
|
|
141
|
+
);
|
|
142
|
+
}, r = (l) => {
|
|
143
|
+
const c = l.detail;
|
|
144
|
+
if (c.severity === 2)
|
|
145
|
+
n(c);
|
|
146
|
+
else
|
|
147
|
+
try {
|
|
148
|
+
t?.recover();
|
|
149
|
+
} catch {
|
|
150
|
+
}
|
|
151
|
+
}, i = () => {
|
|
152
|
+
if (t = g.current?.player, !t) {
|
|
153
|
+
const l = requestAnimationFrame(i);
|
|
154
|
+
return () => cancelAnimationFrame(l);
|
|
155
|
+
}
|
|
156
|
+
if ($.current)
|
|
157
|
+
try {
|
|
158
|
+
t.removeEventListener("error", $.current);
|
|
159
|
+
} catch {
|
|
160
|
+
}
|
|
161
|
+
$.current = r, t.addEventListener("error", r), t.load(m).catch((l) => {
|
|
162
|
+
e || l.code !== 7e3 && n(l);
|
|
163
|
+
});
|
|
164
|
+
}, a = requestAnimationFrame(i);
|
|
165
|
+
return () => {
|
|
166
|
+
if (e = !0, cancelAnimationFrame(a), t && $.current)
|
|
167
|
+
try {
|
|
168
|
+
t.removeEventListener("error", $.current);
|
|
169
|
+
} catch {
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}, [m, B, q, y, D]), d(() => {
|
|
173
|
+
let e = !1, t = null;
|
|
174
|
+
if (h && J) {
|
|
175
|
+
const n = M(J, y);
|
|
176
|
+
if (n) {
|
|
177
|
+
if (!V) {
|
|
178
|
+
const f = H || M(q ?? null, y);
|
|
179
|
+
f && he(f);
|
|
180
|
+
}
|
|
181
|
+
if (fe.current === n)
|
|
182
|
+
return;
|
|
183
|
+
const r = P.current;
|
|
184
|
+
r && r.currentTime > 0 && (p.current = {
|
|
185
|
+
time: r.currentTime,
|
|
186
|
+
paused: r.paused
|
|
187
|
+
}, I.current = !0);
|
|
188
|
+
const i = (f) => {
|
|
189
|
+
e || fetch(n, { method: "HEAD", credentials: "include" }).then((o) => {
|
|
190
|
+
e || (fe.current = n, o.ok ? (ye(n), ke(null), Z(!1), D?.(!1), X.current.clear()) : (X.current.clear(), Z(!0), D?.(!0), c(f)));
|
|
191
|
+
}).catch(() => {
|
|
192
|
+
e || (X.current.clear(), Z(!0), D?.(!0), c(f));
|
|
193
|
+
});
|
|
194
|
+
}, a = 10, l = 5e3, c = (f) => {
|
|
195
|
+
e || f >= a || (t = setTimeout(() => i(f + 1), l));
|
|
196
|
+
};
|
|
197
|
+
i(0);
|
|
198
|
+
}
|
|
199
|
+
} else if (H || B) {
|
|
200
|
+
const n = H || M(B, y);
|
|
201
|
+
if (n) {
|
|
202
|
+
if (ne.current === n)
|
|
203
|
+
return;
|
|
204
|
+
const r = P.current;
|
|
205
|
+
if (r && r.readyState > 0 && !r.error && r.src) {
|
|
206
|
+
ne.current = n;
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
ne.current && r && r.currentTime > 0 && (p.current = {
|
|
210
|
+
time: r.currentTime,
|
|
211
|
+
paused: r.paused
|
|
212
|
+
}), he(n), ye(null), ne.current = n;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return () => {
|
|
216
|
+
e = !0, t && clearTimeout(t);
|
|
217
|
+
};
|
|
218
|
+
}, [J, y, h, B, H]), d(() => {
|
|
219
|
+
if (!h || !m) return;
|
|
220
|
+
let e = !1, t = null;
|
|
221
|
+
const n = () => {
|
|
222
|
+
if (e) return;
|
|
223
|
+
const r = g.current?.videoElement;
|
|
224
|
+
if (!r) {
|
|
225
|
+
requestAnimationFrame(n);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const i = () => {
|
|
229
|
+
if (e || r.readyState < 1) return;
|
|
230
|
+
const a = P.current, l = a && a.currentTime > 0 ? a.currentTime : p.current?.time ?? 0;
|
|
231
|
+
l > 0 && Math.abs(r.currentTime - l) > 0.05 && (r.currentTime = l), p.current = null, I.current = !1;
|
|
232
|
+
};
|
|
233
|
+
r.readyState >= 1 ? i() : (r.addEventListener("loadedmetadata", i, {
|
|
234
|
+
once: !0
|
|
235
|
+
}), r.addEventListener("canplay", i, { once: !0 }), t = () => {
|
|
236
|
+
r.removeEventListener("loadedmetadata", i), r.removeEventListener("canplay", i);
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
return n(), () => {
|
|
240
|
+
e = !0, t?.();
|
|
241
|
+
};
|
|
242
|
+
}, [h, m]), d(() => {
|
|
243
|
+
const e = P.current;
|
|
244
|
+
e && m && !L && (A.current = !e.paused, e.currentTime > 0 && (p.current = {
|
|
245
|
+
time: e.currentTime,
|
|
246
|
+
paused: e.paused
|
|
247
|
+
}));
|
|
248
|
+
}, [m, L]), d(() => {
|
|
249
|
+
if (!m || L) {
|
|
250
|
+
de(!1);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
let e = !1, t = null, n = null, r = 0, i = !1;
|
|
254
|
+
const a = 3, l = () => {
|
|
255
|
+
if (e) return;
|
|
256
|
+
const c = g.current?.videoElement;
|
|
257
|
+
if (!c) {
|
|
258
|
+
requestAnimationFrame(l);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const f = () => {
|
|
262
|
+
if (e || !A.current || !c.paused || c.ended) return;
|
|
263
|
+
const u = c.play();
|
|
264
|
+
!u || typeof u.then != "function" || u.then(() => {
|
|
265
|
+
e || !A.current || c.paused && (n && clearTimeout(n), n = setTimeout(() => {
|
|
266
|
+
e || !A.current || !c.paused || r >= a || (r += 1, f());
|
|
267
|
+
}, 250));
|
|
268
|
+
}).catch(() => {
|
|
269
|
+
});
|
|
270
|
+
}, o = () => {
|
|
271
|
+
if (!e && c.readyState >= 2 && !c.seeking) {
|
|
272
|
+
const u = P.current, w = !!(u && !u.paused && !u.ended);
|
|
273
|
+
if (!(A.current && w)) {
|
|
274
|
+
!i && u && Math.abs(c.currentTime - u.currentTime) > 0.1 && (c.currentTime = u.currentTime), i = !0, A.current = !1, de(!0);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
c.paused && u && (i || Math.abs(c.currentTime - u.currentTime) > 0.1 && (c.currentTime = u.currentTime), i = !0, c.muted = !0, f());
|
|
278
|
+
}
|
|
279
|
+
}, E = () => {
|
|
280
|
+
if (e) return;
|
|
281
|
+
const u = P.current;
|
|
282
|
+
u && !u.paused && u.pause(), c.muted && (c.muted = !1), de(!0), A.current = !1, r = 0, n && (clearTimeout(n), n = null);
|
|
283
|
+
}, F = () => {
|
|
284
|
+
if (!(e || !A.current) && !(c.seeking || c.ended) && !(c.readyState < 2)) {
|
|
285
|
+
if (r >= a) {
|
|
286
|
+
A.current = !1;
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
r += 1, f();
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
c.addEventListener("seeked", o), c.addEventListener("canplay", o), c.addEventListener("loadeddata", o), c.addEventListener("playing", o), c.addEventListener("playing", E), c.addEventListener("pause", F), o(), t = () => {
|
|
293
|
+
c.removeEventListener("seeked", o), c.removeEventListener("canplay", o), c.removeEventListener("loadeddata", o), c.removeEventListener("playing", o), c.removeEventListener("playing", E), c.removeEventListener("pause", F);
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
return l(), () => {
|
|
297
|
+
e = !0, n && clearTimeout(n), t?.();
|
|
298
|
+
};
|
|
299
|
+
}, [m, L]), d(() => {
|
|
300
|
+
if (m && !L && oe) {
|
|
301
|
+
const e = g.current?.videoElement || null;
|
|
302
|
+
e && Ee(e);
|
|
303
|
+
} else if (!m || L) {
|
|
304
|
+
const e = P.current;
|
|
305
|
+
if (Ee(e), L && A.current && e && e.paused && !e.ended) {
|
|
306
|
+
const t = () => {
|
|
307
|
+
!A.current || !e.paused || e.ended || e.play().then(() => {
|
|
308
|
+
e.paused || (A.current = !1);
|
|
309
|
+
}).catch(() => {
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
e.readyState >= 2 ? t() : (e.addEventListener("canplay", t, { once: !0 }), e.addEventListener("loadeddata", t, { once: !0 }));
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}, [
|
|
316
|
+
h,
|
|
317
|
+
L,
|
|
318
|
+
m,
|
|
319
|
+
V,
|
|
320
|
+
oe
|
|
321
|
+
]), d(() => {
|
|
322
|
+
if (!s) {
|
|
323
|
+
ee(!1);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
const e = s, t = () => ee(!0), n = () => {
|
|
327
|
+
e.readyState >= 3 && ee(!1);
|
|
328
|
+
}, r = () => ee(!1);
|
|
329
|
+
return e.addEventListener("waiting", t), e.addEventListener("seeking", t), e.addEventListener("seeked", n), e.addEventListener("canplay", n), e.addEventListener("playing", r), () => {
|
|
330
|
+
e.removeEventListener("waiting", t), e.removeEventListener("seeking", t), e.removeEventListener("seeked", n), e.removeEventListener("canplay", n), e.removeEventListener("playing", r);
|
|
331
|
+
};
|
|
332
|
+
}, [s]), d(() => {
|
|
333
|
+
if (!s) return;
|
|
334
|
+
const e = () => {
|
|
335
|
+
Ie(s.paused);
|
|
336
|
+
};
|
|
337
|
+
return e(), s.addEventListener("play", e), s.addEventListener("pause", e), s.addEventListener("ended", e), () => {
|
|
338
|
+
s.removeEventListener("play", e), s.removeEventListener("pause", e), s.removeEventListener("ended", e);
|
|
339
|
+
};
|
|
340
|
+
}, [s]), d(() => {
|
|
341
|
+
const e = O.current;
|
|
342
|
+
if (!e) return;
|
|
343
|
+
const t = new ResizeObserver((n) => {
|
|
344
|
+
const r = n[0];
|
|
345
|
+
r && Ue(Math.round(r.contentRect.width));
|
|
346
|
+
});
|
|
347
|
+
return t.observe(e), () => t.disconnect();
|
|
348
|
+
}, []), d(() => {
|
|
349
|
+
if (!ae) return;
|
|
350
|
+
const e = g.current?.player || null, t = P.current || null, n = O.current || null, r = m && !L && e ? "shaka" : "native";
|
|
351
|
+
let i = null;
|
|
352
|
+
try {
|
|
353
|
+
const a = e?.seekRange?.();
|
|
354
|
+
a && Number.isFinite(a.end) && a.end > 0 && (i = a.end);
|
|
355
|
+
} catch {
|
|
356
|
+
}
|
|
357
|
+
if (i == null && s) {
|
|
358
|
+
const a = s.duration;
|
|
359
|
+
Number.isFinite(a) && a > 0 && (i = a);
|
|
360
|
+
}
|
|
361
|
+
ae({
|
|
362
|
+
shakaPlayer: e,
|
|
363
|
+
nativeVideo: t,
|
|
364
|
+
mode: r,
|
|
365
|
+
containerEl: n,
|
|
366
|
+
videoDuration: i
|
|
367
|
+
});
|
|
368
|
+
}, [
|
|
369
|
+
ae,
|
|
370
|
+
h,
|
|
371
|
+
L,
|
|
372
|
+
m,
|
|
373
|
+
V,
|
|
374
|
+
s
|
|
375
|
+
]), d(() => {
|
|
376
|
+
const e = P.current;
|
|
377
|
+
e && (e.poster = K || "");
|
|
378
|
+
const t = g.current?.videoElement;
|
|
379
|
+
t && (t.poster = K || "");
|
|
380
|
+
}, [K, m, V]), d(() => {
|
|
381
|
+
const e = g.current?.player || null;
|
|
382
|
+
if (!h || !e) {
|
|
383
|
+
S(x(null, s));
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
S(x(e, s));
|
|
387
|
+
}, [h, m, s]), d(() => {
|
|
388
|
+
const e = g.current?.player || null;
|
|
389
|
+
if (!h || !e)
|
|
390
|
+
return;
|
|
391
|
+
const t = () => {
|
|
392
|
+
S(x(e, s));
|
|
393
|
+
}, n = ["variantchanged", "adaptation", "trackschanged"];
|
|
394
|
+
return n.forEach((r) => {
|
|
395
|
+
e.addEventListener?.(r, t);
|
|
396
|
+
}), () => {
|
|
397
|
+
n.forEach((r) => {
|
|
398
|
+
e.removeEventListener?.(r, t);
|
|
399
|
+
});
|
|
400
|
+
};
|
|
401
|
+
}, [h, m, s]), d(() => {
|
|
402
|
+
if (!s) return;
|
|
403
|
+
const e = () => {
|
|
404
|
+
const t = g.current?.player || null;
|
|
405
|
+
S(x(t, s));
|
|
406
|
+
};
|
|
407
|
+
return s.addEventListener("ratechange", e), () => {
|
|
408
|
+
s.removeEventListener("ratechange", e);
|
|
409
|
+
};
|
|
410
|
+
}, [s]), d(() => () => {
|
|
411
|
+
const e = document.pictureInPictureElement;
|
|
412
|
+
if (!e) return;
|
|
413
|
+
const t = g.current?.videoElement || null, n = P.current || null, r = O.current || null, i = e instanceof HTMLVideoElement && (n && n.currentSrc === e.currentSrc || t && t.currentSrc === e.currentSrc);
|
|
414
|
+
(e === t || e === n || r && r.contains(e) || i) && document.exitPictureInPicture?.().catch(() => {
|
|
415
|
+
});
|
|
416
|
+
}, []), d(() => {
|
|
417
|
+
const e = P.current;
|
|
418
|
+
if (!e || !V) return;
|
|
419
|
+
const t = () => {
|
|
420
|
+
p.current && (e.currentTime = p.current.time, p.current.paused || e.play().catch(() => {
|
|
421
|
+
}), I.current = !1);
|
|
422
|
+
};
|
|
423
|
+
e.readyState >= 1 ? t() : e.addEventListener("loadedmetadata", t, {
|
|
424
|
+
once: !0
|
|
425
|
+
});
|
|
426
|
+
const n = () => {
|
|
427
|
+
I.current || (j.current && clearTimeout(j.current), j.current = setTimeout(() => {
|
|
428
|
+
I.current || (p.current || (p.current = { time: 0, paused: !0 }), p.current.time = e.currentTime);
|
|
429
|
+
}, 100));
|
|
430
|
+
}, r = () => {
|
|
431
|
+
I.current || (p.current ? p.current.paused = !1 : p.current = { time: 0, paused: !1 });
|
|
432
|
+
}, i = () => {
|
|
433
|
+
I.current || (p.current ? p.current.paused = !0 : p.current = { time: e.currentTime, paused: !0 });
|
|
434
|
+
};
|
|
435
|
+
return e.addEventListener("timeupdate", n), e.addEventListener("play", r), e.addEventListener("pause", i), () => {
|
|
436
|
+
e.removeEventListener("loadedmetadata", t), e.removeEventListener("timeupdate", n), e.removeEventListener("play", r), e.removeEventListener("pause", i), j.current && clearTimeout(j.current), e.currentTime > 0 && (p.current = {
|
|
437
|
+
time: e.currentTime,
|
|
438
|
+
paused: e.paused
|
|
439
|
+
});
|
|
440
|
+
};
|
|
441
|
+
}, [V]), d(() => {
|
|
442
|
+
if (h) return;
|
|
443
|
+
const e = P.current;
|
|
444
|
+
if (!e) return;
|
|
445
|
+
e.querySelectorAll(
|
|
446
|
+
'track[data-subtitle-track="managed"]'
|
|
447
|
+
).forEach((i) => i.remove()), v && k.forEach((i) => {
|
|
448
|
+
const a = pe(i, y);
|
|
449
|
+
if (!a)
|
|
450
|
+
return;
|
|
451
|
+
const l = document.createElement("track");
|
|
452
|
+
l.setAttribute("data-subtitle-track", "managed"), l.kind = i.kind || "subtitles", l.label = i.label || i.lang || "und", l.srclang = i.lang || "und", l.src = a, l.setAttribute("crossorigin", "use-credentials"), l.default = !1, e.appendChild(l);
|
|
453
|
+
});
|
|
454
|
+
const n = Ge(e);
|
|
455
|
+
n.some((i) => i.mode === "showing") && n.forEach((i) => {
|
|
456
|
+
i.mode = "disabled";
|
|
457
|
+
}), S(x(null, e));
|
|
458
|
+
}, [h, V, k, v, y]), d(() => {
|
|
459
|
+
if (!h) {
|
|
460
|
+
re.current = [];
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
const e = g.current?.player || null;
|
|
464
|
+
if (!e) return;
|
|
465
|
+
const t = e.getNetworkingEngine?.();
|
|
466
|
+
t && !Le.current && (t.registerRequestFilter?.((a, l) => {
|
|
467
|
+
l.allowCrossSiteCredentials = !0;
|
|
468
|
+
}), Le.current = !0), (e.getTextTracks?.() || []).forEach((a) => {
|
|
469
|
+
re.current.includes(a.id) && e.removeTextTrack?.(a);
|
|
470
|
+
}), re.current = [];
|
|
471
|
+
let r = !1;
|
|
472
|
+
return (async () => {
|
|
473
|
+
const a = e.getTextTracks?.() || [];
|
|
474
|
+
if (v)
|
|
475
|
+
for (const l of k) {
|
|
476
|
+
const c = pe(l, y);
|
|
477
|
+
if (!c || typeof e.addTextTrackAsync != "function")
|
|
478
|
+
continue;
|
|
479
|
+
const f = l.label || l.lang || "und", o = l.lang || "und", E = l.kind || "subtitles";
|
|
480
|
+
if (a.some(
|
|
481
|
+
(w) => (w.language || "") === o && (w.label || "") === f && (w.kind || "subtitles") === E
|
|
482
|
+
))
|
|
483
|
+
continue;
|
|
484
|
+
let u = null;
|
|
485
|
+
if (u = await e.addTextTrackAsync(
|
|
486
|
+
c,
|
|
487
|
+
o,
|
|
488
|
+
E,
|
|
489
|
+
"text/vtt",
|
|
490
|
+
void 0,
|
|
491
|
+
f
|
|
492
|
+
), r) return;
|
|
493
|
+
u && typeof u.id == "number" && (re.current.push(u.id), a.push(u));
|
|
494
|
+
}
|
|
495
|
+
e.setTextTrackVisibility?.(!1), S(x(e, s));
|
|
496
|
+
})().catch(() => {
|
|
497
|
+
}), () => {
|
|
498
|
+
r = !0;
|
|
499
|
+
};
|
|
500
|
+
}, [
|
|
501
|
+
h,
|
|
502
|
+
m,
|
|
503
|
+
k,
|
|
504
|
+
v,
|
|
505
|
+
y,
|
|
506
|
+
s
|
|
507
|
+
]);
|
|
508
|
+
const He = Oe(() => ({
|
|
509
|
+
...W,
|
|
510
|
+
subtitles: ce,
|
|
511
|
+
currentSubtitleId: z,
|
|
512
|
+
currentQualityId: be ? null : W.currentQualityId,
|
|
513
|
+
hasRealSubtitles: ce.length > 1
|
|
514
|
+
}), [
|
|
515
|
+
W,
|
|
516
|
+
ce,
|
|
517
|
+
z,
|
|
518
|
+
be
|
|
519
|
+
]), Qe = (e) => {
|
|
520
|
+
if (!s) return;
|
|
521
|
+
e.target.closest(".video-player-controls") !== null || (s.paused ? s.play().catch(() => {
|
|
522
|
+
}) : s.pause());
|
|
523
|
+
};
|
|
524
|
+
if (ge)
|
|
525
|
+
return /* @__PURE__ */ C(
|
|
526
|
+
Ve,
|
|
527
|
+
{
|
|
528
|
+
justify: "center",
|
|
529
|
+
align: "center",
|
|
530
|
+
styles: {
|
|
531
|
+
root: {
|
|
532
|
+
height: "100%",
|
|
533
|
+
width: "100%",
|
|
534
|
+
minHeight: 200,
|
|
535
|
+
padding: 16
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
children: /* @__PURE__ */ C("div", { style: { textAlign: "center", color: "red" }, children: ge })
|
|
539
|
+
}
|
|
540
|
+
);
|
|
541
|
+
const Pe = H || M(q ?? null, y) || V, Re = !!(m && !L), xe = Re && oe, Ae = te > 0 && te < 500, Ce = te > 0 && te < 380, ze = (ve?.length ?? 0) > 0 && !Ce ? "48px" : "16px";
|
|
542
|
+
return /* @__PURE__ */ C(
|
|
543
|
+
Ve,
|
|
544
|
+
{
|
|
545
|
+
justify: "center",
|
|
546
|
+
align: "center",
|
|
547
|
+
styles: {
|
|
548
|
+
root: {
|
|
549
|
+
height: "100%",
|
|
550
|
+
width: "100%",
|
|
551
|
+
minHeight: 200,
|
|
552
|
+
position: "relative"
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
children: /* @__PURE__ */ me(
|
|
556
|
+
"div",
|
|
557
|
+
{
|
|
558
|
+
"data-test-id": "video-player-container",
|
|
559
|
+
className: `video-player-container video-player-container--with-player ${Ae ? "video-player--compact" : ""} ${Ce ? "video-player--narrow" : ""}`,
|
|
560
|
+
style: {
|
|
561
|
+
"--video-subtitles-offset": ze
|
|
562
|
+
},
|
|
563
|
+
ref: O,
|
|
564
|
+
onClick: Qe,
|
|
565
|
+
children: [
|
|
566
|
+
/* @__PURE__ */ C(
|
|
567
|
+
"video",
|
|
568
|
+
{
|
|
569
|
+
ref: P,
|
|
570
|
+
src: V || (L ? Pe : null) || void 0,
|
|
571
|
+
className: "video-player-media",
|
|
572
|
+
style: xe ? { display: "none" } : void 0,
|
|
573
|
+
poster: K || void 0,
|
|
574
|
+
onError: (e) => {
|
|
575
|
+
const t = e.currentTarget, n = t.currentSrc || t.src;
|
|
576
|
+
if (!n || !t.error) return;
|
|
577
|
+
X.current.add(n);
|
|
578
|
+
const i = [
|
|
579
|
+
H,
|
|
580
|
+
M(q ?? null, y),
|
|
581
|
+
M(B, y)
|
|
582
|
+
].filter(
|
|
583
|
+
(a) => !!a && !X.current.has(a)
|
|
584
|
+
);
|
|
585
|
+
i.length > 0 && (t.src = i[0], t.load());
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
),
|
|
589
|
+
Re && /* @__PURE__ */ C(
|
|
590
|
+
_e,
|
|
591
|
+
{
|
|
592
|
+
ref: g,
|
|
593
|
+
autoPlay: !1,
|
|
594
|
+
className: `video-player-media${xe ? "" : " video-player-media--loading"}`
|
|
595
|
+
}
|
|
596
|
+
),
|
|
597
|
+
(V || m || J || L && Pe) && /* @__PURE__ */ me(De, { children: [
|
|
598
|
+
Se && /* @__PURE__ */ C(
|
|
599
|
+
"div",
|
|
600
|
+
{
|
|
601
|
+
className: "video-player-buffering",
|
|
602
|
+
"data-test-id": "video-player-buffering",
|
|
603
|
+
children: /* @__PURE__ */ C("div", { className: "video-player-buffering-ring" })
|
|
604
|
+
}
|
|
605
|
+
),
|
|
606
|
+
Me && !Ae && !Se && /* @__PURE__ */ C(
|
|
607
|
+
"button",
|
|
608
|
+
{
|
|
609
|
+
className: "video-player-center-play",
|
|
610
|
+
type: "button",
|
|
611
|
+
"aria-label": Q("editor.video.player.play"),
|
|
612
|
+
onClick: (e) => {
|
|
613
|
+
e.stopPropagation(), s?.play().catch(() => {
|
|
614
|
+
});
|
|
615
|
+
},
|
|
616
|
+
children: /* @__PURE__ */ C(je, { size: 32 })
|
|
617
|
+
}
|
|
618
|
+
),
|
|
619
|
+
/* @__PURE__ */ me("div", { className: "video-player-overlay", children: [
|
|
620
|
+
/* @__PURE__ */ C("div", { className: "video-player-gradient" }),
|
|
621
|
+
/* @__PURE__ */ C(
|
|
622
|
+
$e,
|
|
623
|
+
{
|
|
624
|
+
video: s,
|
|
625
|
+
containerRef: O,
|
|
626
|
+
settings: He,
|
|
627
|
+
isSettingsDisabled: !1,
|
|
628
|
+
onSubtitlesOpen: Be,
|
|
629
|
+
storyboard: we,
|
|
630
|
+
chapters: h ? ve : void 0,
|
|
631
|
+
isProcessing: Ne,
|
|
632
|
+
baseUrl: y,
|
|
633
|
+
onSpeedClick: (e) => {
|
|
634
|
+
const t = g.current?.player || null;
|
|
635
|
+
S((n) => ({
|
|
636
|
+
...n,
|
|
637
|
+
currentSpeed: e
|
|
638
|
+
})), t && Ye(t, e), s && (s.playbackRate = e);
|
|
639
|
+
},
|
|
640
|
+
onQualityClick: (e) => {
|
|
641
|
+
const t = g.current?.player || null;
|
|
642
|
+
if (!t || W.qualities.length === 0)
|
|
643
|
+
return;
|
|
644
|
+
if (e == null) {
|
|
645
|
+
t.configure?.({ abr: { enabled: !0 } }), le(!0), S(
|
|
646
|
+
x(t, s)
|
|
647
|
+
);
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
t.configure?.({ abr: { enabled: !1 } });
|
|
651
|
+
const n = W.qualities.find(
|
|
652
|
+
(r) => r.id === e
|
|
653
|
+
) || null;
|
|
654
|
+
n && Xe(t, n.id), le(!1), S((r) => ({
|
|
655
|
+
...r,
|
|
656
|
+
currentQualityId: e
|
|
657
|
+
}));
|
|
658
|
+
},
|
|
659
|
+
onSubtitleSelect: (e) => {
|
|
660
|
+
const t = g.current?.player || null, n = typeof e == "number" ? e : null;
|
|
661
|
+
if (ue(n), t) {
|
|
662
|
+
const r = t.getTextTracks?.() ?? [];
|
|
663
|
+
if (n == null)
|
|
664
|
+
_(null);
|
|
665
|
+
else {
|
|
666
|
+
const a = r.find(
|
|
667
|
+
(l) => l.id === n
|
|
668
|
+
);
|
|
669
|
+
if (a)
|
|
670
|
+
_({
|
|
671
|
+
lang: a.language || "und",
|
|
672
|
+
label: a.label || "und",
|
|
673
|
+
kind: a.kind || "subtitles"
|
|
674
|
+
});
|
|
675
|
+
else {
|
|
676
|
+
const l = k[n];
|
|
677
|
+
l && _({
|
|
678
|
+
lang: l.lang || "und",
|
|
679
|
+
label: l.label || l.lang || "und",
|
|
680
|
+
kind: l.kind || "subtitles"
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
let i = n;
|
|
685
|
+
if (typeof n == "number" && !r.find((a) => a.id === n)) {
|
|
686
|
+
const a = k[n];
|
|
687
|
+
if (a) {
|
|
688
|
+
const l = a.label || a.lang || "und", c = a.lang || "und", f = r.find(
|
|
689
|
+
(o) => (o.language || "") === c && (o.label || "") === l
|
|
690
|
+
);
|
|
691
|
+
f && (i = f.id);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
ie(t, i), S(
|
|
695
|
+
x(t, s)
|
|
696
|
+
);
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
if (s) {
|
|
700
|
+
if (n == null)
|
|
701
|
+
_(null);
|
|
702
|
+
else {
|
|
703
|
+
const r = k[n];
|
|
704
|
+
r && _({
|
|
705
|
+
lang: r.lang || "und",
|
|
706
|
+
label: r.label || r.lang || "und",
|
|
707
|
+
kind: r.kind || "subtitles"
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
ie(null, n, s), S(
|
|
711
|
+
x(null, s)
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
)
|
|
717
|
+
] })
|
|
718
|
+
] })
|
|
719
|
+
]
|
|
720
|
+
}
|
|
721
|
+
)
|
|
722
|
+
}
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
export {
|
|
726
|
+
ct as VideoPlayer
|
|
727
|
+
};
|