@ankhorage/zora 28.2.0 → 28.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 +11 -0
- package/README.md +1 -1
- package/dist/capabilities/index.js +76 -2
- package/dist/capabilities/index.js.map +7 -5
- package/dist/constants/authoring.d.ts +5 -3
- package/dist/constants/authoring.d.ts.map +1 -1
- package/dist/constants/authoring.js +4 -0
- package/dist/constants/authoring.js.map +1 -1
- package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
- package/dist/features/audio/adapters/inbound/Audio.d.ts +5 -0
- package/dist/features/audio/adapters/inbound/Audio.d.ts.map +1 -0
- package/dist/features/audio/adapters/inbound/Audio.js +80 -0
- package/dist/features/audio/adapters/inbound/Audio.js.map +1 -0
- package/dist/features/audio/audioMeta.d.ts +22 -0
- package/dist/features/audio/audioMeta.d.ts.map +1 -0
- package/dist/features/audio/audioMeta.js +18 -0
- package/dist/features/audio/audioMeta.js.map +1 -0
- package/dist/features/audio/composition/AudioController.d.ts +13 -0
- package/dist/features/audio/composition/AudioController.d.ts.map +1 -0
- package/dist/features/audio/composition/AudioController.js +2 -0
- package/dist/features/audio/composition/AudioController.js.map +1 -0
- package/dist/features/audio/composition/useAudioController.d.ts +5 -0
- package/dist/features/audio/composition/useAudioController.d.ts.map +1 -0
- package/dist/features/audio/composition/useAudioController.js +22 -0
- package/dist/features/audio/composition/useAudioController.js.map +1 -0
- package/dist/features/audio/composition/useAudioController.web.d.ts +5 -0
- package/dist/features/audio/composition/useAudioController.web.d.ts.map +1 -0
- package/dist/features/audio/composition/useAudioController.web.js +80 -0
- package/dist/features/audio/composition/useAudioController.web.js.map +1 -0
- package/dist/features/audio/public.d.ts +3 -0
- package/dist/features/audio/public.d.ts.map +1 -0
- package/dist/features/audio/public.js +2 -0
- package/dist/features/audio/public.js.map +1 -0
- package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
- package/dist/features/card/cardMeta.d.ts +1 -1
- package/dist/features/card/mediaCardMeta.d.ts +1 -1
- package/dist/features/card/postCardMeta.d.ts +1 -1
- package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
- package/dist/features/dialog/dialogMeta.d.ts +2 -2
- package/dist/features/gradient/gradientMeta.d.ts +1 -1
- package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
- package/dist/features/layout/gridMeta.d.ts +1 -1
- package/dist/features/layout/screenMeta.d.ts +1 -1
- package/dist/features/layout/scrollViewMeta.d.ts +1 -1
- package/dist/features/layout/viewMeta.d.ts +1 -1
- package/dist/features/list/flatListMeta.d.ts +1 -1
- package/dist/features/list/sectionListMeta.d.ts +1 -1
- package/dist/features/master-detail/masterDetailMeta.d.ts +1 -1
- package/dist/features/reader/meta.d.ts +2 -2
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.d.ts.map +1 -1
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js +4 -0
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js.map +1 -1
- package/dist/features/registry/bindableComponentMeta.d.ts +2 -2
- package/dist/features/registry/componentMeta.d.ts.map +1 -1
- package/dist/features/registry/componentMeta.js +4 -0
- package/dist/features/registry/componentMeta.js.map +1 -1
- package/dist/features/scanner/meta.d.ts +2 -2
- package/dist/features/section/screenSectionMeta.d.ts +1 -1
- package/dist/features/surface/surfaceMeta.d.ts +1 -1
- package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
- package/dist/features/video/adapters/inbound/Video.d.ts +2 -0
- package/dist/features/video/adapters/inbound/Video.d.ts.map +1 -0
- package/dist/features/video/adapters/inbound/Video.js +2 -0
- package/dist/features/video/adapters/inbound/Video.js.map +1 -0
- package/dist/features/video/adapters/inbound/Video.native.d.ts +5 -0
- package/dist/features/video/adapters/inbound/Video.native.d.ts.map +1 -0
- package/dist/features/video/adapters/inbound/Video.native.js +160 -0
- package/dist/features/video/adapters/inbound/Video.native.js.map +1 -0
- package/dist/features/video/adapters/inbound/Video.web.d.ts +5 -0
- package/dist/features/video/adapters/inbound/Video.web.d.ts.map +1 -0
- package/dist/features/video/adapters/inbound/Video.web.js +30 -0
- package/dist/features/video/adapters/inbound/Video.web.js.map +1 -0
- package/dist/features/video/public.d.ts +3 -0
- package/dist/features/video/public.d.ts.map +1 -0
- package/dist/features/video/public.js +2 -0
- package/dist/features/video/public.js.map +1 -0
- package/dist/features/video/videoMeta.d.ts +64 -0
- package/dist/features/video/videoMeta.d.ts.map +1 -0
- package/dist/features/video/videoMeta.js +50 -0
- package/dist/features/video/videoMeta.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/readerFree.d.ts +3 -0
- package/dist/readerFree.d.ts.map +1 -1
- package/dist/readerFree.js +2 -0
- package/dist/readerFree.js.map +1 -1
- package/dist/types/audio.d.ts +15 -0
- package/dist/types/audio.d.ts.map +1 -0
- package/dist/types/audio.js +2 -0
- package/dist/types/audio.js.map +1 -0
- package/dist/types/video.d.ts +24 -0
- package/dist/types/video.d.ts.map +1 -0
- package/dist/types/video.js +2 -0
- package/dist/types/video.js.map +1 -0
- package/package.json +7 -3
- package/src/constants/authoring.ts +4 -0
- package/src/features/audio/adapters/inbound/Audio.tsx +158 -0
- package/src/features/audio/audioMeta.ts +20 -0
- package/src/features/audio/composition/AudioController.ts +12 -0
- package/src/features/audio/composition/useAudioController.ts +27 -0
- package/src/features/audio/composition/useAudioController.web.ts +106 -0
- package/src/features/audio/public.test.ts +37 -0
- package/src/features/audio/public.ts +2 -0
- package/src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts +4 -0
- package/src/features/registry/componentMeta.test.ts +16 -0
- package/src/features/registry/componentMeta.ts +4 -0
- package/src/features/video/adapters/inbound/Video.native.tsx +296 -0
- package/src/features/video/adapters/inbound/Video.test.tsx +188 -0
- package/src/features/video/adapters/inbound/Video.tsx +1 -0
- package/src/features/video/adapters/inbound/Video.web.tsx +70 -0
- package/src/features/video/public.ts +7 -0
- package/src/features/video/videoMeta.ts +51 -0
- package/src/index.ts +2 -0
- package/src/readerFree.ts +13 -0
- package/src/types/audio.ts +16 -0
- package/src/types/video.ts +28 -0
- package/web-dist/chunks/{Accordion-4v920xz8.js → Accordion-01bsg7zt.js} +1 -1
- package/web-dist/chunks/{Accordion-pvfmhrm0.js → Accordion-17s33h1a.js} +1 -1
- package/web-dist/chunks/{Accordion-vyw2bzye.js → Accordion-2wggrer7.js} +2 -2
- package/web-dist/chunks/{Accordion-bjq32vq2.js → Accordion-2xb252py.js} +3 -3
- package/web-dist/chunks/{Accordion-kr1reyt9.js → Accordion-2xkxthf1.js} +7 -7
- package/web-dist/chunks/{Accordion-fc058wqp.js → Accordion-2ys50fc8.js} +1 -1
- package/web-dist/chunks/{Accordion-7zhdzn00.js → Accordion-379mgrse.js} +1 -1
- package/web-dist/chunks/{Accordion-xeyw6ndr.js → Accordion-38xvj0cq.js} +4 -4
- package/web-dist/chunks/{Accordion-8gfgaq01.js → Accordion-4zb6dcys.js} +1 -1
- package/web-dist/chunks/{Accordion-nrwc0rx2.js → Accordion-5mga7hty.js} +1 -1
- package/web-dist/chunks/{Accordion-3qvtv4g6.js → Accordion-5qz4j8tt.js} +6 -6
- package/web-dist/chunks/{Accordion-4zbh7wfn.js → Accordion-5rwztz14.js} +1 -1
- package/web-dist/chunks/{Accordion-frfh3nz6.js → Accordion-9qg7cjt8.js} +2 -2
- package/web-dist/chunks/{Accordion-g07r4t2f.js → Accordion-a1mgdfg7.js} +1 -1
- package/web-dist/chunks/{Accordion-dcm6ywt2.js → Accordion-axe7nsht.js} +1 -1
- package/web-dist/chunks/{Accordion-e2b9yja2.js → Accordion-bd9vzpbz.js} +6 -6
- package/web-dist/chunks/{Accordion-csz7sgjm.js → Accordion-bp9y7738.js} +6 -6
- package/web-dist/chunks/{Accordion-64w34bgd.js → Accordion-bzgy9sg3.js} +2 -2
- package/web-dist/chunks/{Accordion-r30bwg03.js → Accordion-e0vm82xr.js} +2 -2
- package/web-dist/chunks/{Accordion-em4ktbkk.js → Accordion-f1vargnk.js} +4 -4
- package/web-dist/chunks/{Accordion-k6v7p2na.js → Accordion-f8a49gy8.js} +1 -1
- package/web-dist/chunks/{Accordion-g5c5sqn7.js → Accordion-f8zpd80k.js} +4 -4
- package/web-dist/chunks/{Accordion-22z6y8kw.js → Accordion-gnbt6w4q.js} +3 -3
- package/web-dist/chunks/{Accordion-s1qjbbb0.js → Accordion-hdyzyw8q.js} +1 -1
- package/web-dist/chunks/{Accordion-q0cbpr2d.js → Accordion-htm3j8r8.js} +4 -4
- package/web-dist/chunks/{Accordion-mh3bhcb4.js → Accordion-kdb9g5b1.js} +3 -3
- package/web-dist/chunks/{Accordion-zsd0ar2p.js → Accordion-nmpzv3b0.js} +3 -3
- package/web-dist/chunks/{Accordion-b8ncebyz.js → Accordion-pdjhezmz.js} +1 -1
- package/web-dist/chunks/{Accordion-zqa9mt13.js → Accordion-q683s6kd.js} +2 -2
- package/web-dist/chunks/{Accordion-30284ah1.js → Accordion-r75ep5pg.js} +4 -4
- package/web-dist/chunks/{Accordion-rmakadh6.js → Accordion-rq311z1k.js} +4 -4
- package/web-dist/chunks/{Accordion-w28mb1ed.js → Accordion-rtamzg9j.js} +1 -1
- package/web-dist/chunks/{Accordion-nv1evygk.js → Accordion-sh79sr5g.js} +1 -1
- package/web-dist/chunks/{Accordion-t93g1wq3.js → Accordion-t9n4ey2r.js} +1 -1
- package/web-dist/chunks/{Accordion-zanzeryt.js → Accordion-tqagt6cz.js} +1 -1
- package/web-dist/chunks/{Accordion-0n3y5ry1.js → Accordion-v6vhyv31.js} +1 -1
- package/web-dist/chunks/{Accordion-6pkteb8k.js → Accordion-vb52sts9.js} +3 -3
- package/web-dist/chunks/{Accordion-rwjbwm18.js → Accordion-vkqqktc5.js} +1 -1
- package/web-dist/chunks/{Accordion-9zwdqhf2.js → Accordion-za0jcjgn.js} +2 -2
- package/web-dist/chunks/Video.native-97x0098j.js +905 -0
- package/web-dist/chunks/index-cnnsfz6n.js +1807 -0
- package/web-dist/components/accordion/Accordion.js +3 -3
- package/web-dist/components/accordion-item/AccordionItem.js +3 -3
- package/web-dist/components/app-bar/AppBar.js +7 -7
- package/web-dist/components/app-header/AppHeader.js +7 -7
- package/web-dist/components/app-shell/AppShell.js +2 -2
- package/web-dist/components/audio/Audio.d.ts +7 -0
- package/web-dist/components/audio/Audio.dependency-0.d.ts +27 -0
- package/web-dist/components/audio/Audio.dependency-1.d.ts +3 -0
- package/web-dist/components/audio/Audio.js +264 -0
- package/web-dist/components/audio/Audio.types-0.d.ts +18 -0
- package/web-dist/components/audio/index.d.ts +2 -0
- package/web-dist/components/audio/index.js +2 -0
- package/web-dist/components/auth-screen/AuthScreen.js +11 -11
- package/web-dist/components/avatar/Avatar.js +3 -3
- package/web-dist/components/avatar-group/AvatarGroup.js +3 -3
- package/web-dist/components/badge/Badge.js +2 -2
- package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +10 -10
- package/web-dist/components/bottom-sheet/BottomSheet.js +4 -4
- package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +4 -4
- package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +4 -4
- package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +4 -4
- package/web-dist/components/bottom-sheet-view/BottomSheetView.js +4 -4
- package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +4 -4
- package/web-dist/components/breadcrumbs/Breadcrumbs.js +4 -4
- package/web-dist/components/button/Button.js +4 -4
- package/web-dist/components/button-group/ButtonGroup.js +4 -4
- package/web-dist/components/calendar/Calendar.js +5 -5
- package/web-dist/components/camera-permission-view/CameraPermissionView.js +10 -10
- package/web-dist/components/card/Card.js +9 -9
- package/web-dist/components/chat-list-item/ChatListItem.js +6 -6
- package/web-dist/components/checkbox/Checkbox.js +4 -4
- package/web-dist/components/checkbox-group/CheckboxGroup.js +4 -4
- package/web-dist/components/chip/Chip.js +4 -4
- package/web-dist/components/chip-group/ChipGroup.js +4 -4
- package/web-dist/components/collection-editor/CollectionEditor.js +9 -9
- package/web-dist/components/color-hue-scale/ColorHueScale.js +14 -14
- package/web-dist/components/color-picker/ColorPicker.js +14 -14
- package/web-dist/components/color-tone/ColorTone.js +14 -14
- package/web-dist/components/color-wheel/ColorWheel.js +14 -14
- package/web-dist/components/content-rail/ContentRail.js +4 -4
- package/web-dist/components/data-table/DataTable.js +15 -15
- package/web-dist/components/date-picker/DatePicker.js +9 -9
- package/web-dist/components/dialog/Dialog.js +4 -4
- package/web-dist/components/divider/Divider.js +2 -2
- package/web-dist/components/empty-state/EmptyState.js +10 -10
- package/web-dist/components/explorer/Explorer.js +4 -4
- package/web-dist/components/field/Field.js +4 -4
- package/web-dist/components/file-explorer/FileExplorer.js +4 -4
- package/web-dist/components/flat-list/FlatList.js +5 -5
- package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +11 -11
- package/web-dist/components/form/Form.js +7 -7
- package/web-dist/components/form-actions/FormActions.js +7 -7
- package/web-dist/components/form-error/FormError.js +7 -7
- package/web-dist/components/game/Game.js +3 -3
- package/web-dist/components/game-entity/GameEntity.js +3 -3
- package/web-dist/components/game-field/GameField.js +3 -3
- package/web-dist/components/game-input-zone/GameInputZone.js +3 -3
- package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +3 -3
- package/web-dist/components/game-overlay/GameOverlay.js +3 -3
- package/web-dist/components/gradient/Gradient.js +3 -3
- package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +3 -3
- package/web-dist/components/grid/Grid.js +2 -2
- package/web-dist/components/hero/Hero.js +9 -9
- package/web-dist/components/icon-button/IconButton.js +4 -4
- package/web-dist/components/image/Image.js +3 -3
- package/web-dist/components/list/List.js +5 -5
- package/web-dist/components/list-item/ListItem.js +5 -5
- package/web-dist/components/list-section/ListSection.js +5 -5
- package/web-dist/components/master-detail/MasterDetail.js +2 -2
- package/web-dist/components/media-card/MediaCard.js +9 -9
- package/web-dist/components/media-explorer/MediaExplorer.js +4 -4
- package/web-dist/components/message-bubble/MessageBubble.js +6 -6
- package/web-dist/components/metric-card/MetricCard.js +9 -9
- package/web-dist/components/missing-element/MissingElement.js +3 -3
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +11 -11
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +11 -11
- package/web-dist/components/otp-form/OtpForm.js +11 -11
- package/web-dist/components/pagination/Pagination.js +4 -4
- package/web-dist/components/palette-item/PaletteItem.js +9 -9
- package/web-dist/components/popover-menu/PopoverMenu.js +4 -4
- package/web-dist/components/post-card/PostCard.js +9 -9
- package/web-dist/components/product-card/ProductCard.js +9 -9
- package/web-dist/components/progress/Progress.js +3 -3
- package/web-dist/components/progress-ring/ProgressRing.js +3 -3
- package/web-dist/components/radio/Radio.js +4 -4
- package/web-dist/components/radio-group/RadioGroup.js +4 -4
- package/web-dist/components/rating/Rating.js +2 -2
- package/web-dist/components/reader/Reader.js +10 -10
- package/web-dist/components/scan-overlay/ScanOverlay.js +10 -10
- package/web-dist/components/screen/Screen.js +2 -2
- package/web-dist/components/screen-section/ScreenSection.js +3 -3
- package/web-dist/components/scroll-view/ScrollView.js +2 -2
- package/web-dist/components/search-input/SearchInput.js +5 -5
- package/web-dist/components/section-header/SectionHeader.js +3 -3
- package/web-dist/components/section-list/SectionList.js +5 -5
- package/web-dist/components/select/Select.js +9 -9
- package/web-dist/components/sign-in-form/SignInForm.js +11 -11
- package/web-dist/components/sign-up-form/SignUpForm.js +11 -11
- package/web-dist/components/skeleton/Skeleton.js +12 -12
- package/web-dist/components/skeleton-card/SkeletonCard.js +12 -12
- package/web-dist/components/skeleton-list/SkeletonList.js +12 -12
- package/web-dist/components/skeleton-text/SkeletonText.js +12 -12
- package/web-dist/components/surface/Surface.js +3 -3
- package/web-dist/components/switch/Switch.js +2 -2
- package/web-dist/components/tab/Tab.js +2 -2
- package/web-dist/components/tab-list/TabList.js +2 -2
- package/web-dist/components/tab-panel/TabPanel.js +2 -2
- package/web-dist/components/tabs/Tabs.js +2 -2
- package/web-dist/components/text-input/TextInput.js +5 -5
- package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +4 -4
- package/web-dist/components/time-picker/TimePicker.js +8 -8
- package/web-dist/components/timeline/Timeline.js +3 -3
- package/web-dist/components/toast/Toast.js +4 -4
- package/web-dist/components/toast-provider/ToastProvider.js +4 -4
- package/web-dist/components/toolbar/Toolbar.js +9 -9
- package/web-dist/components/tree-item/TreeItem.js +6 -6
- package/web-dist/components/uploader/Uploader.js +12 -12
- package/web-dist/components/video/Video.d.ts +7 -0
- package/web-dist/components/video/Video.dependency-0.d.ts +27 -0
- package/web-dist/components/video/Video.dependency-1.d.ts +3 -0
- package/web-dist/components/video/Video.dependency-2.d.ts +9 -0
- package/web-dist/components/video/Video.dependency-3.d.ts +23 -0
- package/web-dist/components/video/Video.js +80 -0
- package/web-dist/components/video/Video.types-0.d.ts +29 -0
- package/web-dist/components/video/index.d.ts +2 -0
- package/web-dist/components/video/index.js +2 -0
- package/web-dist/components/view/View.js +2 -2
- package/web-dist/manifest.json +753 -675
- package/web-dist/runtime/ZoraProvider.js +3 -3
- /package/web-dist/chunks/{Accordion-5kaxyqy1.js → Accordion-ww4f12ty.js} +0 -0
|
@@ -0,0 +1,905 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import"./Accordion-0dj1r7w3.js";
|
|
3
|
+
import"./Accordion-9d38cgqj.js";
|
|
4
|
+
import"./Accordion-wgc67k1g.js";
|
|
5
|
+
import"./Accordion-ww4f12ty.js";
|
|
6
|
+
import"./Accordion-hdyzyw8q.js";
|
|
7
|
+
import"./Accordion-kcm6jcpp.js";
|
|
8
|
+
import {
|
|
9
|
+
require_registry,
|
|
10
|
+
IconButton2
|
|
11
|
+
} from "./Accordion-f1vargnk.js";
|
|
12
|
+
import"./Accordion-76b0qz8y.js";
|
|
13
|
+
import {
|
|
14
|
+
withZoraThemeScope
|
|
15
|
+
} from "./Accordion-tk8zf9ff.js";
|
|
16
|
+
import {
|
|
17
|
+
View2
|
|
18
|
+
} from "./Accordion-f8a49gy8.js";
|
|
19
|
+
import {
|
|
20
|
+
Image2
|
|
21
|
+
} from "./Accordion-01bsg7zt.js";
|
|
22
|
+
import"./Accordion-3zzzw7a8.js";
|
|
23
|
+
import {
|
|
24
|
+
Text3
|
|
25
|
+
} from "./Accordion-8skz71ct.js";
|
|
26
|
+
import"./Accordion-61e19g3e.js";
|
|
27
|
+
import"./Accordion-c6edgxay.js";
|
|
28
|
+
import"./Accordion-yrac5a7m.js";
|
|
29
|
+
import {
|
|
30
|
+
useZoraTheme2
|
|
31
|
+
} from "./Accordion-b1y5mjac.js";
|
|
32
|
+
import"./Accordion-fre84yaq.js";
|
|
33
|
+
import {
|
|
34
|
+
require_cjs
|
|
35
|
+
} from "./Accordion-xgpzh4wq.js";
|
|
36
|
+
import {
|
|
37
|
+
__toESM
|
|
38
|
+
} from "./Accordion-nh0cs9hq.js";
|
|
39
|
+
// node_modules/expo-video/build/VideoView.web.js
|
|
40
|
+
var import_react_native = __toESM(require_cjs());
|
|
41
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
42
|
+
import React, { useEffect, useRef, forwardRef, useImperativeHandle } from "react";
|
|
43
|
+
|
|
44
|
+
// node_modules/expo-video/build/VideoPlayer.web.js
|
|
45
|
+
import { useMemo } from "react";
|
|
46
|
+
|
|
47
|
+
// node_modules/expo-video/build/resolveAssetSource.web.js
|
|
48
|
+
var import_registry = __toESM(require_registry());
|
|
49
|
+
function resolveAssetSource(assetId) {
|
|
50
|
+
const asset = import_registry.getAssetByID(assetId);
|
|
51
|
+
if (!asset) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const type = !asset.type ? "" : `.${asset.type}`;
|
|
55
|
+
const assetPath = __DEV__ ? asset.httpServerLocation + "/" + asset.name + type : asset.httpServerLocation.replace(/\.\.\//g, "_") + "/" + asset.name + type;
|
|
56
|
+
const fromUrl = new URL(assetPath, "https://expo.dev");
|
|
57
|
+
return { uri: fromUrl.toString().replace(fromUrl.origin, "") };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// node_modules/expo-video/build/VideoPlayer.web.js
|
|
61
|
+
function useVideoPlayer(source, setup) {
|
|
62
|
+
const parsedSource = typeof source === "string" ? { uri: source } : source;
|
|
63
|
+
return useMemo(() => {
|
|
64
|
+
const player = new VideoPlayerWeb(parsedSource);
|
|
65
|
+
setup?.(player);
|
|
66
|
+
return player;
|
|
67
|
+
}, [JSON.stringify(source)]);
|
|
68
|
+
}
|
|
69
|
+
function getSourceUri(source) {
|
|
70
|
+
if (typeof source === "string") {
|
|
71
|
+
return source;
|
|
72
|
+
}
|
|
73
|
+
if (typeof source === "number") {
|
|
74
|
+
return resolveAssetSource(source)?.uri ?? null;
|
|
75
|
+
}
|
|
76
|
+
if (typeof source?.assetId === "number" && !source?.uri) {
|
|
77
|
+
return resolveAssetSource(source.assetId)?.uri ?? null;
|
|
78
|
+
}
|
|
79
|
+
return source?.uri ?? null;
|
|
80
|
+
}
|
|
81
|
+
class VideoPlayerWeb extends globalThis.expo.SharedObject {
|
|
82
|
+
constructor(source) {
|
|
83
|
+
super();
|
|
84
|
+
this.src = source;
|
|
85
|
+
}
|
|
86
|
+
src = null;
|
|
87
|
+
previousSrc = null;
|
|
88
|
+
_mountedVideos = new Set;
|
|
89
|
+
_audioNodes = new Set;
|
|
90
|
+
playing = false;
|
|
91
|
+
_muted = false;
|
|
92
|
+
_volume = 1;
|
|
93
|
+
_loop = false;
|
|
94
|
+
_playbackRate = 1;
|
|
95
|
+
_preservesPitch = true;
|
|
96
|
+
_status = "idle";
|
|
97
|
+
_error = null;
|
|
98
|
+
_timeUpdateLoop = null;
|
|
99
|
+
_timeUpdateEventInterval = 0;
|
|
100
|
+
audioMixingMode = "auto";
|
|
101
|
+
allowsExternalPlayback = false;
|
|
102
|
+
staysActiveInBackground = false;
|
|
103
|
+
showNowPlayingNotification = false;
|
|
104
|
+
currentLiveTimestamp = null;
|
|
105
|
+
currentOffsetFromLive = null;
|
|
106
|
+
targetOffsetFromLive = 0;
|
|
107
|
+
bufferOptions = {};
|
|
108
|
+
subtitleTrack = null;
|
|
109
|
+
availableSubtitleTracks = [];
|
|
110
|
+
audioTrack = null;
|
|
111
|
+
availableAudioTracks = [];
|
|
112
|
+
videoTrack = null;
|
|
113
|
+
availableVideoTracks = [];
|
|
114
|
+
isExternalPlaybackActive = false;
|
|
115
|
+
keepScreenOnWhilePlaying = false;
|
|
116
|
+
seekTolerance = {};
|
|
117
|
+
scrubbingModeOptions = {};
|
|
118
|
+
set muted(value) {
|
|
119
|
+
this._mountedVideos.forEach((video) => {
|
|
120
|
+
video.muted = value;
|
|
121
|
+
});
|
|
122
|
+
this._muted = value;
|
|
123
|
+
}
|
|
124
|
+
get muted() {
|
|
125
|
+
return this._muted;
|
|
126
|
+
}
|
|
127
|
+
set playbackRate(value) {
|
|
128
|
+
this._mountedVideos.forEach((video) => {
|
|
129
|
+
video.playbackRate = value;
|
|
130
|
+
});
|
|
131
|
+
this._playbackRate = value;
|
|
132
|
+
}
|
|
133
|
+
get playbackRate() {
|
|
134
|
+
return this._playbackRate;
|
|
135
|
+
}
|
|
136
|
+
get isLive() {
|
|
137
|
+
return [...this._mountedVideos][0]?.duration === Infinity;
|
|
138
|
+
}
|
|
139
|
+
set volume(value) {
|
|
140
|
+
this._mountedVideos.forEach((video) => {
|
|
141
|
+
video.volume = value;
|
|
142
|
+
});
|
|
143
|
+
this._volume = value;
|
|
144
|
+
}
|
|
145
|
+
get volume() {
|
|
146
|
+
return this._volume;
|
|
147
|
+
}
|
|
148
|
+
set loop(value) {
|
|
149
|
+
this._mountedVideos.forEach((video) => {
|
|
150
|
+
video.loop = value;
|
|
151
|
+
});
|
|
152
|
+
this._loop = value;
|
|
153
|
+
}
|
|
154
|
+
get loop() {
|
|
155
|
+
return this._loop;
|
|
156
|
+
}
|
|
157
|
+
get currentTime() {
|
|
158
|
+
return [...this._mountedVideos][0]?.currentTime ?? 0;
|
|
159
|
+
}
|
|
160
|
+
set currentTime(value) {
|
|
161
|
+
this._mountedVideos.forEach((video) => {
|
|
162
|
+
video.currentTime = value;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
get duration() {
|
|
166
|
+
return [...this._mountedVideos][0]?.duration ?? 0;
|
|
167
|
+
}
|
|
168
|
+
get preservesPitch() {
|
|
169
|
+
return this._preservesPitch;
|
|
170
|
+
}
|
|
171
|
+
set preservesPitch(value) {
|
|
172
|
+
this._mountedVideos.forEach((video) => {
|
|
173
|
+
video.preservesPitch = value;
|
|
174
|
+
});
|
|
175
|
+
this._preservesPitch = value;
|
|
176
|
+
}
|
|
177
|
+
get timeUpdateEventInterval() {
|
|
178
|
+
return this._timeUpdateEventInterval;
|
|
179
|
+
}
|
|
180
|
+
set timeUpdateEventInterval(value) {
|
|
181
|
+
this._timeUpdateEventInterval = value;
|
|
182
|
+
if (this._timeUpdateLoop) {
|
|
183
|
+
clearInterval(this._timeUpdateLoop);
|
|
184
|
+
}
|
|
185
|
+
if (value > 0) {
|
|
186
|
+
this.emit("timeUpdate", {
|
|
187
|
+
currentTime: this.currentTime,
|
|
188
|
+
currentLiveTimestamp: null,
|
|
189
|
+
currentOffsetFromLive: null,
|
|
190
|
+
bufferedPosition: this.bufferedPosition
|
|
191
|
+
});
|
|
192
|
+
this._timeUpdateLoop = setInterval(() => {
|
|
193
|
+
this.emit("timeUpdate", {
|
|
194
|
+
currentTime: this.currentTime,
|
|
195
|
+
currentLiveTimestamp: null,
|
|
196
|
+
currentOffsetFromLive: null,
|
|
197
|
+
bufferedPosition: this.bufferedPosition
|
|
198
|
+
});
|
|
199
|
+
}, value * 1000);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
get status() {
|
|
203
|
+
return this._status;
|
|
204
|
+
}
|
|
205
|
+
get bufferedPosition() {
|
|
206
|
+
if (this._mountedVideos.size === 0 || this.status === "error") {
|
|
207
|
+
return -1;
|
|
208
|
+
}
|
|
209
|
+
const buffered = [...this._mountedVideos][0]?.buffered;
|
|
210
|
+
if (buffered != null) {
|
|
211
|
+
for (let i = 0;i < buffered.length; i++) {
|
|
212
|
+
if (buffered.start(i) <= this.currentTime && buffered.end(i) >= this.currentTime) {
|
|
213
|
+
return buffered.end(i);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
set status(value) {
|
|
220
|
+
if (this._status === value)
|
|
221
|
+
return;
|
|
222
|
+
if (value === "error" && this._error) {
|
|
223
|
+
this.emit("statusChange", {
|
|
224
|
+
status: value,
|
|
225
|
+
oldStatus: this._status,
|
|
226
|
+
error: this._error
|
|
227
|
+
});
|
|
228
|
+
} else {
|
|
229
|
+
this.emit("statusChange", {
|
|
230
|
+
status: value,
|
|
231
|
+
oldStatus: this._status
|
|
232
|
+
});
|
|
233
|
+
this._error = null;
|
|
234
|
+
}
|
|
235
|
+
this._status = value;
|
|
236
|
+
}
|
|
237
|
+
mountVideoView(video) {
|
|
238
|
+
if (this._mountedVideos.size === 0) {
|
|
239
|
+
video.preservesPitch = this._preservesPitch;
|
|
240
|
+
video.loop = this._loop;
|
|
241
|
+
video.volume = this._volume;
|
|
242
|
+
video.muted = this._muted;
|
|
243
|
+
video.playbackRate = this._playbackRate;
|
|
244
|
+
}
|
|
245
|
+
this._mountedVideos.add(video);
|
|
246
|
+
this._addListeners(video);
|
|
247
|
+
this._synchronizeWithFirstVideo(video);
|
|
248
|
+
}
|
|
249
|
+
unmountVideoView(video) {
|
|
250
|
+
this._mountedVideos.delete(video);
|
|
251
|
+
}
|
|
252
|
+
mountAudioNode(audioContext, zeroGainNode, audioSourceNode) {
|
|
253
|
+
if (!audioContext || !zeroGainNode)
|
|
254
|
+
return;
|
|
255
|
+
this._audioNodes.add(audioSourceNode);
|
|
256
|
+
if (this._audioNodes.size === 1) {
|
|
257
|
+
audioSourceNode.connect(audioContext.destination);
|
|
258
|
+
} else {
|
|
259
|
+
audioSourceNode.connect(zeroGainNode);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
unmountAudioNode(video, audioContext, audioSourceNode) {
|
|
263
|
+
const mountedVideos = [...this._mountedVideos];
|
|
264
|
+
const videoPlayingAudio = mountedVideos[0];
|
|
265
|
+
this._audioNodes.delete(audioSourceNode);
|
|
266
|
+
audioSourceNode.disconnect();
|
|
267
|
+
if (videoPlayingAudio === video && this._audioNodes.size > 0 && audioContext) {
|
|
268
|
+
const newMainAudioSource = [...this._audioNodes][0];
|
|
269
|
+
if (newMainAudioSource != null) {
|
|
270
|
+
newMainAudioSource.disconnect();
|
|
271
|
+
newMainAudioSource.connect(audioContext.destination);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
play() {
|
|
276
|
+
this._mountedVideos.forEach((video) => {
|
|
277
|
+
video.play();
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
pause() {
|
|
281
|
+
this._mountedVideos.forEach((video) => {
|
|
282
|
+
video.pause();
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
replace(source) {
|
|
286
|
+
this._mountedVideos.forEach((video) => {
|
|
287
|
+
const uri = getSourceUri(source);
|
|
288
|
+
video.pause();
|
|
289
|
+
if (uri) {
|
|
290
|
+
video.setAttribute("src", uri);
|
|
291
|
+
video.load();
|
|
292
|
+
video.play();
|
|
293
|
+
} else {
|
|
294
|
+
video.removeAttribute("src");
|
|
295
|
+
video.load();
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
this.previousSrc = this.src;
|
|
299
|
+
this.src = source;
|
|
300
|
+
this.playing = true;
|
|
301
|
+
}
|
|
302
|
+
async replaceAsync(source) {
|
|
303
|
+
return this.replace(source);
|
|
304
|
+
}
|
|
305
|
+
seekBy(seconds) {
|
|
306
|
+
this._mountedVideos.forEach((video) => {
|
|
307
|
+
video.currentTime += seconds;
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
replay() {
|
|
311
|
+
this._mountedVideos.forEach((video) => {
|
|
312
|
+
video.currentTime = 0;
|
|
313
|
+
video.play();
|
|
314
|
+
});
|
|
315
|
+
this.playing = true;
|
|
316
|
+
}
|
|
317
|
+
generateThumbnailsAsync(times) {
|
|
318
|
+
throw new Error("Generating video thumbnails is not supported on Web yet");
|
|
319
|
+
}
|
|
320
|
+
_synchronizeWithFirstVideo(video) {
|
|
321
|
+
const firstVideo = [...this._mountedVideos][0];
|
|
322
|
+
if (!firstVideo)
|
|
323
|
+
return;
|
|
324
|
+
if (firstVideo.paused) {
|
|
325
|
+
video.pause();
|
|
326
|
+
} else {
|
|
327
|
+
video.play();
|
|
328
|
+
}
|
|
329
|
+
video.currentTime = firstVideo.currentTime;
|
|
330
|
+
video.volume = firstVideo.volume;
|
|
331
|
+
video.muted = firstVideo.muted;
|
|
332
|
+
video.playbackRate = firstVideo.playbackRate;
|
|
333
|
+
}
|
|
334
|
+
_emitOnce(eventSource, eventName, ...args) {
|
|
335
|
+
const mountedVideos = [...this._mountedVideos];
|
|
336
|
+
if (mountedVideos[0] === eventSource) {
|
|
337
|
+
this.emit(eventName, ...args);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
_addListeners(video) {
|
|
341
|
+
video.onplay = (e) => {
|
|
342
|
+
this._emitOnce(video, "playingChange", {
|
|
343
|
+
isPlaying: true,
|
|
344
|
+
oldIsPlaying: this.playing
|
|
345
|
+
});
|
|
346
|
+
this.playing = true;
|
|
347
|
+
this._mountedVideos.forEach((mountedVideo) => {
|
|
348
|
+
if (e.target !== mountedVideo) {
|
|
349
|
+
mountedVideo.play();
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
video.onpause = (e) => {
|
|
354
|
+
this._emitOnce(video, "playingChange", {
|
|
355
|
+
isPlaying: false,
|
|
356
|
+
oldIsPlaying: this.playing
|
|
357
|
+
});
|
|
358
|
+
this.playing = false;
|
|
359
|
+
this._mountedVideos.forEach((mountedVideo) => {
|
|
360
|
+
if (e.target !== mountedVideo) {
|
|
361
|
+
mountedVideo.pause();
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
video.onvolumechange = () => {
|
|
366
|
+
this._emitOnce(video, "volumeChange", { volume: video.volume, oldVolume: this.volume });
|
|
367
|
+
this._emitOnce(video, "mutedChange", { muted: video.muted, oldMuted: this.muted });
|
|
368
|
+
this.volume = video.volume;
|
|
369
|
+
this.muted = video.muted;
|
|
370
|
+
};
|
|
371
|
+
video.onseeking = () => {
|
|
372
|
+
this._mountedVideos.forEach((mountedVideo) => {
|
|
373
|
+
if (mountedVideo === video || mountedVideo.currentTime === video.currentTime)
|
|
374
|
+
return;
|
|
375
|
+
mountedVideo.currentTime = video.currentTime;
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
video.onseeked = () => {
|
|
379
|
+
this._mountedVideos.forEach((mountedVideo) => {
|
|
380
|
+
if (mountedVideo === video || mountedVideo.currentTime === video.currentTime)
|
|
381
|
+
return;
|
|
382
|
+
mountedVideo.currentTime = video.currentTime;
|
|
383
|
+
});
|
|
384
|
+
};
|
|
385
|
+
video.onratechange = () => {
|
|
386
|
+
this._emitOnce(video, "playbackRateChange", {
|
|
387
|
+
playbackRate: video.playbackRate,
|
|
388
|
+
oldPlaybackRate: this.playbackRate
|
|
389
|
+
});
|
|
390
|
+
this._mountedVideos.forEach((mountedVideo) => {
|
|
391
|
+
if (mountedVideo.playbackRate === video.playbackRate)
|
|
392
|
+
return;
|
|
393
|
+
this._playbackRate = video.playbackRate;
|
|
394
|
+
mountedVideo.playbackRate = video.playbackRate;
|
|
395
|
+
});
|
|
396
|
+
this._playbackRate = video.playbackRate;
|
|
397
|
+
};
|
|
398
|
+
video.onerror = () => {
|
|
399
|
+
this._error = {
|
|
400
|
+
message: video.error?.message ?? "Unknown player error"
|
|
401
|
+
};
|
|
402
|
+
this.status = "error";
|
|
403
|
+
};
|
|
404
|
+
video.oncanplay = () => {
|
|
405
|
+
const allCanPlay = [...this._mountedVideos].reduce((previousValue, video) => {
|
|
406
|
+
return previousValue && video.readyState >= 3;
|
|
407
|
+
}, true);
|
|
408
|
+
if (!allCanPlay)
|
|
409
|
+
return;
|
|
410
|
+
this.status = "readyToPlay";
|
|
411
|
+
};
|
|
412
|
+
video.onwaiting = () => {
|
|
413
|
+
if (this._status === "loading")
|
|
414
|
+
return;
|
|
415
|
+
this.status = "loading";
|
|
416
|
+
};
|
|
417
|
+
video.onended = () => {
|
|
418
|
+
this._emitOnce(video, "playToEnd");
|
|
419
|
+
};
|
|
420
|
+
video.onloadstart = () => {
|
|
421
|
+
this._emitOnce(video, "sourceChange", { source: this.src, oldSource: this.previousSrc });
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// node_modules/expo-video/build/VideoView.web.js
|
|
427
|
+
function createAudioContext() {
|
|
428
|
+
return typeof window !== "undefined" ? new window.AudioContext : null;
|
|
429
|
+
}
|
|
430
|
+
function createZeroGainNode(audioContext) {
|
|
431
|
+
const zeroGainNode = audioContext?.createGain() ?? null;
|
|
432
|
+
if (audioContext && zeroGainNode) {
|
|
433
|
+
zeroGainNode.gain.value = 0;
|
|
434
|
+
zeroGainNode.connect(audioContext.destination);
|
|
435
|
+
}
|
|
436
|
+
return zeroGainNode;
|
|
437
|
+
}
|
|
438
|
+
function mapStyles(style) {
|
|
439
|
+
const flattenedStyles = import_react_native.StyleSheet.flatten(style);
|
|
440
|
+
return flattenedStyles;
|
|
441
|
+
}
|
|
442
|
+
var VideoView = forwardRef((props, ref) => {
|
|
443
|
+
const videoRef = useRef(null);
|
|
444
|
+
const mediaNodeRef = useRef(null);
|
|
445
|
+
const hasToSetupAudioContext = useRef(false);
|
|
446
|
+
const fullscreenChangeListeners = useRef(null);
|
|
447
|
+
const isWaitingForFirstFrame = useRef(false);
|
|
448
|
+
const mountedPlayerRef = useRef(null);
|
|
449
|
+
const audioContextRef = useRef(null);
|
|
450
|
+
const zeroGainNodeRef = useRef(null);
|
|
451
|
+
useEffect(() => {
|
|
452
|
+
if (props.useAudioNodePlayback) {
|
|
453
|
+
maybeSetupAudioContext();
|
|
454
|
+
attachAudioNodes();
|
|
455
|
+
} else {
|
|
456
|
+
detachAudioNodes();
|
|
457
|
+
}
|
|
458
|
+
}, [props.useAudioNodePlayback]);
|
|
459
|
+
useImperativeHandle(ref, () => ({
|
|
460
|
+
enterFullscreen: async () => {
|
|
461
|
+
const video = videoRef.current;
|
|
462
|
+
if (video.requestFullscreen) {
|
|
463
|
+
await video.requestFullscreen();
|
|
464
|
+
} else if (video.webkitRequestFullscreen) {
|
|
465
|
+
await video.webkitRequestFullscreen();
|
|
466
|
+
} else if (video.webkitEnterFullScreen) {
|
|
467
|
+
await video.webkitEnterFullScreen();
|
|
468
|
+
} else if (video.msRequestFullscreen) {
|
|
469
|
+
await video.msRequestFullscreen();
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
exitFullscreen: async () => {
|
|
473
|
+
await document.exitFullscreen();
|
|
474
|
+
},
|
|
475
|
+
startPictureInPicture: async () => {
|
|
476
|
+
await videoRef.current?.requestPictureInPicture();
|
|
477
|
+
},
|
|
478
|
+
stopPictureInPicture: async () => {
|
|
479
|
+
try {
|
|
480
|
+
await document.exitPictureInPicture();
|
|
481
|
+
} catch (e) {
|
|
482
|
+
if (e instanceof DOMException && e.name === "InvalidStateError") {
|
|
483
|
+
console.warn("The VideoView is not in Picture-in-Picture mode.");
|
|
484
|
+
} else {
|
|
485
|
+
throw e;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
nativeRef: videoRef
|
|
490
|
+
}));
|
|
491
|
+
useEffect(() => {
|
|
492
|
+
const onEnter = () => {
|
|
493
|
+
props.onPictureInPictureStart?.();
|
|
494
|
+
};
|
|
495
|
+
const onLeave = () => {
|
|
496
|
+
props.onPictureInPictureStop?.();
|
|
497
|
+
};
|
|
498
|
+
const onLoadStart = () => {
|
|
499
|
+
isWaitingForFirstFrame.current = true;
|
|
500
|
+
};
|
|
501
|
+
const onCanPlay = () => {
|
|
502
|
+
if (isWaitingForFirstFrame.current) {
|
|
503
|
+
props.onFirstFrameRender?.();
|
|
504
|
+
}
|
|
505
|
+
isWaitingForFirstFrame.current = false;
|
|
506
|
+
};
|
|
507
|
+
videoRef.current?.addEventListener("enterpictureinpicture", onEnter);
|
|
508
|
+
videoRef.current?.addEventListener("leavepictureinpicture", onLeave);
|
|
509
|
+
videoRef.current?.addEventListener("loadstart", onLoadStart);
|
|
510
|
+
videoRef.current?.addEventListener("loadeddata", onCanPlay);
|
|
511
|
+
return () => {
|
|
512
|
+
videoRef.current?.removeEventListener("enterpictureinpicture", onEnter);
|
|
513
|
+
videoRef.current?.removeEventListener("leavepictureinpicture", onLeave);
|
|
514
|
+
videoRef.current?.removeEventListener("loadstart", onLoadStart);
|
|
515
|
+
videoRef.current?.removeEventListener("loadeddata", onCanPlay);
|
|
516
|
+
};
|
|
517
|
+
}, [videoRef, props.onPictureInPictureStop, props.onPictureInPictureStart]);
|
|
518
|
+
function attachAudioNodes() {
|
|
519
|
+
if (!props.useAudioNodePlayback) {
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
const audioContext = audioContextRef.current;
|
|
523
|
+
const zeroGainNode = zeroGainNodeRef.current;
|
|
524
|
+
const mediaNode = mediaNodeRef.current;
|
|
525
|
+
if (audioContext && zeroGainNode && mediaNode) {
|
|
526
|
+
props.player?.mountAudioNode(audioContext, zeroGainNode, mediaNode);
|
|
527
|
+
} else {
|
|
528
|
+
console.warn("Couldn't mount audio node, this might affect the audio playback when using multiple video views with the same player.");
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
function detachAudioNodes() {
|
|
532
|
+
if (!props.useAudioNodePlayback) {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
const audioContext = audioContextRef.current;
|
|
536
|
+
const mediaNode = mediaNodeRef.current;
|
|
537
|
+
if (audioContext && mediaNode && videoRef.current) {
|
|
538
|
+
props.player?.unmountAudioNode(videoRef.current, audioContext, mediaNode);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function maybeSetupAudioContext() {
|
|
542
|
+
const userHasNotBeenActive = "userActivation" in navigator && !navigator.userActivation.hasBeenActive;
|
|
543
|
+
if (!hasToSetupAudioContext.current || userHasNotBeenActive || !videoRef.current || !props.useAudioNodePlayback) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
const audioContext = createAudioContext();
|
|
547
|
+
detachAudioNodes();
|
|
548
|
+
audioContextRef.current = audioContext;
|
|
549
|
+
zeroGainNodeRef.current = createZeroGainNode(audioContextRef.current);
|
|
550
|
+
mediaNodeRef.current = audioContext ? audioContext.createMediaElementSource(videoRef.current) : null;
|
|
551
|
+
attachAudioNodes();
|
|
552
|
+
hasToSetupAudioContext.current = false;
|
|
553
|
+
}
|
|
554
|
+
function fullscreenListener() {
|
|
555
|
+
if (document.fullscreenElement === videoRef.current) {
|
|
556
|
+
props.onFullscreenEnter?.();
|
|
557
|
+
} else {
|
|
558
|
+
props.onFullscreenExit?.();
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
function setupFullscreenListener() {
|
|
562
|
+
cleanupFullscreenListener();
|
|
563
|
+
const video = videoRef.current;
|
|
564
|
+
if (!video)
|
|
565
|
+
return;
|
|
566
|
+
const fullscreenListeners = {
|
|
567
|
+
default: fullscreenListener,
|
|
568
|
+
safariEnter: () => props.onFullscreenEnter?.(),
|
|
569
|
+
safariExit: () => props.onFullscreenExit?.(),
|
|
570
|
+
msListener: fullscreenListener
|
|
571
|
+
};
|
|
572
|
+
fullscreenChangeListeners.current = fullscreenListeners;
|
|
573
|
+
video.addEventListener("fullscreenchange", fullscreenListeners.default);
|
|
574
|
+
video.addEventListener("webkitbeginfullscreen", fullscreenListeners.safariEnter);
|
|
575
|
+
video.addEventListener("webkitendfullscreen", fullscreenListeners.safariExit);
|
|
576
|
+
document.addEventListener("MSFullscreenChange", fullscreenListeners.msListener);
|
|
577
|
+
}
|
|
578
|
+
function cleanupFullscreenListener() {
|
|
579
|
+
const video = videoRef.current;
|
|
580
|
+
if (!video || !fullscreenChangeListeners.current)
|
|
581
|
+
return;
|
|
582
|
+
video.removeEventListener("fullscreenchange", fullscreenChangeListeners.current.default);
|
|
583
|
+
video.removeEventListener("webkitbeginfullscreen", fullscreenChangeListeners.current?.safariEnter);
|
|
584
|
+
video.removeEventListener("webkitendfullscreen", fullscreenChangeListeners.current.safariExit);
|
|
585
|
+
document.removeEventListener("MSFullscreenChange", fullscreenChangeListeners.current.msListener);
|
|
586
|
+
}
|
|
587
|
+
useEffect(() => {
|
|
588
|
+
videoRef.current && mountedPlayerRef.current?.unmountVideoView(videoRef.current);
|
|
589
|
+
if (videoRef.current) {
|
|
590
|
+
props.player?.mountVideoView(videoRef.current);
|
|
591
|
+
}
|
|
592
|
+
setupFullscreenListener();
|
|
593
|
+
attachAudioNodes();
|
|
594
|
+
mountedPlayerRef.current = props.player ?? null;
|
|
595
|
+
if (props.player == null) {
|
|
596
|
+
videoRef.current?.removeAttribute("src");
|
|
597
|
+
videoRef.current?.load();
|
|
598
|
+
}
|
|
599
|
+
return () => {
|
|
600
|
+
if (videoRef.current) {
|
|
601
|
+
props.player?.unmountVideoView(videoRef.current);
|
|
602
|
+
}
|
|
603
|
+
mountedPlayerRef.current = null;
|
|
604
|
+
cleanupFullscreenListener();
|
|
605
|
+
detachAudioNodes();
|
|
606
|
+
};
|
|
607
|
+
}, [props.player]);
|
|
608
|
+
return _jsx("video", {
|
|
609
|
+
controls: props.nativeControls ?? true,
|
|
610
|
+
controlsList: props.fullscreenOptions?.enable ? undefined : "nofullscreen",
|
|
611
|
+
crossOrigin: props.crossOrigin,
|
|
612
|
+
style: {
|
|
613
|
+
...mapStyles(props.style),
|
|
614
|
+
objectFit: props.contentFit
|
|
615
|
+
},
|
|
616
|
+
onPlay: () => {
|
|
617
|
+
maybeSetupAudioContext();
|
|
618
|
+
},
|
|
619
|
+
onVolumeChange: () => {
|
|
620
|
+
maybeSetupAudioContext();
|
|
621
|
+
},
|
|
622
|
+
ref: (newRef) => {
|
|
623
|
+
if (newRef && !newRef.isEqualNode(videoRef.current)) {
|
|
624
|
+
videoRef.current = newRef;
|
|
625
|
+
hasToSetupAudioContext.current = props.useAudioNodePlayback ?? false;
|
|
626
|
+
maybeSetupAudioContext();
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
disablePictureInPicture: !props.allowsPictureInPicture,
|
|
630
|
+
playsInline: props.playsInline,
|
|
631
|
+
src: getSourceUri(props.player?.src) ?? undefined
|
|
632
|
+
});
|
|
633
|
+
});
|
|
634
|
+
// src/features/video/adapters/inbound/Video.native.tsx
|
|
635
|
+
var import_react_native2 = __toESM(require_cjs(), 1);
|
|
636
|
+
import React2 from "react";
|
|
637
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
638
|
+
var Video = withZoraThemeScope(VideoInner);
|
|
639
|
+
function configureVideoPlayer(player, volume) {
|
|
640
|
+
player.timeUpdateEventInterval = 0.25;
|
|
641
|
+
setVideoPlayerVolume(player, volume);
|
|
642
|
+
}
|
|
643
|
+
function VideoInner({
|
|
644
|
+
themeId: _themeId,
|
|
645
|
+
mode: _mode,
|
|
646
|
+
interactionPolicy,
|
|
647
|
+
source,
|
|
648
|
+
poster,
|
|
649
|
+
aspectRatio = 16 / 9,
|
|
650
|
+
contentFit = "contain",
|
|
651
|
+
volume = 1,
|
|
652
|
+
accessibilityLabel = "Video player",
|
|
653
|
+
testID
|
|
654
|
+
}) {
|
|
655
|
+
const { theme } = useZoraTheme2();
|
|
656
|
+
const videoRef = React2.useRef(null);
|
|
657
|
+
const player = useVideoPlayer(source ?? null, (nextPlayer) => configureVideoPlayer(nextPlayer, volume));
|
|
658
|
+
const playbackEvents = useVideoPlayerEvents(player);
|
|
659
|
+
const [renderedSource, setRenderedSource] = React2.useState(null);
|
|
660
|
+
const [progressWidth, setProgressWidth] = React2.useState(0);
|
|
661
|
+
const currentTime = playbackEvents.timeUpdate?.currentTime ?? player.currentTime;
|
|
662
|
+
const duration = playbackEvents.sourceLoad?.duration ?? player.duration;
|
|
663
|
+
const isPlaying = playbackEvents.playingChange?.isPlaying ?? player.playing;
|
|
664
|
+
const currentVolume = playbackEvents.volumeChange?.volume ?? player.volume;
|
|
665
|
+
const canInteract = interactionPolicy !== "passive" && source !== null && source !== undefined;
|
|
666
|
+
const safeAspectRatio = isPositiveFiniteNumber(aspectRatio) ? aspectRatio : 16 / 9;
|
|
667
|
+
const safeDuration = isPositiveFiniteNumber(duration) ? duration : 0;
|
|
668
|
+
const safeCurrentTime = clamp(currentTime, 0, safeDuration);
|
|
669
|
+
React2.useEffect(() => {
|
|
670
|
+
setVideoPlayerVolume(player, volume);
|
|
671
|
+
}, [player, volume]);
|
|
672
|
+
const togglePlayback = () => {
|
|
673
|
+
if (player.playing) {
|
|
674
|
+
player.pause();
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
player.play();
|
|
678
|
+
};
|
|
679
|
+
const seekToProgress = (locationX) => {
|
|
680
|
+
if (progressWidth <= 0 || safeDuration === 0)
|
|
681
|
+
return;
|
|
682
|
+
setVideoPlayerCurrentTime(player, clamp(locationX / progressWidth, 0, 1) * safeDuration);
|
|
683
|
+
};
|
|
684
|
+
const changeVolume = (difference) => {
|
|
685
|
+
setVideoPlayerVolume(player, currentVolume + difference);
|
|
686
|
+
};
|
|
687
|
+
const enterFullscreen = () => {
|
|
688
|
+
videoRef.current?.enterFullscreen().catch(() => {
|
|
689
|
+
return;
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
return /* @__PURE__ */ jsxs(View2, {
|
|
693
|
+
bg: theme.semantics.surface.raised,
|
|
694
|
+
borderColor: theme.semantics.neutral.divider,
|
|
695
|
+
borderWidth: 1,
|
|
696
|
+
radius: "m",
|
|
697
|
+
testID,
|
|
698
|
+
overflow: "hidden",
|
|
699
|
+
children: [
|
|
700
|
+
/* @__PURE__ */ jsxs(View2, {
|
|
701
|
+
bg: theme.semantics.neutral.surface,
|
|
702
|
+
style: { aspectRatio: safeAspectRatio },
|
|
703
|
+
children: [
|
|
704
|
+
/* @__PURE__ */ jsx(VideoView, {
|
|
705
|
+
contentFit,
|
|
706
|
+
fullscreenOptions: { enable: true },
|
|
707
|
+
nativeControls: false,
|
|
708
|
+
onFirstFrameRender: () => setRenderedSource(source ?? null),
|
|
709
|
+
player,
|
|
710
|
+
ref: videoRef,
|
|
711
|
+
style: { height: "100%", width: "100%" }
|
|
712
|
+
}),
|
|
713
|
+
poster && renderedSource !== source ? /* @__PURE__ */ jsx(View2, {
|
|
714
|
+
style: { bottom: 0, left: 0, position: "absolute", right: 0, top: 0 },
|
|
715
|
+
pointerEvents: "none",
|
|
716
|
+
children: /* @__PURE__ */ jsx(Image2, {
|
|
717
|
+
alt: "",
|
|
718
|
+
aspectRatio: safeAspectRatio,
|
|
719
|
+
fit: contentFit === "fill" ? "stretch" : contentFit,
|
|
720
|
+
source: poster
|
|
721
|
+
})
|
|
722
|
+
}) : null
|
|
723
|
+
]
|
|
724
|
+
}),
|
|
725
|
+
/* @__PURE__ */ jsxs(View2, {
|
|
726
|
+
gap: "s",
|
|
727
|
+
p: "m",
|
|
728
|
+
children: [
|
|
729
|
+
/* @__PURE__ */ jsx(import_react_native2.Pressable, {
|
|
730
|
+
accessibilityLabel: "Seek video",
|
|
731
|
+
accessibilityRole: "adjustable",
|
|
732
|
+
accessibilityValue: { max: safeDuration, min: 0, now: safeCurrentTime },
|
|
733
|
+
disabled: !canInteract || safeDuration === 0,
|
|
734
|
+
onLayout: (event) => setProgressWidth(event.nativeEvent.layout.width),
|
|
735
|
+
onPress: (event) => seekToProgress(event.nativeEvent.locationX),
|
|
736
|
+
children: /* @__PURE__ */ jsx(View2, {
|
|
737
|
+
bg: theme.semantics.neutral.surface,
|
|
738
|
+
borderColor: theme.semantics.neutral.divider,
|
|
739
|
+
borderWidth: 1,
|
|
740
|
+
radius: "full",
|
|
741
|
+
style: { height: 8, overflow: "hidden" },
|
|
742
|
+
children: /* @__PURE__ */ jsx(View2, {
|
|
743
|
+
bg: theme.semantics.action.primary.base,
|
|
744
|
+
style: {
|
|
745
|
+
height: "100%",
|
|
746
|
+
width: `${resolveProgressPercent(safeCurrentTime, safeDuration)}%`
|
|
747
|
+
}
|
|
748
|
+
})
|
|
749
|
+
})
|
|
750
|
+
}),
|
|
751
|
+
/* @__PURE__ */ jsxs(View2, {
|
|
752
|
+
align: "center",
|
|
753
|
+
direction: "row",
|
|
754
|
+
justify: "space-between",
|
|
755
|
+
wrap: "nowrap",
|
|
756
|
+
children: [
|
|
757
|
+
/* @__PURE__ */ jsxs(Text3, {
|
|
758
|
+
accessibilityLiveRegion: "polite",
|
|
759
|
+
emphasis: "muted",
|
|
760
|
+
variant: "caption",
|
|
761
|
+
children: [
|
|
762
|
+
formatVideoTime(safeCurrentTime),
|
|
763
|
+
" / ",
|
|
764
|
+
formatVideoTime(safeDuration)
|
|
765
|
+
]
|
|
766
|
+
}),
|
|
767
|
+
/* @__PURE__ */ jsxs(View2, {
|
|
768
|
+
align: "center",
|
|
769
|
+
direction: "row",
|
|
770
|
+
gap: "xs",
|
|
771
|
+
wrap: "nowrap",
|
|
772
|
+
children: [
|
|
773
|
+
/* @__PURE__ */ jsx(IconButton2, {
|
|
774
|
+
disabled: !canInteract,
|
|
775
|
+
icon: { name: "play-skip-back" },
|
|
776
|
+
interactionPolicy,
|
|
777
|
+
label: "Seek back 10 seconds",
|
|
778
|
+
onPress: () => player.seekBy(-10),
|
|
779
|
+
size: "s"
|
|
780
|
+
}),
|
|
781
|
+
/* @__PURE__ */ jsx(IconButton2, {
|
|
782
|
+
disabled: !canInteract,
|
|
783
|
+
icon: { name: isPlaying ? "pause" : "play" },
|
|
784
|
+
interactionPolicy,
|
|
785
|
+
label: isPlaying ? "Pause video" : "Play video",
|
|
786
|
+
onPress: togglePlayback,
|
|
787
|
+
size: "m"
|
|
788
|
+
}),
|
|
789
|
+
/* @__PURE__ */ jsx(IconButton2, {
|
|
790
|
+
disabled: !canInteract,
|
|
791
|
+
icon: { name: "play-skip-forward" },
|
|
792
|
+
interactionPolicy,
|
|
793
|
+
label: "Seek forward 10 seconds",
|
|
794
|
+
onPress: () => player.seekBy(10),
|
|
795
|
+
size: "s"
|
|
796
|
+
})
|
|
797
|
+
]
|
|
798
|
+
}),
|
|
799
|
+
/* @__PURE__ */ jsxs(View2, {
|
|
800
|
+
align: "center",
|
|
801
|
+
direction: "row",
|
|
802
|
+
gap: "xs",
|
|
803
|
+
wrap: "nowrap",
|
|
804
|
+
children: [
|
|
805
|
+
/* @__PURE__ */ jsx(IconButton2, {
|
|
806
|
+
disabled: !canInteract || currentVolume <= 0,
|
|
807
|
+
icon: { name: "volume-low" },
|
|
808
|
+
interactionPolicy,
|
|
809
|
+
label: "Lower volume",
|
|
810
|
+
onPress: () => changeVolume(-0.1),
|
|
811
|
+
size: "s"
|
|
812
|
+
}),
|
|
813
|
+
/* @__PURE__ */ jsx(IconButton2, {
|
|
814
|
+
disabled: !canInteract || currentVolume >= 1,
|
|
815
|
+
icon: { name: "volume-high" },
|
|
816
|
+
interactionPolicy,
|
|
817
|
+
label: "Raise volume",
|
|
818
|
+
onPress: () => changeVolume(0.1),
|
|
819
|
+
size: "s"
|
|
820
|
+
}),
|
|
821
|
+
/* @__PURE__ */ jsx(IconButton2, {
|
|
822
|
+
disabled: !canInteract,
|
|
823
|
+
icon: { name: "expand" },
|
|
824
|
+
interactionPolicy,
|
|
825
|
+
label: `Enter fullscreen ${accessibilityLabel}`,
|
|
826
|
+
onPress: enterFullscreen,
|
|
827
|
+
size: "s"
|
|
828
|
+
})
|
|
829
|
+
]
|
|
830
|
+
})
|
|
831
|
+
]
|
|
832
|
+
})
|
|
833
|
+
]
|
|
834
|
+
})
|
|
835
|
+
]
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
function clamp(value, minimum, maximum) {
|
|
839
|
+
if (!Number.isFinite(value))
|
|
840
|
+
return minimum;
|
|
841
|
+
return Math.min(Math.max(value, minimum), maximum);
|
|
842
|
+
}
|
|
843
|
+
function setVideoPlayerCurrentTime(player, currentTime) {
|
|
844
|
+
player.currentTime = currentTime;
|
|
845
|
+
}
|
|
846
|
+
function setVideoPlayerVolume(player, volume) {
|
|
847
|
+
player.volume = clamp(volume, 0, 1);
|
|
848
|
+
}
|
|
849
|
+
function formatVideoTime(value) {
|
|
850
|
+
const totalSeconds = Math.floor(Math.max(0, Number.isFinite(value) ? value : 0));
|
|
851
|
+
const seconds = totalSeconds % 60;
|
|
852
|
+
const minutes = Math.floor(totalSeconds / 60) % 60;
|
|
853
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
854
|
+
const minuteLabel = hours > 0 ? String(minutes).padStart(2, "0") : String(minutes);
|
|
855
|
+
const secondLabel = String(seconds).padStart(2, "0");
|
|
856
|
+
return hours > 0 ? `${hours}:${minuteLabel}:${secondLabel}` : `${minuteLabel}:${secondLabel}`;
|
|
857
|
+
}
|
|
858
|
+
function isPositiveFiniteNumber(value) {
|
|
859
|
+
return Number.isFinite(value) && value > 0;
|
|
860
|
+
}
|
|
861
|
+
function resolveProgressPercent(currentTime, duration) {
|
|
862
|
+
if (duration <= 0)
|
|
863
|
+
return 0;
|
|
864
|
+
return clamp(currentTime / duration * 100, 0, 100);
|
|
865
|
+
}
|
|
866
|
+
function useVideoPlayerEvents(player) {
|
|
867
|
+
const [events, setEvents] = React2.useState({
|
|
868
|
+
player: null,
|
|
869
|
+
playingChange: null,
|
|
870
|
+
sourceLoad: null,
|
|
871
|
+
timeUpdate: null,
|
|
872
|
+
volumeChange: null
|
|
873
|
+
});
|
|
874
|
+
React2.useEffect(() => {
|
|
875
|
+
const timeUpdate = player.addListener("timeUpdate", (value) => {
|
|
876
|
+
setEvents((current) => ({ ...current, player, timeUpdate: value }));
|
|
877
|
+
});
|
|
878
|
+
const sourceLoad = player.addListener("sourceLoad", (value) => {
|
|
879
|
+
setEvents((current) => ({ ...current, player, sourceLoad: value }));
|
|
880
|
+
});
|
|
881
|
+
const playingChange = player.addListener("playingChange", (value) => {
|
|
882
|
+
setEvents((current) => ({ ...current, player, playingChange: value }));
|
|
883
|
+
});
|
|
884
|
+
const volumeChange = player.addListener("volumeChange", (value) => {
|
|
885
|
+
setEvents((current) => ({ ...current, player, volumeChange: value }));
|
|
886
|
+
});
|
|
887
|
+
return () => {
|
|
888
|
+
timeUpdate.remove();
|
|
889
|
+
sourceLoad.remove();
|
|
890
|
+
playingChange.remove();
|
|
891
|
+
volumeChange.remove();
|
|
892
|
+
};
|
|
893
|
+
}, [player]);
|
|
894
|
+
return events.player === player ? events : EMPTY_VIDEO_PLAYBACK_EVENTS;
|
|
895
|
+
}
|
|
896
|
+
var EMPTY_VIDEO_PLAYBACK_EVENTS = {
|
|
897
|
+
player: null,
|
|
898
|
+
playingChange: null,
|
|
899
|
+
sourceLoad: null,
|
|
900
|
+
timeUpdate: null,
|
|
901
|
+
volumeChange: null
|
|
902
|
+
};
|
|
903
|
+
export {
|
|
904
|
+
Video
|
|
905
|
+
};
|