@crievo/omni 0.0.0-stage → 0.1.1
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/.env.example +41 -0
- package/README.md +2 -2
- package/bin/omni.mjs +18 -0
- package/docs/onboarding/clone-voice.png +0 -0
- package/docs/onboarding/getting-started.png +0 -0
- package/docs/onboarding/new-video.png +0 -0
- package/docs/onboarding/providers.png +0 -0
- package/docs/onboarding/publish.png +0 -0
- package/docs/onboarding/references.png +0 -0
- package/docs/onboarding.md +212 -0
- package/omnivideo.config.example.json +437 -0
- package/package.json +40 -4
- package/reference/captions.md +156 -0
- package/reference/carousel-contract.md +91 -0
- package/reference/cloud.md +96 -0
- package/reference/learnings.md +792 -0
- package/reference/omnichat.md +305 -0
- package/reference/premiere-mcp.md +91 -0
- package/reference/publish.md +305 -0
- package/reference/scenes-contract.md +109 -0
- package/reference/studio.md +666 -0
- package/reference/voicestudio.md +81 -0
- package/reference/writing-for-voice.md +67 -0
- package/requirements.txt +3 -0
- package/studio/api/app.ts +87 -0
- package/studio/api/lib/errors.ts +33 -0
- package/studio/api/lib/files.ts +41 -0
- package/studio/api/lib/hono.ts +9 -0
- package/studio/api/lib/result.ts +14 -0
- package/studio/api/lib/validate.ts +31 -0
- package/studio/api/lib/video.ts +10 -0
- package/studio/api/middleware/json-charset.ts +11 -0
- package/studio/api/middleware/local-only.ts +32 -0
- package/studio/api/middleware/no-timeout.ts +10 -0
- package/studio/api/routes/admin.ts +18 -0
- package/studio/api/routes/agent-cascade.ts +100 -0
- package/studio/api/routes/agent-history.ts +23 -0
- package/studio/api/routes/agent.ts +162 -0
- package/studio/api/routes/analytics.ts +31 -0
- package/studio/api/routes/approval.ts +60 -0
- package/studio/api/routes/archive.ts +12 -0
- package/studio/api/routes/captions.ts +28 -0
- package/studio/api/routes/carousel.ts +38 -0
- package/studio/api/routes/clone.ts +27 -0
- package/studio/api/routes/create.ts +19 -0
- package/studio/api/routes/events.ts +11 -0
- package/studio/api/routes/export.ts +14 -0
- package/studio/api/routes/media.ts +30 -0
- package/studio/api/routes/omnichat.ts +113 -0
- package/studio/api/routes/onboarding.ts +14 -0
- package/studio/api/routes/publish.ts +40 -0
- package/studio/api/routes/queue.ts +14 -0
- package/studio/api/routes/references.ts +40 -0
- package/studio/api/routes/runner.ts +17 -0
- package/studio/api/routes/schedule.ts +47 -0
- package/studio/api/routes/services.ts +11 -0
- package/studio/api/routes/sessions.ts +27 -0
- package/studio/api/routes/settings.ts +102 -0
- package/studio/api/routes/sound.ts +45 -0
- package/studio/api/routes/thumbnail.ts +18 -0
- package/studio/api/routes/usage.ts +13 -0
- package/studio/api/routes/videos.ts +41 -0
- package/studio/api/routes/voices.ts +71 -0
- package/studio/api/services/admin.ts +113 -0
- package/studio/api/services/agent-cascade.ts +975 -0
- package/studio/api/services/agent-claude.ts +47 -0
- package/studio/api/services/agent-history.ts +103 -0
- package/studio/api/services/agent-persona.ts +77 -0
- package/studio/api/services/agent-tools.ts +2237 -0
- package/studio/api/services/agent-ui-tools.ts +259 -0
- package/studio/api/services/agent-wait.ts +32 -0
- package/studio/api/services/agent.ts +553 -0
- package/studio/api/services/analytics.ts +92 -0
- package/studio/api/services/approval.ts +134 -0
- package/studio/api/services/archive.ts +38 -0
- package/studio/api/services/captions.ts +268 -0
- package/studio/api/services/carousel.ts +206 -0
- package/studio/api/services/classify.ts +196 -0
- package/studio/api/services/clone-phrases.ts +75 -0
- package/studio/api/services/clone.ts +722 -0
- package/studio/api/services/create.ts +421 -0
- package/studio/api/services/events.ts +215 -0
- package/studio/api/services/media.ts +32 -0
- package/studio/api/services/omnichat.ts +624 -0
- package/studio/api/services/onboarding.ts +77 -0
- package/studio/api/services/publish.ts +287 -0
- package/studio/api/services/queue.ts +150 -0
- package/studio/api/services/references.ts +269 -0
- package/studio/api/services/root.ts +60 -0
- package/studio/api/services/services.ts +114 -0
- package/studio/api/services/sessions.ts +1007 -0
- package/studio/api/services/settings.ts +983 -0
- package/studio/api/services/sound.ts +311 -0
- package/studio/api/services/thumbnail.ts +133 -0
- package/studio/api/services/usage.ts +27 -0
- package/studio/api/services/videos.ts +418 -0
- package/studio/api/services/voice-pause.ts +98 -0
- package/studio/api/services/voices.ts +324 -0
- package/studio/runner/runner.ts +244 -0
- package/studio/shared/omni-actions.ts +68 -0
- package/studio/shared/omni-admin.ts +52 -0
- package/studio/shared/omni-farewell.ts +48 -0
- package/studio/shared/omni-hotword.ts +20 -0
- package/studio/shared/omni-screens.ts +228 -0
- package/studio/shared/schemas/admin.ts +15 -0
- package/studio/shared/schemas/agent-cascade.ts +58 -0
- package/studio/shared/schemas/agent-history.ts +73 -0
- package/studio/shared/schemas/agent.ts +50 -0
- package/studio/shared/schemas/analytics.ts +6 -0
- package/studio/shared/schemas/approval.ts +22 -0
- package/studio/shared/schemas/captions.ts +19 -0
- package/studio/shared/schemas/carousel.ts +26 -0
- package/studio/shared/schemas/clone.ts +40 -0
- package/studio/shared/schemas/common.ts +16 -0
- package/studio/shared/schemas/omnichat.ts +54 -0
- package/studio/shared/schemas/onboarding.ts +5 -0
- package/studio/shared/schemas/publish.ts +45 -0
- package/studio/shared/schemas/references.ts +20 -0
- package/studio/shared/schemas/settings.ts +82 -0
- package/studio/shared/schemas/sound.ts +22 -0
- package/studio/shared/schemas/videos.ts +38 -0
- package/studio/shared/schemas/voices.ts +23 -0
- package/studio/shared/types/api.ts +1290 -0
- package/studio/studio.ts +148 -0
- package/studio/tsconfig.json +15 -0
- package/studio/web/assets/logos/cartesia.svg +4 -0
- package/studio/web/assets/logos/elevenlabs.svg +12 -0
- package/studio/web/assets/logos/fish.svg +24 -0
- package/studio/web/assets/logos/omni-black.png +0 -0
- package/studio/web/assets/logos/omni-white.png +0 -0
- package/studio/web/assets/logos/voicestudio.svg +21 -0
- package/studio/web/components/AgentMark.tsx +7 -0
- package/studio/web/components/AgentWalking.tsx +11 -0
- package/studio/web/components/ApiKeyField.tsx +104 -0
- package/studio/web/components/AppShell.tsx +64 -0
- package/studio/web/components/ApprovalNotice.tsx +65 -0
- package/studio/web/components/AvatarGroupIcon.tsx +22 -0
- package/studio/web/components/AvatarNameField.tsx +86 -0
- package/studio/web/components/AvatarPicker.tsx +84 -0
- package/studio/web/components/BrandLogo.tsx +16 -0
- package/studio/web/components/CartesiaPlanSetting.tsx +90 -0
- package/studio/web/components/ClaudeWalking.tsx +32 -0
- package/studio/web/components/CloneVoiceDialog/GuidedScript.tsx +39 -0
- package/studio/web/components/CloneVoiceDialog/LanguageBar.tsx +37 -0
- package/studio/web/components/CloneVoiceDialog/LevelMeter.tsx +31 -0
- package/studio/web/components/CloneVoiceDialog/ProviderChoice.tsx +81 -0
- package/studio/web/components/CloneVoiceDialog/QualityPanel.tsx +62 -0
- package/studio/web/components/CloneVoiceDialog/RecordStep.tsx +50 -0
- package/studio/web/components/CloneVoiceDialog/RecorderBar.tsx +79 -0
- package/studio/web/components/CloneVoiceDialog/RedoSummary.tsx +54 -0
- package/studio/web/components/CloneVoiceDialog/SaveStep.tsx +91 -0
- package/studio/web/components/CloneVoiceDialog/SourceBar.tsx +30 -0
- package/studio/web/components/CloneVoiceDialog/index.tsx +141 -0
- package/studio/web/components/CloneVoiceDialog/types.ts +28 -0
- package/studio/web/components/CloneVoiceDialog/useCloneVoice.ts +528 -0
- package/studio/web/components/ConnectionSignals.tsx +51 -0
- package/studio/web/components/EditVoiceDialog/EditVoiceFooter.tsx +72 -0
- package/studio/web/components/EditVoiceDialog/ProviderCards.tsx +81 -0
- package/studio/web/components/EditVoiceDialog/index.tsx +256 -0
- package/studio/web/components/ErrorBanner.tsx +115 -0
- package/studio/web/components/FinishedTask.tsx +41 -0
- package/studio/web/components/FishModelSetting.tsx +69 -0
- package/studio/web/components/FishPriceSetting.tsx +44 -0
- package/studio/web/components/HumanBanner.tsx +64 -0
- package/studio/web/components/Lightbox.tsx +41 -0
- package/studio/web/components/LogStream.tsx +42 -0
- package/studio/web/components/Markdown.tsx +21 -0
- package/studio/web/components/MissingDmsPanel/BatchSend.tsx +137 -0
- package/studio/web/components/MissingDmsPanel/CommentCard.tsx +168 -0
- package/studio/web/components/MissingDmsPanel/CommentFeed.tsx +45 -0
- package/studio/web/components/MissingDmsPanel/DmBubble.tsx +38 -0
- package/studio/web/components/MissingDmsPanel/ReplyComposer.tsx +63 -0
- package/studio/web/components/MissingDmsPanel/index.tsx +98 -0
- package/studio/web/components/NotFound.tsx +48 -0
- package/studio/web/components/Omni/OmniAvatarPicker.tsx +92 -0
- package/studio/web/components/Omni/OmniCards.tsx +202 -0
- package/studio/web/components/Omni/OmniGlow.tsx +183 -0
- package/studio/web/components/Omni/OmniHistory.tsx +119 -0
- package/studio/web/components/Omni/OmniHotword.tsx +40 -0
- package/studio/web/components/Omni/OmniMicSelect.tsx +92 -0
- package/studio/web/components/Omni/OmniVoiceSample.tsx +81 -0
- package/studio/web/components/Omni/OmniWidget.tsx +743 -0
- package/studio/web/components/Omni/PendingActions.tsx +200 -0
- package/studio/web/components/Omni/Transcript.tsx +127 -0
- package/studio/web/components/OmnichatAccountStatus.tsx +87 -0
- package/studio/web/components/OmnichatRulePanel/RuleConfig.tsx +150 -0
- package/studio/web/components/OmnichatRulePanel/RuleDryRun.tsx +15 -0
- package/studio/web/components/OmnichatRulePanel/RuleEnableConfirm.tsx +42 -0
- package/studio/web/components/OmnichatRulePanel/RuleSkeleton.tsx +18 -0
- package/studio/web/components/OmnichatRulePanel/RuleStatus.tsx +55 -0
- package/studio/web/components/OmnichatRulePanel/index.tsx +115 -0
- package/studio/web/components/OmnichatRulePanel/rule-steps.ts +67 -0
- package/studio/web/components/OmnichatRulePanel/steps/MessageStep.tsx +91 -0
- package/studio/web/components/OmnichatRulePanel/steps/RepliesStep.tsx +201 -0
- package/studio/web/components/OmnichatRulePanel/steps/TriggerStep.tsx +76 -0
- package/studio/web/components/OmnichatRulePanel/steps/types.ts +11 -0
- package/studio/web/components/Palette.tsx +17 -0
- package/studio/web/components/PlatformCard.tsx +109 -0
- package/studio/web/components/PlatformIcon.tsx +19 -0
- package/studio/web/components/ProviderCard.tsx +80 -0
- package/studio/web/components/ProviderDetail.tsx +367 -0
- package/studio/web/components/ProviderLogo.tsx +20 -0
- package/studio/web/components/QueuePanel.tsx +77 -0
- package/studio/web/components/ReferenceActions.tsx +89 -0
- package/studio/web/components/ReferencePicker.tsx +136 -0
- package/studio/web/components/ResultMessage.tsx +7 -0
- package/studio/web/components/RuleForm.tsx +138 -0
- package/studio/web/components/RuleLog.tsx +151 -0
- package/studio/web/components/RunningTask.tsx +23 -0
- package/studio/web/components/SampleList.tsx +55 -0
- package/studio/web/components/SessionPanel.tsx +352 -0
- package/studio/web/components/SettingRow.tsx +14 -0
- package/studio/web/components/SettingsCategorySkeleton.tsx +25 -0
- package/studio/web/components/SidePanel.tsx +77 -0
- package/studio/web/components/Sidebar.tsx +289 -0
- package/studio/web/components/StageStepper.tsx +87 -0
- package/studio/web/components/StudioOffline.tsx +80 -0
- package/studio/web/components/TaskName.tsx +17 -0
- package/studio/web/components/TopBanners.tsx +30 -0
- package/studio/web/components/VideoOmnichatPanel.tsx +287 -0
- package/studio/web/components/VoiceAvatar.tsx +33 -0
- package/studio/web/components/VoiceCarousel.tsx +196 -0
- package/studio/web/components/VoiceCategory.tsx +9 -0
- package/studio/web/components/VoiceModal.tsx +39 -0
- package/studio/web/components/VoiceProfileCard.tsx +75 -0
- package/studio/web/components/VoiceProfilePicker.tsx +107 -0
- package/studio/web/components/VoiceProfilesSettings.tsx +150 -0
- package/studio/web/components/VoiceProviderCard.tsx +118 -0
- package/studio/web/components/VoiceProvidersCard.tsx +26 -0
- package/studio/web/components/WaitList.tsx +21 -0
- package/studio/web/components/icons.tsx +247 -0
- package/studio/web/components/ui/accordion.tsx +47 -0
- package/studio/web/components/ui/badge.tsx +18 -0
- package/studio/web/components/ui/calendar.tsx +43 -0
- package/studio/web/components/ui/chart.tsx +229 -0
- package/studio/web/components/ui/checkbox.tsx +26 -0
- package/studio/web/components/ui/cx.ts +2 -0
- package/studio/web/components/ui/date-time-picker.tsx +84 -0
- package/studio/web/components/ui/panel.tsx +23 -0
- package/studio/web/components/ui/picker.tsx +58 -0
- package/studio/web/components/ui/popover.tsx +24 -0
- package/studio/web/components/ui/select.tsx +89 -0
- package/studio/web/components/ui/skeleton.tsx +10 -0
- package/studio/web/components/ui/slider.tsx +68 -0
- package/studio/web/components/ui/switch.tsx +13 -0
- package/studio/web/components/ui/tooltip.tsx +59 -0
- package/studio/web/hooks/useAccounts.ts +27 -0
- package/studio/web/hooks/useAdmin.ts +12 -0
- package/studio/web/hooks/useAnalytics.ts +21 -0
- package/studio/web/hooks/useAvatarAudioReactive.ts +87 -0
- package/studio/web/hooks/useBrowserConnect.ts +48 -0
- package/studio/web/hooks/useClonePlan.ts +14 -0
- package/studio/web/hooks/useConnected.ts +7 -0
- package/studio/web/hooks/useLiveQuery.ts +29 -0
- package/studio/web/hooks/useMenuCollapsed.ts +32 -0
- package/studio/web/hooks/useMicDevices.ts +53 -0
- package/studio/web/hooks/useMissingDms.ts +211 -0
- package/studio/web/hooks/useMissingSetupSteps.ts +26 -0
- package/studio/web/hooks/useNow.ts +11 -0
- package/studio/web/hooks/useOmniAgent.ts +278 -0
- package/studio/web/hooks/useOmniClaude.ts +124 -0
- package/studio/web/hooks/useOmniDock.ts +142 -0
- package/studio/web/hooks/useOmniGreeting.ts +60 -0
- package/studio/web/hooks/useOmniHotword.ts +128 -0
- package/studio/web/hooks/useOmnichat.ts +26 -0
- package/studio/web/hooks/useOnboarding.ts +27 -0
- package/studio/web/hooks/usePost.ts +23 -0
- package/studio/web/hooks/useQueue.ts +10 -0
- package/studio/web/hooks/useReferences.ts +20 -0
- package/studio/web/hooks/useRuleEditor.ts +101 -0
- package/studio/web/hooks/useRunner.ts +24 -0
- package/studio/web/hooks/useSaveAction.ts +23 -0
- package/studio/web/hooks/useSchedule.ts +11 -0
- package/studio/web/hooks/useServices.ts +10 -0
- package/studio/web/hooks/useSessions.ts +15 -0
- package/studio/web/hooks/useSettings.ts +11 -0
- package/studio/web/hooks/useSettingsSection.ts +30 -0
- package/studio/web/hooks/useSidePanel.ts +23 -0
- package/studio/web/hooks/useSound.ts +30 -0
- package/studio/web/hooks/useUsage.ts +11 -0
- package/studio/web/hooks/useVideoVoice.ts +36 -0
- package/studio/web/hooks/useVideos.ts +21 -0
- package/studio/web/hooks/useVoiceProfilePreview.ts +52 -0
- package/studio/web/hooks/useVoiceProfiles.ts +7 -0
- package/studio/web/hooks/useVoiceRunning.ts +10 -0
- package/studio/web/hooks/useVoiceStudioClosed.ts +8 -0
- package/studio/web/index.html +19 -0
- package/studio/web/lib/agent.ts +7 -0
- package/studio/web/lib/alerts.ts +210 -0
- package/studio/web/lib/analytics-metrics.ts +351 -0
- package/studio/web/lib/api.ts +70 -0
- package/studio/web/lib/audio.ts +39 -0
- package/studio/web/lib/avatars.ts +41 -0
- package/studio/web/lib/calendar.ts +218 -0
- package/studio/web/lib/caption-position.ts +249 -0
- package/studio/web/lib/carousel.ts +24 -0
- package/studio/web/lib/chime.ts +42 -0
- package/studio/web/lib/clone-voice.ts +55 -0
- package/studio/web/lib/export.ts +11 -0
- package/studio/web/lib/files.ts +8 -0
- package/studio/web/lib/format.ts +93 -0
- package/studio/web/lib/media.ts +29 -0
- package/studio/web/lib/mic-device.ts +72 -0
- package/studio/web/lib/missing-dms.ts +70 -0
- package/studio/web/lib/omni-cards.ts +42 -0
- package/studio/web/lib/omni-cascade.ts +1067 -0
- package/studio/web/lib/omni-greeting-audio.ts +24 -0
- package/studio/web/lib/omni-hotword.ts +231 -0
- package/studio/web/lib/omni-panel.ts +67 -0
- package/studio/web/lib/omni-realtime.ts +811 -0
- package/studio/web/lib/omni-ui.ts +402 -0
- package/studio/web/lib/omni-wait.ts +174 -0
- package/studio/web/lib/omnichat-api.ts +44 -0
- package/studio/web/lib/orb.ts +270 -0
- package/studio/web/lib/pcm-recorder.ts +115 -0
- package/studio/web/lib/platforms.ts +17 -0
- package/studio/web/lib/providers.ts +27 -0
- package/studio/web/lib/publish-draft.ts +52 -0
- package/studio/web/lib/publish-settings.ts +81 -0
- package/studio/web/lib/query-client.ts +122 -0
- package/studio/web/lib/references.ts +13 -0
- package/studio/web/lib/services.ts +40 -0
- package/studio/web/lib/sessions.ts +103 -0
- package/studio/web/lib/settings-categories.ts +58 -0
- package/studio/web/lib/sound-audio.ts +33 -0
- package/studio/web/lib/sound-timeline.ts +291 -0
- package/studio/web/lib/sse.ts +86 -0
- package/studio/web/lib/stage-history.ts +141 -0
- package/studio/web/lib/stages.ts +344 -0
- package/studio/web/lib/studio-offline.ts +60 -0
- package/studio/web/lib/upload.ts +24 -0
- package/studio/web/lib/video-tabs.ts +118 -0
- package/studio/web/lib/voice-profile-draft.ts +34 -0
- package/studio/web/lib/voice-profiles.ts +3 -0
- package/studio/web/main.tsx +14 -0
- package/studio/web/pages/AdminPage/index.tsx +123 -0
- package/studio/web/pages/AgentPage/components/Measurements.tsx +102 -0
- package/studio/web/pages/AgentPage/index.tsx +28 -0
- package/studio/web/pages/AnalyticsPage/components/About.tsx +52 -0
- package/studio/web/pages/AnalyticsPage/components/ChannelCards.tsx +106 -0
- package/studio/web/pages/AnalyticsPage/components/ChannelView.tsx +137 -0
- package/studio/web/pages/AnalyticsPage/components/CollectionStatus.tsx +46 -0
- package/studio/web/pages/AnalyticsPage/components/Comparison.tsx +68 -0
- package/studio/web/pages/AnalyticsPage/components/Diagnosis.tsx +50 -0
- package/studio/web/pages/AnalyticsPage/components/Highlights.tsx +49 -0
- package/studio/web/pages/AnalyticsPage/components/Hint.tsx +11 -0
- package/studio/web/pages/AnalyticsPage/components/HookVsBody.tsx +100 -0
- package/studio/web/pages/AnalyticsPage/components/HourlyWave.tsx +133 -0
- package/studio/web/pages/AnalyticsPage/components/Insights.tsx +70 -0
- package/studio/web/pages/AnalyticsPage/components/MetricCard.tsx +46 -0
- package/studio/web/pages/AnalyticsPage/components/PlanSection.tsx +40 -0
- package/studio/web/pages/AnalyticsPage/components/ProgressionChart.tsx +155 -0
- package/studio/web/pages/AnalyticsPage/components/ReelBarsChart.tsx +154 -0
- package/studio/web/pages/AnalyticsPage/components/ReelThumb.tsx +19 -0
- package/studio/web/pages/AnalyticsPage/components/ReelView.tsx +290 -0
- package/studio/web/pages/AnalyticsPage/components/ReelsTable.tsx +269 -0
- package/studio/web/pages/AnalyticsPage/components/RequestWithFocus.tsx +38 -0
- package/studio/web/pages/AnalyticsPage/components/SegmentedControl.tsx +35 -0
- package/studio/web/pages/AnalyticsPage/components/VsMedian.tsx +31 -0
- package/studio/web/pages/AnalyticsPage/index.tsx +17 -0
- package/studio/web/pages/GettingStartedPage/index.tsx +174 -0
- package/studio/web/pages/NewVideoPage/components/DeliverablesPicker.tsx +62 -0
- package/studio/web/pages/NewVideoPage/components/FormatPicker.tsx +33 -0
- package/studio/web/pages/NewVideoPage/index.tsx +133 -0
- package/studio/web/pages/NotFoundPage/index.tsx +9 -0
- package/studio/web/pages/OmnichatPage/components/NewFromLink.tsx +59 -0
- package/studio/web/pages/OmnichatPage/components/RuleListItem.tsx +64 -0
- package/studio/web/pages/OmnichatPage/components/RulePreview.tsx +14 -0
- package/studio/web/pages/OmnichatPage/components/RuleView.tsx +88 -0
- package/studio/web/pages/OmnichatPage/index.tsx +153 -0
- package/studio/web/pages/QueuePage/index.tsx +22 -0
- package/studio/web/pages/ReferencePage/components/ReferenceTexts.tsx +131 -0
- package/studio/web/pages/ReferencePage/index.tsx +216 -0
- package/studio/web/pages/ReferencesPage/components/NewReferenceForm.tsx +150 -0
- package/studio/web/pages/ReferencesPage/components/ReferenceCard.tsx +42 -0
- package/studio/web/pages/ReferencesPage/components/ReferenceGridSkeleton.tsx +31 -0
- package/studio/web/pages/ReferencesPage/index.tsx +67 -0
- package/studio/web/pages/SchedulePage/components/CalendarSkeleton.tsx +18 -0
- package/studio/web/pages/SchedulePage/components/DayView.tsx +177 -0
- package/studio/web/pages/SchedulePage/components/HourPicker.tsx +103 -0
- package/studio/web/pages/SchedulePage/components/MonthDayCell.tsx +111 -0
- package/studio/web/pages/SchedulePage/components/MonthView.tsx +47 -0
- package/studio/web/pages/SchedulePage/components/PlatformIcons.tsx +12 -0
- package/studio/web/pages/SchedulePage/components/PostThumb.tsx +15 -0
- package/studio/web/pages/SchedulePage/components/WeekColumn.tsx +75 -0
- package/studio/web/pages/SchedulePage/components/WeekView.tsx +35 -0
- package/studio/web/pages/SchedulePage/index.tsx +285 -0
- package/studio/web/pages/SettingsPage/components/AgentAccounts.tsx +263 -0
- package/studio/web/pages/SettingsPage/components/AgentCategory.tsx +20 -0
- package/studio/web/pages/SettingsPage/components/ModelPicker.tsx +49 -0
- package/studio/web/pages/SettingsPage/components/ModelsSettings.tsx +138 -0
- package/studio/web/pages/SettingsPage/components/PlatformsCategory.tsx +23 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/AccountStatus.tsx +29 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/AutoPublishPanel.tsx +90 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/BrowserConnect.tsx +62 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/CheckField.tsx +19 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/InstagramPanel.tsx +113 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/OmnichatSettingsPanel.tsx +146 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SaveBar.tsx +33 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SchedulePanel.tsx +132 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SettingsCard.tsx +47 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SettingsCardGroup.tsx +19 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/TextPanel.tsx +55 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/TiktokPanel.tsx +123 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/YoutubePanel.tsx +100 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/badges.tsx +15 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/index.tsx +40 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/types.ts +10 -0
- package/studio/web/pages/SettingsPage/components/UsageCategory.tsx +389 -0
- package/studio/web/pages/SettingsPage/components/VoiceProvidersCategory.tsx +97 -0
- package/studio/web/pages/SettingsPage/index.tsx +85 -0
- package/studio/web/pages/VideoPage/components/AudioPlayer.tsx +113 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/AxisField.tsx +50 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionList.tsx +56 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionListItem.tsx +92 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionMargins.tsx +57 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionStyleFields.tsx +70 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionTextForm.tsx +87 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/ColorField.tsx +37 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/MarginField.tsx +59 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/NumberField.tsx +57 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/PositionControls.tsx +140 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/captionEditor.ts +215 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/useCaptionPosition.ts +154 -0
- package/studio/web/pages/VideoPage/components/CarouselChangeRequest.tsx +72 -0
- package/studio/web/pages/VideoPage/components/CarouselCompositionStage.tsx +80 -0
- package/studio/web/pages/VideoPage/components/CarouselCreate.tsx +63 -0
- package/studio/web/pages/VideoPage/components/CarouselMissing.tsx +19 -0
- package/studio/web/pages/VideoPage/components/CarouselPublishStage.tsx +173 -0
- package/studio/web/pages/VideoPage/components/CarouselScriptStage.tsx +82 -0
- package/studio/web/pages/VideoPage/components/CarouselSlideCard.tsx +49 -0
- package/studio/web/pages/VideoPage/components/CarouselViewer.tsx +55 -0
- package/studio/web/pages/VideoPage/components/ChangedVoices.tsx +53 -0
- package/studio/web/pages/VideoPage/components/CompositionStage.tsx +78 -0
- package/studio/web/pages/VideoPage/components/CoverPicker.tsx +32 -0
- package/studio/web/pages/VideoPage/components/EditorStage.tsx +53 -0
- package/studio/web/pages/VideoPage/components/LineTakes.tsx +160 -0
- package/studio/web/pages/VideoPage/components/LineTextEditor.tsx +124 -0
- package/studio/web/pages/VideoPage/components/LineVoicePicker.tsx +37 -0
- package/studio/web/pages/VideoPage/components/MediaImage.tsx +25 -0
- package/studio/web/pages/VideoPage/components/MotionScriptStage.tsx +39 -0
- package/studio/web/pages/VideoPage/components/NarrationStage.tsx +70 -0
- package/studio/web/pages/VideoPage/components/PublishForm.tsx +387 -0
- package/studio/web/pages/VideoPage/components/PublishStage.tsx +76 -0
- package/studio/web/pages/VideoPage/components/PublishText.tsx +149 -0
- package/studio/web/pages/VideoPage/components/ScenesApprovalPanel.tsx +278 -0
- package/studio/web/pages/VideoPage/components/ScheduledInfo.tsx +72 -0
- package/studio/web/pages/VideoPage/components/ScriptApprovalPanel.tsx +189 -0
- package/studio/web/pages/VideoPage/components/ScriptStage.tsx +17 -0
- package/studio/web/pages/VideoPage/components/SequencePlayer.tsx +146 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/AddSound.tsx +117 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/AreaSelection.tsx +74 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/BedPanel.tsx +94 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/BedRow.tsx +45 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CaptionOverlay.tsx +44 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CaptionSaveBar.tsx +32 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CaptionsPanel.tsx +22 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/ClipBlock.tsx +111 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/ClipPanel.tsx +76 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CutsPanel.tsx +44 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EditorTabBar.tsx +73 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectChoice.tsx +46 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectItem.tsx +89 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectPanel.tsx +232 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectsRow.tsx +21 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/Lane.tsx +39 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/MarkerRow.tsx +40 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/MuteButton.tsx +36 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/NumberInput.tsx +37 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/PlanWarnings.tsx +19 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/PlayerResizeHandle.tsx +50 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/PreviewControls.tsx +51 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SceneRow.tsx +54 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SettingsPanel.tsx +65 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SoundLibrary.tsx +99 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SoundPreview.tsx +82 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SpeedPanel.tsx +128 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineDock.tsx +56 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineFooter.tsx +26 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineSkeleton.tsx +21 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineToolbar.tsx +160 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineTracks.tsx +121 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TrackSidebar.tsx +30 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/VoiceRow.tsx +53 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/Waveform.tsx +97 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/clipActions.ts +50 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/effectActions.ts +161 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/index.tsx +161 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/timelineGeometry.ts +45 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/types.ts +43 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useAutosave.ts +107 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useEditorShortcuts.ts +168 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useFitHeight.ts +40 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useFollowPlayhead.ts +21 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useListenMix.ts +43 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/usePlayback.ts +231 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/usePlayerWidth.ts +27 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useSoundData.ts +124 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useSoundTimeline.ts +511 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/CompareVersions.tsx +111 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/VersionCard.tsx +81 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/VersionMedia.tsx +24 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/VersionText.tsx +15 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/index.tsx +109 -0
- package/studio/web/pages/VideoPage/components/StageProcess.tsx +126 -0
- package/studio/web/pages/VideoPage/components/StageResult.tsx +69 -0
- package/studio/web/pages/VideoPage/components/SwapReference.tsx +92 -0
- package/studio/web/pages/VideoPage/components/ThumbnailPanel.tsx +252 -0
- package/studio/web/pages/VideoPage/components/TimingPanel.tsx +89 -0
- package/studio/web/pages/VideoPage/components/VideoPlayer.tsx +18 -0
- package/studio/web/pages/VideoPage/components/VideoSkeleton.tsx +50 -0
- package/studio/web/pages/VideoPage/components/VideoVoiceInfo.tsx +33 -0
- package/studio/web/pages/VideoPage/components/VideoVoicePicker.tsx +165 -0
- package/studio/web/pages/VideoPage/components/VoicePauseBanner.tsx +56 -0
- package/studio/web/pages/VideoPage/components/WithLogo.tsx +10 -0
- package/studio/web/pages/VideoPage/index.tsx +295 -0
- package/studio/web/pages/VideosPage/components/PublishedOn.tsx +85 -0
- package/studio/web/pages/VideosPage/components/ServicesPanel.tsx +81 -0
- package/studio/web/pages/VideosPage/components/SessionsPanel.tsx +62 -0
- package/studio/web/pages/VideosPage/components/VideoListSkeleton.tsx +25 -0
- package/studio/web/pages/VideosPage/components/VideoRow.tsx +122 -0
- package/studio/web/pages/VideosPage/index.tsx +134 -0
- package/studio/web/pages/VoicePage/index.tsx +28 -0
- package/studio/web/router.tsx +201 -0
- package/studio/web/styles/base/elements.css +55 -0
- package/studio/web/styles/base/utilities.css +25 -0
- package/studio/web/styles/components/badge.css +33 -0
- package/studio/web/styles/components/claude-running.css +27 -0
- package/studio/web/styles/components/claude-session.css +212 -0
- package/studio/web/styles/components/claude-walking.css +92 -0
- package/studio/web/styles/components/clone-voice-save.css +136 -0
- package/studio/web/styles/components/clone-voice.css +379 -0
- package/studio/web/styles/components/controls.css +70 -0
- package/studio/web/styles/components/data-and-image.css +54 -0
- package/studio/web/styles/components/forms.css +132 -0
- package/studio/web/styles/components/human-banner.css +99 -0
- package/studio/web/styles/components/lightbox.css +50 -0
- package/studio/web/styles/components/markdown.css +68 -0
- package/studio/web/styles/components/modal.css +70 -0
- package/studio/web/styles/components/omni-cards.css +105 -0
- package/studio/web/styles/components/omni.css +859 -0
- package/studio/web/styles/components/omnichat.css +538 -0
- package/studio/web/styles/components/panel.css +115 -0
- package/studio/web/styles/components/platform-card.css +140 -0
- package/studio/web/styles/components/provider-card.css +132 -0
- package/studio/web/styles/components/queue.css +185 -0
- package/studio/web/styles/components/reference-actions.css +133 -0
- package/studio/web/styles/components/reference-picker.css +146 -0
- package/studio/web/styles/components/results-drawer.css +224 -0
- package/studio/web/styles/components/segmented.css +115 -0
- package/studio/web/styles/components/side-panel-tab.css +23 -0
- package/studio/web/styles/components/status-signals.css +66 -0
- package/studio/web/styles/components/stepper.css +208 -0
- package/studio/web/styles/components/table.css +19 -0
- package/studio/web/styles/components/tabs.css +24 -0
- package/studio/web/styles/components/ui/accordion.css +71 -0
- package/studio/web/styles/components/ui/chart.css +162 -0
- package/studio/web/styles/components/ui/checkbox.css +37 -0
- package/studio/web/styles/components/ui/date-picker.css +153 -0
- package/studio/web/styles/components/ui/select.css +110 -0
- package/studio/web/styles/components/ui/skeleton.css +25 -0
- package/studio/web/styles/components/ui/slider.css +81 -0
- package/studio/web/styles/components/ui/switch.css +41 -0
- package/studio/web/styles/components/ui/tooltip.css +24 -0
- package/studio/web/styles/components/voice-carousel.css +255 -0
- package/studio/web/styles/components/voice-editor.css +179 -0
- package/studio/web/styles/components/voice-grid.css +56 -0
- package/studio/web/styles/components/voice-profiles.css +192 -0
- package/studio/web/styles/design-system.md +136 -0
- package/studio/web/styles/index.css +116 -0
- package/studio/web/styles/layout/page.css +41 -0
- package/studio/web/styles/layout/sidebar-groups.css +39 -0
- package/studio/web/styles/layout/sidebar.css +111 -0
- package/studio/web/styles/pages/agent.css +26 -0
- package/studio/web/styles/pages/analytics/dashboard.css +614 -0
- package/studio/web/styles/pages/analytics/insights.css +48 -0
- package/studio/web/styles/pages/getting-started.css +166 -0
- package/studio/web/styles/pages/new-video/form.css +32 -0
- package/studio/web/styles/pages/not-found.css +59 -0
- package/studio/web/styles/pages/references.css +204 -0
- package/studio/web/styles/pages/schedule/calendar.css +541 -0
- package/studio/web/styles/pages/schedule/chip-states.css +60 -0
- package/studio/web/styles/pages/settings/models.css +72 -0
- package/studio/web/styles/pages/settings/shell.css +361 -0
- package/studio/web/styles/pages/settings/usage.css +63 -0
- package/studio/web/styles/pages/studio-offline.css +105 -0
- package/studio/web/styles/pages/video/caption-controls.css +194 -0
- package/studio/web/styles/pages/video/captions-grid.css +70 -0
- package/studio/web/styles/pages/video/captions.css +79 -0
- package/studio/web/styles/pages/video/editor-chat.css +103 -0
- package/studio/web/styles/pages/video/export.css +50 -0
- package/studio/web/styles/pages/video/frames.css +29 -0
- package/studio/web/styles/pages/video/fullscreen-stage.css +400 -0
- package/studio/web/styles/pages/video/instagram-carousel.css +309 -0
- package/studio/web/styles/pages/video/layout.css +285 -0
- package/studio/web/styles/pages/video/narration.css +138 -0
- package/studio/web/styles/pages/video/preview-overview.css +11 -0
- package/studio/web/styles/pages/video/processing-notice.css +34 -0
- package/studio/web/styles/pages/video/publish-when.css +76 -0
- package/studio/web/styles/pages/video/publish.css +97 -0
- package/studio/web/styles/pages/video/result.css +96 -0
- package/studio/web/styles/pages/video/scenes.css +167 -0
- package/studio/web/styles/pages/video/sound-timeline.css +672 -0
- package/studio/web/styles/pages/video/sound-toolbar.css +149 -0
- package/studio/web/styles/pages/video/take-player.css +100 -0
- package/studio/web/styles/pages/video/thumbnail.css +157 -0
- package/studio/web/styles/pages/video/timeline.css +117 -0
- package/studio/web/styles/pages/video/voice-picker.css +14 -0
- package/studio/web/styles/pages/video-list/active-row.css +27 -0
- package/studio/web/styles/pages/video-list/card-link.css +49 -0
- package/studio/web/styles/pages/video-list/list.css +86 -0
- package/studio/web/styles/theme/identity/details.css +204 -0
- package/studio/web/styles/theme/identity/shell.css +249 -0
- package/studio/web/styles/theme/identity/surfaces.css +183 -0
- package/studio/web/styles/theme/identity/titles-and-buttons.css +120 -0
- package/studio/web/styles/theme/no-borders/blocks.css +208 -0
- package/studio/web/styles/theme/no-borders/controls.css +256 -0
- package/studio/web/styles/tokens.css +245 -0
- package/studio/web/types/api.ts +2 -0
- package/studio/web/types/assets.d.ts +9 -0
- package/templates/brief.md +27 -0
- package/templates/captions.html +204 -0
- package/templates/carousel-composition.md +47 -0
- package/templates/carousel-script.md +60 -0
- package/templates/components/voiceavatar/README.md +87 -0
- package/templates/components/voiceavatar/demo.html +50 -0
- package/templates/components/voiceavatar/voiceavatar.js +415 -0
- package/templates/motion.md +80 -0
- package/templates/playbook.md +43 -0
- package/templates/reference.md +123 -0
- package/templates/scene.html +112 -0
- package/templates/scenes.example.json +96 -0
- package/templates/script.md +63 -0
- package/templates/slide.html +71 -0
- package/templates/wireframe.html +91 -0
- package/tools/analysis.mjs +300 -0
- package/tools/approval.mjs +442 -0
- package/tools/assemble.mjs +942 -0
- package/tools/build-motion.mjs +437 -0
- package/tools/captions.mjs +246 -0
- package/tools/carousel.mjs +558 -0
- package/tools/compose.mjs +307 -0
- package/tools/cuts.mjs +74 -0
- package/tools/editor.mjs +419 -0
- package/tools/epidemic-capture.js +54 -0
- package/tools/fanout.mjs +69 -0
- package/tools/history.mjs +70 -0
- package/tools/history.py +61 -0
- package/tools/job-queue.mjs +180 -0
- package/tools/job_queue.py +430 -0
- package/tools/lib/agents.mjs +412 -0
- package/tools/lib/channel.mjs +399 -0
- package/tools/lib/claude-settings.mjs +67 -0
- package/tools/lib/cli.mjs +9 -0
- package/tools/lib/fanout.mjs +234 -0
- package/tools/lib/http.mjs +94 -0
- package/tools/lib/index.js +14 -0
- package/tools/lib/mcp-server.mjs +69 -0
- package/tools/lib/metrics/metrics.mjs +204 -0
- package/tools/lib/narration.mjs +15 -0
- package/tools/lib/oauth-client.mjs +295 -0
- package/tools/lib/omnichat/config.mjs +139 -0
- package/tools/lib/omnichat/errors.mjs +42 -0
- package/tools/lib/omnichat/extract.mjs +82 -0
- package/tools/lib/omnichat/gate.mjs +151 -0
- package/tools/lib/omnichat/manual.mjs +166 -0
- package/tools/lib/omnichat/match.mjs +78 -0
- package/tools/lib/omnichat/pass.mjs +393 -0
- package/tools/lib/omnichat/record.mjs +208 -0
- package/tools/lib/omnichat/text.mjs +315 -0
- package/tools/lib/omnichat/webhook.mjs +166 -0
- package/tools/lib/pairing.mjs +99 -0
- package/tools/lib/paths.mjs +41 -0
- package/tools/lib/platforms/instagram.mjs +469 -0
- package/tools/lib/platforms/tiktok.mjs +343 -0
- package/tools/lib/platforms/youtube.mjs +228 -0
- package/tools/lib/publish/publish.mjs +244 -0
- package/tools/lib/schedule/schedule.mjs +191 -0
- package/tools/lib/service.mjs +134 -0
- package/tools/lib/skill-client.mjs +126 -0
- package/tools/lib/skills-release.mjs +196 -0
- package/tools/lib/testing.mjs +52 -0
- package/tools/lib/up.mjs +187 -0
- package/tools/metrics.mjs +415 -0
- package/tools/models.mjs +134 -0
- package/tools/narrate.mjs +257 -0
- package/tools/omni.mjs +298 -0
- package/tools/omni_paths.py +12 -0
- package/tools/omnichat.mjs +1577 -0
- package/tools/omnivideo.py +1122 -0
- package/tools/package.mjs +130 -0
- package/tools/platforms.mjs +236 -0
- package/tools/premiere.mjs +533 -0
- package/tools/publish.mjs +1496 -0
- package/tools/reference.mjs +1408 -0
- package/tools/render.mjs +426 -0
- package/tools/runner.mjs +156 -0
- package/tools/setup.mjs +466 -0
- package/tools/skills-release.mjs +93 -0
- package/tools/sound.mjs +1323 -0
- package/tools/soundtrack.mjs +217 -0
- package/tools/thumbnail.mjs +271 -0
- package/tools/timing.mjs +108 -0
- package/tools/usage.py +628 -0
- package/tools/voice-envelope.mjs +185 -0
- package/tools/voice.py +448 -0
- package/tools/voice_sample.py +75 -0
- package/tools/wireframe.mjs +230 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* The waveform of the source file, with the draggable trim (green edges). */
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { loadBuffer } from "../../../../lib/sound-audio";
|
|
5
|
+
|
|
6
|
+
export function Waveform({
|
|
7
|
+
url,
|
|
8
|
+
duration,
|
|
9
|
+
trim,
|
|
10
|
+
onChange,
|
|
11
|
+
}: {
|
|
12
|
+
url: string | null;
|
|
13
|
+
duration: number;
|
|
14
|
+
trim: [number, number];
|
|
15
|
+
onChange: (t: [number, number]) => void;
|
|
16
|
+
}) {
|
|
17
|
+
const canvas = useRef<HTMLCanvasElement>(null);
|
|
18
|
+
const [peaks, setPeaks] = useState<Float32Array | null>(null);
|
|
19
|
+
const dragging = useRef<null | 0 | 1>(null);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
setPeaks(null);
|
|
22
|
+
if (!url) return;
|
|
23
|
+
let alive = true;
|
|
24
|
+
loadBuffer(url)
|
|
25
|
+
.then(b => {
|
|
26
|
+
if (!alive) return;
|
|
27
|
+
const n = 600,
|
|
28
|
+
d = b.getChannelData(0),
|
|
29
|
+
step = Math.max(1, Math.floor(d.length / n));
|
|
30
|
+
const p = new Float32Array(n);
|
|
31
|
+
for (let i = 0; i < n; i++) {
|
|
32
|
+
let m = 0;
|
|
33
|
+
for (let k = i * step; k < Math.min(d.length, (i + 1) * step); k++) m = Math.max(m, Math.abs(d[k]));
|
|
34
|
+
p[i] = m;
|
|
35
|
+
}
|
|
36
|
+
setPeaks(p);
|
|
37
|
+
})
|
|
38
|
+
.catch(() => {});
|
|
39
|
+
return () => {
|
|
40
|
+
alive = false;
|
|
41
|
+
};
|
|
42
|
+
}, [url]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const c = canvas.current;
|
|
45
|
+
if (!c) return;
|
|
46
|
+
const w = c.clientWidth,
|
|
47
|
+
h = c.clientHeight,
|
|
48
|
+
dpr = devicePixelRatio || 1;
|
|
49
|
+
c.width = w * dpr;
|
|
50
|
+
c.height = h * dpr;
|
|
51
|
+
const g = c.getContext("2d")!;
|
|
52
|
+
g.scale(dpr, dpr);
|
|
53
|
+
const css = getComputedStyle(c);
|
|
54
|
+
g.clearRect(0, 0, w, h);
|
|
55
|
+
const x0 = (trim[0] / duration) * w,
|
|
56
|
+
x1 = (trim[1] / duration) * w;
|
|
57
|
+
g.fillStyle = css.getPropertyValue("--surface-3");
|
|
58
|
+
g.fillRect(x0, 0, x1 - x0, h);
|
|
59
|
+
if (peaks) {
|
|
60
|
+
const max = Math.max(...peaks) || 1;
|
|
61
|
+
for (let i = 0; i < peaks.length; i++) {
|
|
62
|
+
const x = (i / peaks.length) * w,
|
|
63
|
+
a = (peaks[i] / max) * (h / 2 - 2);
|
|
64
|
+
g.fillStyle = x >= x0 && x <= x1 ? css.getPropertyValue("--text-2") : css.getPropertyValue("--border-strong");
|
|
65
|
+
g.fillRect(x, h / 2 - a, Math.max(1, w / peaks.length - 0.5), a * 2);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
g.fillStyle = css.getPropertyValue("--action");
|
|
69
|
+
g.fillRect(x0 - 1, 0, 2, h);
|
|
70
|
+
g.fillRect(x1 - 1, 0, 2, h);
|
|
71
|
+
}, [peaks, trim, duration]);
|
|
72
|
+
const position = (e: React.PointerEvent) => {
|
|
73
|
+
const r = canvas.current!.getBoundingClientRect();
|
|
74
|
+
return Math.min(duration, Math.max(0, ((e.clientX - r.left) / r.width) * duration));
|
|
75
|
+
};
|
|
76
|
+
return (
|
|
77
|
+
<canvas
|
|
78
|
+
ref={canvas}
|
|
79
|
+
className="sound-wave"
|
|
80
|
+
onPointerDown={e => {
|
|
81
|
+
const t = position(e);
|
|
82
|
+
dragging.current = Math.abs(t - trim[0]) < Math.abs(t - trim[1]) ? 0 : 1;
|
|
83
|
+
(e.target as HTMLElement).setPointerCapture(e.pointerId);
|
|
84
|
+
}}
|
|
85
|
+
onPointerMove={e => {
|
|
86
|
+
if (dragging.current == null) return;
|
|
87
|
+
const t = +position(e).toFixed(3);
|
|
88
|
+
const n: [number, number] = [...trim];
|
|
89
|
+
n[dragging.current] = t;
|
|
90
|
+
if (n[1] - n[0] >= 0.02) onChange(n);
|
|
91
|
+
}}
|
|
92
|
+
onPointerUp={() => {
|
|
93
|
+
dragging.current = null;
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* The clip edits (plain functions over this render's state, no hooks): razor, move and delete
|
|
2
|
+
pieces of animation (a scene's MP4) or of voice (a line's WAV). */
|
|
3
|
+
|
|
4
|
+
import { quantizeOffset, splitClip } from "../../../../lib/sound-timeline";
|
|
5
|
+
import type { Clip, ClipKind, ClipSelection, Draft, SoundData } from "./types";
|
|
6
|
+
|
|
7
|
+
export function clipActions({
|
|
8
|
+
data,
|
|
9
|
+
draft,
|
|
10
|
+
changeDraft,
|
|
11
|
+
setClipSel,
|
|
12
|
+
}: {
|
|
13
|
+
data: SoundData | null;
|
|
14
|
+
draft: Draft | null;
|
|
15
|
+
changeDraft: (f: (r: Draft) => void) => void;
|
|
16
|
+
setClipSel: (c: ClipSelection | null) => void;
|
|
17
|
+
}) {
|
|
18
|
+
const clipsOf = (kind: ClipKind, id: string): Clip[] =>
|
|
19
|
+
(kind === "video" ? draft?.scene_clips[id] : draft?.line_clips[id]) ?? [];
|
|
20
|
+
/* where the clip's file starts in the video (without the `offset`): the scene start, or the line's */
|
|
21
|
+
const baseOf = (kind: ClipKind, id: string) =>
|
|
22
|
+
(kind === "video" ? data?.scenes.find(c => c.id === id)?.start : data?.lines.find(f => f.id === id)?.start) ?? 0;
|
|
23
|
+
/* the clip's grid: the frame in animation, 1 ms in voice */
|
|
24
|
+
const stepOf = (kind: ClipKind) => (kind === "video" ? 1 / (data?.format.fps ?? 30) : 0.001);
|
|
25
|
+
const changeClips = (kind: ClipKind, id: string, f: (cl: Clip[]) => Clip[]) =>
|
|
26
|
+
changeDraft(r => {
|
|
27
|
+
const m = kind === "video" ? r.scene_clips : r.line_clips;
|
|
28
|
+
m[id] = f(m[id] ?? []);
|
|
29
|
+
});
|
|
30
|
+
/* shifts a clip (seconds, on its grid) */
|
|
31
|
+
const moveClip = (kind: ClipKind, id: string, k: number, offset: number) => {
|
|
32
|
+
const next = quantizeOffset(offset, stepOf(kind));
|
|
33
|
+
if (next === clipsOf(kind, id)[k]?.offset) return;
|
|
34
|
+
changeClips(kind, id, cl => cl.map((c, i) => (i === k ? { ...c, offset: next } : c)));
|
|
35
|
+
};
|
|
36
|
+
const deleteClip = (kind: ClipKind, id: string, k: number) => {
|
|
37
|
+
changeClips(kind, id, cl => cl.filter((_, i) => i !== k));
|
|
38
|
+
setClipSel(null);
|
|
39
|
+
};
|
|
40
|
+
/* the razor: the clip becomes two at instant t (original time), each with the same `offset` */
|
|
41
|
+
const razorCut = (kind: ClipKind, id: string, k: number, t: number) => {
|
|
42
|
+
const c = clipsOf(kind, id)[k];
|
|
43
|
+
if (!c) return;
|
|
44
|
+
const halves = splitClip(c, t, baseOf(kind, id), stepOf(kind));
|
|
45
|
+
if (!halves) return;
|
|
46
|
+
changeClips(kind, id, cl => [...cl.slice(0, k), ...halves, ...cl.slice(k + 1)]);
|
|
47
|
+
setClipSel({ kind, id, k: k + 1 });
|
|
48
|
+
};
|
|
49
|
+
return { clipsOf, baseOf, stepOf, moveClip, deleteClip, razorCut };
|
|
50
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/* The effect edits (plain functions over this render's state, no hooks): a layer's settings, a new
|
|
2
|
+
layer with the default sound, a library sound dropped or placed on the timeline, and moving or
|
|
3
|
+
duplicating the selected effects. */
|
|
4
|
+
|
|
5
|
+
import type React from "react";
|
|
6
|
+
import type { ActionResult } from "../../../../lib/api";
|
|
7
|
+
import { toOriginal } from "../../../../../../tools/cuts.mjs";
|
|
8
|
+
import { clone, defaultSoundName, findPlanItem, nearestPlace, shiftOriginal } from "../../../../lib/sound-timeline";
|
|
9
|
+
import type { Bed, Cut, Draft, EffectInfo, Place, Plan, Selection, Sound, SoundData } from "./types";
|
|
10
|
+
|
|
11
|
+
export function effectActions({
|
|
12
|
+
data,
|
|
13
|
+
draft,
|
|
14
|
+
plan,
|
|
15
|
+
cuts,
|
|
16
|
+
zoom,
|
|
17
|
+
tracks,
|
|
18
|
+
changeDraft,
|
|
19
|
+
setSel,
|
|
20
|
+
setMulti,
|
|
21
|
+
setArmed,
|
|
22
|
+
setResponse,
|
|
23
|
+
instantOf,
|
|
24
|
+
effectOf,
|
|
25
|
+
}: {
|
|
26
|
+
data: SoundData | null;
|
|
27
|
+
draft: Draft | null;
|
|
28
|
+
plan: Plan | null;
|
|
29
|
+
cuts: Cut[];
|
|
30
|
+
zoom: number;
|
|
31
|
+
tracks: React.RefObject<HTMLDivElement | null>;
|
|
32
|
+
changeDraft: (f: (r: Draft) => void) => void;
|
|
33
|
+
setSel: (s: Selection) => void;
|
|
34
|
+
setMulti: (m: string[]) => void;
|
|
35
|
+
setArmed: (n: string | null) => void;
|
|
36
|
+
setResponse: (r: ActionResult) => void;
|
|
37
|
+
instantOf: (l: Place) => number | null;
|
|
38
|
+
effectOf: (name: string) => EffectInfo | undefined;
|
|
39
|
+
}) {
|
|
40
|
+
const changeSound = (place: number, layer: number, change: Partial<Sound> | ((s: Sound) => Sound)) =>
|
|
41
|
+
changeDraft(r => {
|
|
42
|
+
const s = r.places[place].sounds[layer];
|
|
43
|
+
r.places[place].sounds[layer] = typeof change === "function" ? change(s) : { ...s, ...change };
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const defaultSound = (type: Place["type"]): string => defaultSoundName(data?.catalog, type);
|
|
47
|
+
const addSound = (i: number) => {
|
|
48
|
+
const name = defaultSound(draft!.places[i].type);
|
|
49
|
+
if (!name) return;
|
|
50
|
+
changeDraft(r => {
|
|
51
|
+
r.places[i].sounds.push({ name });
|
|
52
|
+
});
|
|
53
|
+
setSel({ place: i, layer: draft!.places[i].sounds.length });
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/* a library sound dropped (or clicked, while armed) on the timeline: on a
|
|
57
|
+
diamond it becomes a layer of that beat; on an effect, it replaces its sound; on
|
|
58
|
+
the bed row, it becomes the bed; on empty space, it goes to the nearest beat, with
|
|
59
|
+
the `offset` that puts the peak where it was dropped */
|
|
60
|
+
const arm = (n: string | null) => {
|
|
61
|
+
setArmed(n);
|
|
62
|
+
setResponse(null);
|
|
63
|
+
};
|
|
64
|
+
const placeSound = (name: string, el: HTMLElement, clientX: number) => {
|
|
65
|
+
if (!draft || !data) return;
|
|
66
|
+
const e = effectOf(name);
|
|
67
|
+
const onBed = !!el.closest("[data-bed]");
|
|
68
|
+
if (e?.music && !onBed) {
|
|
69
|
+
setResponse({ ok: false, error: `“${name}” é trilha: solte na linha da música de fundo` });
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (onBed) {
|
|
73
|
+
changeDraft(r => {
|
|
74
|
+
r.bed = { ...(r.bed ?? {}), name } as NonNullable<Bed>;
|
|
75
|
+
});
|
|
76
|
+
setSel("bed");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const ef = el.closest<HTMLElement>("[data-layer]");
|
|
80
|
+
if (ef) {
|
|
81
|
+
const place = Number(ef.dataset.place),
|
|
82
|
+
layer = Number(ef.dataset.layer);
|
|
83
|
+
changeSound(place, layer, s => ({ ...s, name, trim: undefined }));
|
|
84
|
+
setSel({ place, layer });
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const mark = el.closest<HTMLElement>("[data-place]");
|
|
88
|
+
let place: number,
|
|
89
|
+
offset = 0;
|
|
90
|
+
if (mark) place = Number(mark.dataset.place);
|
|
91
|
+
else {
|
|
92
|
+
const tDropped = toOriginal((clientX - tracks.current!.getBoundingClientRect().left) / zoom, cuts);
|
|
93
|
+
const nearest = nearestPlace(draft.places, tDropped, instantOf);
|
|
94
|
+
if (nearest == null) return;
|
|
95
|
+
place = nearest;
|
|
96
|
+
offset = +(tDropped - instantOf(draft.places[place])!).toFixed(2);
|
|
97
|
+
}
|
|
98
|
+
const layer = draft.places[place].sounds.length;
|
|
99
|
+
changeDraft(r => {
|
|
100
|
+
r.places[place].sounds.push(offset ? { name, offset } : { name });
|
|
101
|
+
});
|
|
102
|
+
setSel({ place, layer });
|
|
103
|
+
};
|
|
104
|
+
/* the plan item of a "place:layer" key */
|
|
105
|
+
const itemOf = (k: string) => {
|
|
106
|
+
const [l, c] = k.split(":").map(Number);
|
|
107
|
+
const place = draft?.places[l];
|
|
108
|
+
return place ? findPlanItem(plan?.items ?? [], place, c) : undefined;
|
|
109
|
+
};
|
|
110
|
+
/* Shift + drag: each selected effect gets a copy, with the same settings (same
|
|
111
|
+
duration), shifted by the same amount; each copy goes to the beat nearest to
|
|
112
|
+
where it landed, with the `offset` that leaves it exactly there. The copies
|
|
113
|
+
stay selected. */
|
|
114
|
+
const duplicate = (keys: string[], dt: number) => {
|
|
115
|
+
if (!draft) return;
|
|
116
|
+
const added: { k: number; sound: Sound }[] = [];
|
|
117
|
+
for (const key of keys) {
|
|
118
|
+
const [l, c] = key.split(":").map(Number);
|
|
119
|
+
const source = draft.places[l]?.sounds[c],
|
|
120
|
+
it = itemOf(key);
|
|
121
|
+
if (!source || !it) continue;
|
|
122
|
+
const base = source.anchor === "start" ? it.start : it.peak;
|
|
123
|
+
const point = shiftOriginal(base, dt, cuts);
|
|
124
|
+
const nearest = nearestPlace(draft.places, point, instantOf);
|
|
125
|
+
if (nearest == null) continue;
|
|
126
|
+
const offset = +(point - instantOf(draft.places[nearest])!).toFixed(2);
|
|
127
|
+
const { offset: _, ...rest } = source;
|
|
128
|
+
added.push({ k: nearest, sound: offset ? { ...clone(rest), offset } : clone(rest) });
|
|
129
|
+
}
|
|
130
|
+
if (!added.length) return;
|
|
131
|
+
const sizes = draft.places.map(l => l.sounds.length);
|
|
132
|
+
const newKeys = added.map(n => `${n.k}:${sizes[n.k]++}`);
|
|
133
|
+
changeDraft(r => {
|
|
134
|
+
for (const n of added) r.places[n.k].sounds.push(n.sound);
|
|
135
|
+
});
|
|
136
|
+
setMulti(newKeys);
|
|
137
|
+
const [l, c] = newKeys.at(-1)!.split(":").map(Number);
|
|
138
|
+
setSel({ place: l, layer: c });
|
|
139
|
+
};
|
|
140
|
+
/* drag without Shift: the selected ones move together (each one's `offset`); the
|
|
141
|
+
on-screen shift is in edited time, and the `offset` in original time */
|
|
142
|
+
const move = (keys: string[], dt: number) => {
|
|
143
|
+
const shift = new Map(
|
|
144
|
+
keys.map(key => {
|
|
145
|
+
const [l, c] = key.split(":").map(Number);
|
|
146
|
+
const it = itemOf(key),
|
|
147
|
+
so = draft?.places[l]?.sounds[c];
|
|
148
|
+
const base = !it ? 0 : so?.anchor === "start" ? it.start : it.peak;
|
|
149
|
+
return [key, it ? shiftOriginal(base, dt, cuts) - base : dt];
|
|
150
|
+
}),
|
|
151
|
+
);
|
|
152
|
+
changeDraft(r => {
|
|
153
|
+
for (const key of keys) {
|
|
154
|
+
const [l, c] = key.split(":").map(Number);
|
|
155
|
+
const so = r.places[l]?.sounds[c];
|
|
156
|
+
if (so) r.places[l].sounds[c] = { ...so, offset: +((so.offset ?? 0) + shift.get(key)!).toFixed(2) };
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
return { changeSound, defaultSound, addSound, arm, placeSound, duplicate, move };
|
|
161
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/* Sound timeline: the effects of beats and transitions and the video's bed, over
|
|
2
|
+
the voice. Each change goes to the server, which plans with tools/sound.mjs
|
|
3
|
+
itself (volume relative to the voice, ducking, trim, stretch, pitch) and
|
|
4
|
+
returns the ready WAVs; the UI plays those WAVs and the voice in Web Audio, with
|
|
5
|
+
the muted export on top only for the picture. What you hear here is what
|
|
6
|
+
assemble mixes. Saving writes to scenes.json; the export changes on reassembly.
|
|
7
|
+
|
|
8
|
+
Tools: Select (V) moves the effects; Area cut (C) marks a span and removes
|
|
9
|
+
everything inside it from the export (tools/cuts.mjs). The timeline shows the
|
|
10
|
+
video already cut: what comes after moves back, and what crosses the cut
|
|
11
|
+
loses only the inside part. Cuts live in `cuts` in scenes.json, in scenes.json
|
|
12
|
+
time; the UI converts.
|
|
13
|
+
|
|
14
|
+
Animation and voice are separate tracks made of clips (tools/soundtrack.mjs):
|
|
15
|
+
Razor (B) splits an animation or a line in two at the clicked point, and each
|
|
16
|
+
piece drags (changes its `offset`) or is deleted on its own. Beat effects move
|
|
17
|
+
with the animation piece; the caption, with the voice piece. While the export
|
|
18
|
+
doesn't have that arrangement, the preview plays the scene MP4s (no captions). */
|
|
19
|
+
|
|
20
|
+
import type React from "react";
|
|
21
|
+
import { useEffect } from "react";
|
|
22
|
+
import { toEdited, toOriginal } from "../../../../../../tools/cuts.mjs";
|
|
23
|
+
import { SessionPanel } from "../../../../components/SessionPanel";
|
|
24
|
+
import type { VideoDetail } from "../../../../types/api";
|
|
25
|
+
import { EditorTabBar } from "./EditorTabBar";
|
|
26
|
+
import { captionEditor } from "../CaptionPositionEditor/captionEditor";
|
|
27
|
+
import { useCaptionPosition } from "../CaptionPositionEditor/useCaptionPosition";
|
|
28
|
+
import { CaptionsPanel } from "./CaptionsPanel";
|
|
29
|
+
import { CutsPanel } from "./CutsPanel";
|
|
30
|
+
import { PlanWarnings } from "./PlanWarnings";
|
|
31
|
+
import { PlayerResizeHandle } from "./PlayerResizeHandle";
|
|
32
|
+
import { SettingsPanel } from "./SettingsPanel";
|
|
33
|
+
import { SoundLibrary } from "./SoundLibrary";
|
|
34
|
+
import { SoundPreview } from "./SoundPreview";
|
|
35
|
+
import { TimelineDock } from "./TimelineDock";
|
|
36
|
+
import { TimelineSkeleton } from "./TimelineSkeleton";
|
|
37
|
+
import { timelineGeometry } from "./timelineGeometry";
|
|
38
|
+
import { useSoundTimeline } from "./useSoundTimeline";
|
|
39
|
+
import { useOmniHandle } from "../../../../lib/omni-ui";
|
|
40
|
+
|
|
41
|
+
export function SoundTimeline({
|
|
42
|
+
video,
|
|
43
|
+
sidebar,
|
|
44
|
+
drawerButton,
|
|
45
|
+
}: {
|
|
46
|
+
video: VideoDetail;
|
|
47
|
+
sidebar?: React.ReactNode;
|
|
48
|
+
drawerButton?: React.ReactNode;
|
|
49
|
+
}) {
|
|
50
|
+
const st = useSoundTimeline(video);
|
|
51
|
+
/* Omni drives the player and the tabs (lib/omni-ui: control_editor, add_epidemic_sound) */
|
|
52
|
+
useOmniHandle(`editor:${video.slug}`, {
|
|
53
|
+
...(st.plan
|
|
54
|
+
? {
|
|
55
|
+
play: async (at?: number) => {
|
|
56
|
+
await st.play(at ?? (st.t >= st.editedTotal - 0.05 ? 0 : st.t));
|
|
57
|
+
return { ok: true };
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
: {}),
|
|
61
|
+
pause: () => st.stop(),
|
|
62
|
+
status: () => ({ playing: st.playing, at: st.t, total: st.editedTotal }),
|
|
63
|
+
openTab: st.setTab,
|
|
64
|
+
});
|
|
65
|
+
/* the caption editor lives here, not in its tab: an unsaved change survives switching tabs. While
|
|
66
|
+
the tab is open the preview shows the captions at the playhead's instant */
|
|
67
|
+
const onCaptions = st.tab === "captions";
|
|
68
|
+
const cap = useCaptionPosition(video, onCaptions ? toOriginal(st.t, st.cuts) : null);
|
|
69
|
+
const { sel: capSel, caption: capCaption } = cap;
|
|
70
|
+
const { seek: seekTo, cuts: stCuts } = st;
|
|
71
|
+
/* choosing a caption in the list puts the playhead on it */
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!onCaptions || !capCaption) return;
|
|
74
|
+
seekTo(toEdited((capCaption.s + capCaption.e) / 2, stCuts));
|
|
75
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
76
|
+
}, [capSel, onCaptions]);
|
|
77
|
+
const { data, draft, dataError, sel, root, side, height, manualWidth, tab, armed, arm, setDraggingSound } = st;
|
|
78
|
+
|
|
79
|
+
if (dataError) return <p className="response error">{dataError}</p>;
|
|
80
|
+
if (!data || !draft) return <TimelineSkeleton />;
|
|
81
|
+
|
|
82
|
+
/* saving the caption also renders the export again, with the sound saved so far */
|
|
83
|
+
const captions = cap.data && cap.draft ? captionEditor(cap, cap.data, cap.draft, st.render) : null;
|
|
84
|
+
const geo = timelineGeometry(st, data, draft);
|
|
85
|
+
const selPlace = sel && sel !== "bed" ? draft.places[sel.place] : null;
|
|
86
|
+
|
|
87
|
+
/* vertical video: the player goes to the right column, full height, and the panels and the
|
|
88
|
+
sounds move up to where it was; in landscape, the player stays wide above the timeline */
|
|
89
|
+
const vertical = data.format.h > data.format.w;
|
|
90
|
+
/* the video takes the full height (the controls float over it); at least 400 px, so the controls fit on one line */
|
|
91
|
+
const autoWidth = height ? Math.round(Math.min(600, Math.max(400, (height * data.format.w) / data.format.h))) : 400;
|
|
92
|
+
/* the player edge drags: it grows and the left column shrinks, down to 480 px */
|
|
93
|
+
const clampWidth = (w: number) => {
|
|
94
|
+
const total = root.current?.clientWidth ?? 1200;
|
|
95
|
+
return Math.round(Math.max(300, Math.min(total - 12 - 480, w)));
|
|
96
|
+
};
|
|
97
|
+
const playerWidth = manualWidth ? clampWidth(manualWidth) : autoWidth;
|
|
98
|
+
const preview = <SoundPreview st={st} data={data} captions={captions} />;
|
|
99
|
+
const dock = <TimelineDock st={st} geo={geo} data={data} draft={draft} selPlace={selPlace} />;
|
|
100
|
+
const warnings = <PlanWarnings st={st} data={data} />;
|
|
101
|
+
const tabBar = <EditorTabBar st={st} hasScenes={!!sidebar} drawerButton={drawerButton} />;
|
|
102
|
+
const tabContent =
|
|
103
|
+
tab === "agent" ? (
|
|
104
|
+
<SessionPanel type="edit" target={video.slug} before={st.beforeAgent} chat />
|
|
105
|
+
) : tab === "settings" ? (
|
|
106
|
+
<SettingsPanel st={st} data={data} draft={draft} selPlace={selPlace} E={geo.E} fps={geo.fps} />
|
|
107
|
+
) : tab === "captions" ? (
|
|
108
|
+
<CaptionsPanel editor={captions} busy={st.rendering} />
|
|
109
|
+
) : tab === "cuts" ? (
|
|
110
|
+
<CutsPanel st={st} data={data} E={geo.E} />
|
|
111
|
+
) : tab === "scenes" && sidebar ? (
|
|
112
|
+
<section className="sound-renders">{sidebar}</section>
|
|
113
|
+
) : (
|
|
114
|
+
<SoundLibrary
|
|
115
|
+
catalog={data.catalog}
|
|
116
|
+
slug={video.slug}
|
|
117
|
+
armed={armed}
|
|
118
|
+
onArm={arm}
|
|
119
|
+
onDrag={setDraggingSound}
|
|
120
|
+
onAdd={st.reloadCatalog}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
if (vertical)
|
|
125
|
+
return (
|
|
126
|
+
<div
|
|
127
|
+
ref={root}
|
|
128
|
+
className="sound-timeline vertical"
|
|
129
|
+
style={{ ...(height ? { height } : {}), ["--player-width" as string]: `${playerWidth}px` }}
|
|
130
|
+
>
|
|
131
|
+
<div className="sound-main">
|
|
132
|
+
<div className="sound-top">
|
|
133
|
+
{warnings}
|
|
134
|
+
{tabBar}
|
|
135
|
+
<section ref={side} className="sound-side">
|
|
136
|
+
{tabContent}
|
|
137
|
+
</section>
|
|
138
|
+
</div>
|
|
139
|
+
{dock}
|
|
140
|
+
</div>
|
|
141
|
+
<aside className="sound-column-player">
|
|
142
|
+
{/* handle on the left edge: dragging changes the player width; double click returns to automatic */}
|
|
143
|
+
<PlayerResizeHandle st={st} playerWidth={playerWidth} clampWidth={clampWidth} />
|
|
144
|
+
{preview}
|
|
145
|
+
</aside>
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
return (
|
|
149
|
+
<div ref={root} className="sound-timeline" style={height ? { height } : undefined}>
|
|
150
|
+
<div className="sound-main">
|
|
151
|
+
{preview}
|
|
152
|
+
{dock}
|
|
153
|
+
</div>
|
|
154
|
+
<aside ref={side} className="sound-side">
|
|
155
|
+
{warnings}
|
|
156
|
+
{tabBar}
|
|
157
|
+
{tabContent}
|
|
158
|
+
</aside>
|
|
159
|
+
</div>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* The timeline's geometry for one render: seconds ↔ px at the current zoom, original ↔ edited
|
|
2
|
+
time, and the pointer snapped (area cut, razor) or the clip edges a drag snaps to. */
|
|
3
|
+
|
|
4
|
+
import type React from "react";
|
|
5
|
+
import { clipEdgesOf, snapPointer, snapRazor, timelineScale } from "../../../../lib/sound-timeline";
|
|
6
|
+
import type { SoundTimelineState } from "./useSoundTimeline";
|
|
7
|
+
import type { ClipKind, Draft, SoundData } from "./types";
|
|
8
|
+
|
|
9
|
+
export function timelineGeometry(st: SoundTimelineState, data: SoundData, draft: Draft) {
|
|
10
|
+
const { zoom, cuts, tracks, editedTotal, t, animScenes } = st;
|
|
11
|
+
const width = Math.max(600, editedTotal * zoom);
|
|
12
|
+
/* original time → edited (the timeline's), and the box of an original span; empty if it fell in a cut */
|
|
13
|
+
const { x, E, boxOf } = timelineScale(zoom, cuts);
|
|
14
|
+
const fps = data.format.fps;
|
|
15
|
+
/* the pointer on the timeline, in edited time; snapping to the edges of lines, scenes and the
|
|
16
|
+
playhead (Alt releases the snap), aligned to the frame */
|
|
17
|
+
const pointerTime = (e: React.PointerEvent) =>
|
|
18
|
+
snapPointer((e.clientX - tracks.current!.getBoundingClientRect().left) / zoom, {
|
|
19
|
+
alt: e.altKey,
|
|
20
|
+
zoom,
|
|
21
|
+
fps,
|
|
22
|
+
total: editedTotal,
|
|
23
|
+
targets: [
|
|
24
|
+
0,
|
|
25
|
+
editedTotal,
|
|
26
|
+
t,
|
|
27
|
+
...data.lines.flatMap(f => [E(f.start), E(f.end)]),
|
|
28
|
+
...data.scenes.map(c => E(c.start)),
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
/* the razor: the pointer in edited time, snapping only to the playhead (Alt releases), on the frame */
|
|
32
|
+
const razorTime = (e: React.PointerEvent) =>
|
|
33
|
+
snapRazor((e.clientX - tracks.current!.getBoundingClientRect().left) / zoom, {
|
|
34
|
+
alt: e.altKey,
|
|
35
|
+
zoom,
|
|
36
|
+
fps,
|
|
37
|
+
total: editedTotal,
|
|
38
|
+
t,
|
|
39
|
+
});
|
|
40
|
+
/* the edges of all clips (edited time), for the drag snap; without the clip itself */
|
|
41
|
+
const clipEdges = (kind: ClipKind, id: string, k: number) =>
|
|
42
|
+
clipEdgesOf(kind, id, k, { scenes: animScenes, lines: data.lines, lineClips: draft.line_clips, E });
|
|
43
|
+
return { width, x, E, boxOf, fps, pointerTime, razorTime, clipEdges };
|
|
44
|
+
}
|
|
45
|
+
export type TimelineGeometry = ReturnType<typeof timelineGeometry>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* SoundTimeline's types: the API's (shared/types/api.ts) under the short names the editor uses,
|
|
2
|
+
and the editor's own UI state. */
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
SoundBed,
|
|
6
|
+
SoundBedItem,
|
|
7
|
+
SoundCatalog,
|
|
8
|
+
SoundClip,
|
|
9
|
+
SoundCut,
|
|
10
|
+
SoundData,
|
|
11
|
+
SoundDraft,
|
|
12
|
+
SoundDraftPlan,
|
|
13
|
+
SoundEffectInfo,
|
|
14
|
+
SoundLayer,
|
|
15
|
+
SoundPlace,
|
|
16
|
+
SoundPlanItem,
|
|
17
|
+
} from "../../../../types/api";
|
|
18
|
+
|
|
19
|
+
export type { SoundCatalog, SoundData };
|
|
20
|
+
export type Sound = SoundLayer;
|
|
21
|
+
export type Place = SoundPlace;
|
|
22
|
+
export type Bed = SoundBed;
|
|
23
|
+
export type Cut = SoundCut;
|
|
24
|
+
export type EffectInfo = SoundEffectInfo;
|
|
25
|
+
export type Clip = SoundClip;
|
|
26
|
+
export type PlanItem = SoundPlanItem;
|
|
27
|
+
export type BedItem = SoundBedItem;
|
|
28
|
+
export type Plan = SoundDraftPlan;
|
|
29
|
+
export type Draft = SoundDraft;
|
|
30
|
+
|
|
31
|
+
export type EditorTab = "agent" | "settings" | "sounds" | "cuts" | "captions" | "scenes";
|
|
32
|
+
export type AudioRow = "voice" | "effects" | "bed";
|
|
33
|
+
export type EditorTool = "select" | "razor" | "cut";
|
|
34
|
+
export type ClipKind = "video" | "voice";
|
|
35
|
+
export type ClipSelection = { kind: ClipKind; id: string; k: number };
|
|
36
|
+
export type Selection = { place: number; layer: number } | "bed" | null;
|
|
37
|
+
/* a clip being dragged: its offset while the pointer moves */
|
|
38
|
+
export type ClipDragOffset = { kind: ClipKind; id: string; k: number; offset: number };
|
|
39
|
+
/* effects being dragged ("place:layer" keys), the shift in px and whether it copies (Shift) */
|
|
40
|
+
export type EffectDragOffset = { keys: string[]; dx: number; copy: boolean };
|
|
41
|
+
/* a scene with the draft's clips (the animation track) */
|
|
42
|
+
export type AnimScene = SoundData["scenes"][number];
|
|
43
|
+
export type SoundLine = SoundData["lines"][number];
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* Autosave and render: 5 s after the last edit, the draft goes to scenes.json. Saving doesn't
|
|
2
|
+
render: the export only changes with the Renderizar button, which lights up when there is a
|
|
3
|
+
saved edit it doesn't have yet. Before the edit chat runs, the hand edits are saved; leaving the
|
|
4
|
+
screen with an edit waiting saves it on the way out; the new export arriving reloads the data. */
|
|
5
|
+
|
|
6
|
+
import { type RefObject, useCallback, useEffect, useRef } from "react";
|
|
7
|
+
import type { ActionResult } from "../../../../lib/api";
|
|
8
|
+
import { soundRoutes } from "../../../../hooks/useSound";
|
|
9
|
+
import type { Draft } from "./types";
|
|
10
|
+
|
|
11
|
+
export function useAutosave({
|
|
12
|
+
slug,
|
|
13
|
+
draft,
|
|
14
|
+
dirty,
|
|
15
|
+
planError,
|
|
16
|
+
agentEditing,
|
|
17
|
+
agentEditingRef,
|
|
18
|
+
assembledAt,
|
|
19
|
+
loadData,
|
|
20
|
+
setSaving,
|
|
21
|
+
setResponse,
|
|
22
|
+
setDirty,
|
|
23
|
+
setSavedAt,
|
|
24
|
+
setPending,
|
|
25
|
+
setRendering,
|
|
26
|
+
}: {
|
|
27
|
+
slug: string;
|
|
28
|
+
draft: Draft | null;
|
|
29
|
+
dirty: boolean;
|
|
30
|
+
planError: string | null;
|
|
31
|
+
agentEditing: boolean;
|
|
32
|
+
agentEditingRef: RefObject<boolean>;
|
|
33
|
+
assembledAt: unknown;
|
|
34
|
+
loadData: () => void;
|
|
35
|
+
setSaving: (s: boolean) => void;
|
|
36
|
+
setResponse: (r: ActionResult) => void;
|
|
37
|
+
setDirty: (d: boolean) => void;
|
|
38
|
+
setSavedAt: (d: Date) => void;
|
|
39
|
+
setPending: (p: boolean) => void;
|
|
40
|
+
setRendering: (r: boolean) => void;
|
|
41
|
+
}) {
|
|
42
|
+
/* autosave: 5 s after the last edit, the draft goes to scenes.json. Saving
|
|
43
|
+
doesn't render: the export only changes with the Renderizar button, which
|
|
44
|
+
lights up when there is a saved edit it doesn't have yet */
|
|
45
|
+
const draftRef = useRef<Draft | null>(null);
|
|
46
|
+
draftRef.current = draft;
|
|
47
|
+
const dirtyRef = useRef(false);
|
|
48
|
+
dirtyRef.current = dirty;
|
|
49
|
+
const save = useCallback(async () => {
|
|
50
|
+
const r0 = draftRef.current;
|
|
51
|
+
if (!r0) return false;
|
|
52
|
+
setSaving(true);
|
|
53
|
+
const r = await soundRoutes(slug).save(r0);
|
|
54
|
+
setSaving(false);
|
|
55
|
+
if (!r.ok) {
|
|
56
|
+
setResponse(r);
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
/* only clears if nothing changed while saving; otherwise the next debounce saves the rest */
|
|
60
|
+
if (draftRef.current === r0) setDirty(false);
|
|
61
|
+
setSavedAt(new Date());
|
|
62
|
+
setPending(true);
|
|
63
|
+
return true;
|
|
64
|
+
}, [slug]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!dirty || planError || agentEditing) return;
|
|
67
|
+
const id = setTimeout(() => {
|
|
68
|
+
save();
|
|
69
|
+
}, 5000);
|
|
70
|
+
return () => clearTimeout(id);
|
|
71
|
+
}, [draft, dirty, planError, save, agentEditing]);
|
|
72
|
+
/* before sending a request to the edit chat: what was changed by hand goes to scenes.json */
|
|
73
|
+
const beforeAgent = useCallback(async () => (dirtyRef.current ? await save() : true), [save]);
|
|
74
|
+
/* left the screen with an edit waiting for the debounce: save on the way out
|
|
75
|
+
(raw fetch: keepalive, so the request survives the page going away) */
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const leave = () => {
|
|
78
|
+
if (!dirtyRef.current || !draftRef.current || agentEditingRef.current) return;
|
|
79
|
+
soundRoutes(slug).save(draftRef.current, true);
|
|
80
|
+
};
|
|
81
|
+
addEventListener("pagehide", leave);
|
|
82
|
+
return () => {
|
|
83
|
+
removeEventListener("pagehide", leave);
|
|
84
|
+
leave();
|
|
85
|
+
};
|
|
86
|
+
}, [slug]);
|
|
87
|
+
|
|
88
|
+
const render = async () => {
|
|
89
|
+
if (dirty && !(await save())) return;
|
|
90
|
+
const r = await soundRoutes(slug).reassemble();
|
|
91
|
+
setResponse(r.ok ? { ok: true, output: "Renderizando o export com o som novo (acompanhe na fila)" } : r);
|
|
92
|
+
if (r.ok) {
|
|
93
|
+
setPending(false);
|
|
94
|
+
setRendering(true);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
/* the new export arrived (assembly.json changed): the preview picture becomes it */
|
|
98
|
+
const assembledBefore = useRef(assembledAt);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (assembledAt === assembledBefore.current) return;
|
|
101
|
+
assembledBefore.current = assembledAt;
|
|
102
|
+
setRendering(false);
|
|
103
|
+
if (!dirtyRef.current) loadData();
|
|
104
|
+
}, [assembledAt, loadData]);
|
|
105
|
+
|
|
106
|
+
return { draftRef, beforeAgent, render };
|
|
107
|
+
}
|