@remotion/studio 4.0.521 → 4.0.523
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/install-package.js +4 -2
- package/dist/components/AssetAudioVolume.d.ts +5 -0
- package/dist/components/AssetAudioVolume.js +33 -0
- package/dist/components/Canvas.js +5 -6
- package/dist/components/CanvasIfSizeIsAvailable.js +7 -0
- package/dist/components/CaptionInspector.js +74 -20
- package/dist/components/CheckboardToggle.js +8 -6
- package/dist/components/Checkbox.d.ts +1 -0
- package/dist/components/Checkbox.js +2 -2
- package/dist/components/CompositionContextButton.js +4 -1
- package/dist/components/CompositionSelectorItem.js +2 -2
- package/dist/components/ConfigureLicenseModal.js +1 -1
- package/dist/components/CopyButton.js +7 -14
- package/dist/components/CurrentAsset.js +40 -6
- package/dist/components/Editor.js +6 -5
- package/dist/components/EditorContent.js +1 -1
- package/dist/components/EditorContexts.js +3 -1
- package/dist/components/ElementInstallConfirmation.js +290 -136
- package/dist/components/FixComputedValueModal.js +56 -16
- package/dist/components/FullscreenToggle.js +9 -8
- package/dist/components/GlobalKeybindings.js +50 -49
- package/dist/components/HighlightedElementSource.d.ts +5 -0
- package/dist/components/HighlightedElementSource.js +78 -0
- package/dist/components/InspectorLocationCopy.js +10 -5
- package/dist/components/InspectorPanel/MultiSequenceField.d.ts +12 -0
- package/dist/components/InspectorPanel/MultiSequenceField.js +131 -0
- package/dist/components/InspectorPanel/MultiSequenceInspector.d.ts +8 -0
- package/dist/components/InspectorPanel/MultiSequenceInspector.js +102 -0
- package/dist/components/InspectorPanel/MultiSequenceNumberField.d.ts +9 -0
- package/dist/components/InspectorPanel/MultiSequenceNumberField.js +88 -0
- package/dist/components/InspectorPanel.js +4 -0
- package/dist/components/InspectorSequenceSection.js +64 -1
- package/dist/components/InstallPackage.js +4 -5
- package/dist/components/KeyboardShortcutsSettings.js +212 -33
- package/dist/components/MenuBuildIndicator.js +7 -2
- package/dist/components/MenuCompositionName.js +62 -6
- package/dist/components/MenuToolbar.js +7 -5
- package/dist/components/ModalContainer.d.ts +1 -0
- package/dist/components/ModalContainer.js +2 -2
- package/dist/components/Modals.js +3 -1
- package/dist/components/ModelManager.d.ts +16 -0
- package/dist/components/ModelManager.js +200 -0
- package/dist/components/ModelsSettings.d.ts +2 -0
- package/dist/components/ModelsSettings.js +133 -0
- package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
- package/dist/components/NewComposition/DismissableModal.js +2 -2
- package/dist/components/NewComposition/InputDragger.d.ts +2 -2
- package/dist/components/NewComposition/InputDragger.js +6 -6
- package/dist/components/NewComposition/NewFolder.js +11 -8
- package/dist/components/NewComposition/RenameFolder.js +17 -10
- package/dist/components/OptionalPackageModal.d.ts +11 -0
- package/dist/components/OptionalPackageModal.js +155 -0
- package/dist/components/PlayPause.js +4 -8
- package/dist/components/PlaybackKeyboardShortcutsManager.js +3 -6
- package/dist/components/PreviewToolbarOverflowButton.js +11 -2
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +5 -2
- package/dist/components/RadioButton.d.ts +1 -0
- package/dist/components/RadioButton.js +2 -2
- package/dist/components/RenderButton.js +5 -1
- package/dist/components/RenderModal/CliCopyButton.js +13 -27
- package/dist/components/RenderModal/NumberSetting.d.ts +6 -1
- package/dist/components/RenderModal/NumberSetting.js +2 -2
- package/dist/components/RenderModal/RenderModalBasic.js +1 -1
- package/dist/components/RenderModal/RenderModalOutputName.d.ts +3 -1
- package/dist/components/RenderModal/RenderModalOutputName.js +4 -4
- package/dist/components/RenderModal/SeparateAudioOption.js +1 -1
- package/dist/components/RenderModal/WebRenderModalBasic.js +1 -1
- package/dist/components/RenderQueue/CaptionQueueItem.d.ts +6 -0
- package/dist/components/RenderQueue/CaptionQueueItem.js +129 -0
- package/dist/components/RenderQueue/CaptionQueueProcessor.d.ts +1 -0
- package/dist/components/RenderQueue/CaptionQueueProcessor.js +110 -0
- package/dist/components/RenderQueue/CaptionQueueProcessorLoader.d.ts +2 -0
- package/dist/components/RenderQueue/CaptionQueueProcessorLoader.js +54 -0
- package/dist/components/RenderQueue/RenderQueueCopyToClipboard.js +7 -4
- package/dist/components/RenderQueue/RenderQueueItem.js +3 -3
- package/dist/components/RenderQueue/VideoMattingQueueItem.d.ts +6 -0
- package/dist/components/RenderQueue/VideoMattingQueueItem.js +129 -0
- package/dist/components/RenderQueue/VideoMattingQueueProcessor.d.ts +1 -0
- package/dist/components/RenderQueue/VideoMattingQueueProcessor.js +105 -0
- package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.d.ts +2 -0
- package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.js +54 -0
- package/dist/components/RenderQueue/caption-job-types.d.ts +47 -0
- package/dist/components/RenderQueue/caption-job-types.js +7 -0
- package/dist/components/RenderQueue/context.d.ts +16 -0
- package/dist/components/RenderQueue/context.js +224 -11
- package/dist/components/RenderQueue/index.js +34 -10
- package/dist/components/RenderQueue/item-style.d.ts +1 -0
- package/dist/components/RenderQueue/item-style.js +2 -1
- package/dist/components/RenderQueue/load-model-for-job.d.ts +11 -0
- package/dist/components/RenderQueue/load-model-for-job.js +14 -0
- package/dist/components/RenderQueue/video-matting-job-types.d.ts +38 -0
- package/dist/components/RenderQueue/video-matting-job-types.js +5 -0
- package/dist/components/RendersTab.js +4 -4
- package/dist/components/SegmentedControl.d.ts +2 -2
- package/dist/components/SegmentedControl.js +38 -13
- package/dist/components/SelectedOutlinePolygon.js +8 -2
- package/dist/components/SettingsButton.d.ts +4 -0
- package/dist/components/SettingsButton.js +49 -0
- package/dist/components/SettingsModal.d.ts +1 -1
- package/dist/components/SettingsModal.js +3 -1
- package/dist/components/ShowOutlinesProvider.js +12 -0
- package/dist/components/SidebarCollapserControls.js +21 -16
- package/dist/components/SizeSelector.js +10 -2
- package/dist/components/SkillsSettings.js +11 -8
- package/dist/components/SnappingToggle.js +5 -2
- package/dist/components/Splitter/SplitterContainer.js +63 -10
- package/dist/components/Splitter/SplitterContext.d.ts +3 -0
- package/dist/components/Splitter/SplitterContext.js +5 -1
- package/dist/components/Splitter/SplitterElement.js +11 -2
- package/dist/components/Splitter/SplitterHandle.d.ts +1 -0
- package/dist/components/Splitter/SplitterHandle.js +55 -25
- package/dist/components/Tabs/vertical.d.ts +1 -0
- package/dist/components/Tabs/vertical.js +2 -2
- package/dist/components/TimeValue.js +2 -3
- package/dist/components/Timeline/SequencePropsObserver.js +4 -0
- package/dist/components/Timeline/SubscribeToNodePaths.d.ts +2 -1
- package/dist/components/Timeline/SubscribeToNodePaths.js +2 -1
- package/dist/components/Timeline/Timeline.js +17 -46
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +2 -4
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +3 -18
- package/dist/components/Timeline/TimelineDragHandler.js +11 -6
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
- package/dist/components/Timeline/TimelinePinchZoom.js +6 -30
- package/dist/components/Timeline/TimelinePlayCursorSyncer.js +1 -7
- package/dist/components/Timeline/TimelineRowChrome.js +11 -3
- package/dist/components/Timeline/TimelineSchemaField.js +8 -4
- package/dist/components/Timeline/TimelineSelection.d.ts +2 -0
- package/dist/components/Timeline/TimelineSelection.js +55 -2
- package/dist/components/Timeline/TimelineSequence.js +148 -25
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +0 -1
- package/dist/components/Timeline/TimelineSequenceItem.js +220 -112
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +35 -5
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +233 -138
- package/dist/components/Timeline/TimelineSlider.js +1 -4
- package/dist/components/Timeline/TimelineTimeIndicators.js +1 -0
- package/dist/components/Timeline/TimelineWidthProvider.js +2 -5
- package/dist/components/Timeline/TimelineZoomControls.js +20 -20
- package/dist/components/Timeline/get-sequence-split-menu-item.d.ts +11 -0
- package/dist/components/Timeline/get-sequence-split-menu-item.js +55 -0
- package/dist/components/Timeline/use-asset-timeline-context-menu.d.ts +2 -0
- package/dist/components/Timeline/use-asset-timeline-context-menu.js +52 -0
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +3 -2
- package/dist/components/Timeline/use-sequence-props-subscription.js +4 -10
- package/dist/components/TimelineInOutToggle.js +20 -17
- package/dist/components/TopPanel.js +3 -19
- package/dist/components/Transcription/LazyModels.d.ts +1 -0
- package/dist/components/Transcription/LazyModels.js +5 -0
- package/dist/components/Transcription/Models.d.ts +6 -0
- package/dist/components/Transcription/Models.js +18 -0
- package/dist/components/Transcription/TranscriptionModal.d.ts +3 -0
- package/dist/components/Transcription/TranscriptionModal.js +428 -0
- package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.d.ts +5 -0
- package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.js +48 -0
- package/dist/components/Transcription/caption-output-name.d.ts +2 -0
- package/dist/components/Transcription/caption-output-name.js +10 -0
- package/dist/components/Transcription/resample-media-to-16-khz.d.ts +6 -0
- package/dist/components/Transcription/resample-media-to-16-khz.js +82 -0
- package/dist/components/Transcription/whisper-languages.d.ts +2 -0
- package/dist/components/Transcription/whisper-languages.js +104 -0
- package/dist/components/Transcription/whisper-webgpu-capability.d.ts +2 -0
- package/dist/components/Transcription/whisper-webgpu-capability.js +7 -0
- package/dist/components/UndoRedoButtons.js +13 -38
- package/dist/components/UpdatesSettings.js +17 -17
- package/dist/components/VideoMatting/LazyModels.d.ts +1 -0
- package/dist/components/VideoMatting/LazyModels.js +5 -0
- package/dist/components/VideoMatting/Models.d.ts +6 -0
- package/dist/components/VideoMatting/Models.js +18 -0
- package/dist/components/VideoMatting/VideoMattingModal.d.ts +3 -0
- package/dist/components/VideoMatting/VideoMattingModal.js +207 -0
- package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.d.ts +5 -0
- package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.js +46 -0
- package/dist/components/VideoMatting/video-matting-capability.d.ts +2 -0
- package/dist/components/VideoMatting/video-matting-capability.js +7 -0
- package/dist/components/WebMcp.js +439 -22
- package/dist/components/ZoomPersistor.js +6 -3
- package/dist/components/composition-menu-items.js +1 -1
- package/dist/components/import-assets.d.ts +3 -2
- package/dist/components/import-assets.js +5 -9
- package/dist/components/keyboard-shortcuts.d.ts +17 -1
- package/dist/components/keyboard-shortcuts.js +177 -89
- package/dist/components/public-output-name.d.ts +5 -0
- package/dist/components/public-output-name.js +60 -0
- package/dist/components/use-model-cache-status.d.ts +7 -0
- package/dist/components/use-model-cache-status.js +35 -0
- package/dist/esm/CaptionQueueProcessor-k0yrm3dj.mjs +211 -0
- package/dist/esm/HighlightedElementSource-jfc66k4p.mjs +1236 -0
- package/dist/esm/LazyModels-2trdm224.mjs +11 -0
- package/dist/esm/LazyModels-fjb5ckaq.mjs +11 -0
- package/dist/esm/TranscriptionModal-916jqhry.mjs +1011 -0
- package/dist/esm/VideoMattingModal-2tm79s9b.mjs +374 -0
- package/dist/esm/VideoMattingQueueProcessor-t1hgm2rm.mjs +109 -0
- package/dist/esm/index-1x7bsdh6.mjs +261 -0
- package/dist/esm/index-3hgr6gjx.mjs +41 -0
- package/dist/esm/index-5qddp5h7.mjs +36 -0
- package/dist/esm/index-5zrb1ft4.mjs +39 -0
- package/dist/esm/index-6cvm9a65.mjs +45923 -0
- package/dist/esm/index-7tt71e8n.mjs +36 -0
- package/dist/esm/index-9x6e1dq0.mjs +428 -0
- package/dist/esm/index-cw0pnpg5.mjs +50 -0
- package/dist/esm/index-czwvnn9g.mjs +35 -0
- package/dist/esm/index-hy4xcgty.mjs +1366 -0
- package/dist/esm/{chunk-je0h1bgt.js → index-jg13hf2g.mjs} +3 -1
- package/dist/esm/{chunk-6jf1natv.js → index-rcv7qkt5.mjs} +18 -1
- package/dist/esm/index-sgtmgc4h.mjs +423 -0
- package/dist/esm/index-te66vvrp.mjs +142 -0
- package/dist/esm/index-v4tr1bft.mjs +20 -0
- package/dist/esm/index-x7t2y7ws.mjs +54194 -0
- package/dist/esm/index-xhe2m2qr.mjs +1146 -0
- package/dist/esm/index.mjs +45 -933
- package/dist/esm/internals.mjs +13 -114127
- package/dist/esm/previewEntry.mjs +387 -114784
- package/dist/esm/renderEntry.mjs +3 -3
- package/dist/esm/{chunk-m0jqdbkr.js → resolve-composition-component-location-14148845.mjs} +1 -1
- package/dist/helpers/copy-text.js +1 -2
- package/dist/helpers/drag-aware-double-click.d.ts +2 -1
- package/dist/helpers/drag-aware-double-click.js +12 -1
- package/dist/helpers/get-asset-metadata.d.ts +1 -0
- package/dist/helpers/get-asset-metadata.js +4 -0
- package/dist/helpers/hoverable.js +8 -0
- package/dist/helpers/inject-css.js +2 -0
- package/dist/helpers/optional-package-dependencies.d.ts +3 -0
- package/dist/helpers/optional-package-dependencies.js +24 -0
- package/dist/helpers/pointer-session.d.ts +6 -0
- package/dist/helpers/pointer-session.js +36 -14
- package/dist/helpers/prism-tomorrow.d.ts +1 -0
- package/dist/helpers/prism-tomorrow.js +151 -0
- package/dist/helpers/sequence-node-path-mutations.js +11 -0
- package/dist/helpers/slugify-name.d.ts +1 -0
- package/dist/helpers/slugify-name.js +14 -0
- package/dist/helpers/studio-runtime-config.d.ts +1 -0
- package/dist/helpers/studio-runtime-config.js +6 -1
- package/dist/helpers/use-copy-feedback.d.ts +4 -0
- package/dist/helpers/use-copy-feedback.js +19 -0
- package/dist/helpers/use-keybinding.d.ts +9 -3
- package/dist/helpers/use-keybinding.js +8 -9
- package/dist/helpers/use-keyboard-shortcut-label.d.ts +2 -0
- package/dist/helpers/use-keyboard-shortcut-label.js +15 -0
- package/dist/helpers/use-menu-structure.js +58 -13
- package/dist/icons/copy.d.ts +5 -0
- package/dist/icons/copy.js +12 -0
- package/dist/icons/input-props.d.ts +1 -1
- package/dist/icons/input-props.js +2 -2
- package/dist/icons/models.d.ts +4 -0
- package/dist/icons/models.js +7 -0
- package/dist/icons/separation.d.ts +4 -0
- package/dist/icons/separation.js +7 -0
- package/dist/icons/transcription.d.ts +4 -0
- package/dist/icons/transcription.js +7 -0
- package/dist/icons/upload.js +1 -1
- package/dist/state/canvas-ref.d.ts +1 -0
- package/dist/state/canvas-ref.js +2 -1
- package/dist/state/modals.d.ts +14 -2
- package/dist/state/sidebar.d.ts +3 -0
- package/dist/state/sidebar.js +6 -1
- package/dist/state/timeline-zoom.d.ts +1 -1
- package/dist/state/timeline-zoom.js +3 -3
- package/dist/visual-controls/VisualControls.js +4 -0
- package/package.json +34 -20
- package/dist/components/UpdateCheck.d.ts +0 -1
- package/dist/components/UpdateCheck.js +0 -79
- package/dist/esm/chunk-emw4k5b0.js +0 -99527
- package/dist/esm/chunk-vkrvnx2h.js +0 -99378
- package/dist/helpers/use-max-media-duration.d.ts +0 -2
- package/dist/helpers/use-max-media-duration.js +0 -61
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.VideoMattingQueueProcessorLoader = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const OptionalPackageModal_1 = require("../OptionalPackageModal");
|
|
40
|
+
const video_matting_capability_1 = require("../VideoMatting/video-matting-capability");
|
|
41
|
+
const context_1 = require("./context");
|
|
42
|
+
const LazyProcessor = react_1.default.lazy(async () => {
|
|
43
|
+
const { VideoMattingQueueProcessor } = await Promise.resolve().then(() => __importStar(require('./VideoMattingQueueProcessor')));
|
|
44
|
+
return { default: VideoMattingQueueProcessor };
|
|
45
|
+
});
|
|
46
|
+
const VideoMattingQueueProcessorLoader = () => {
|
|
47
|
+
const installed = (0, OptionalPackageModal_1.useOptionalPackageInstalled)(video_matting_capability_1.VIDEO_MATTING_PACKAGE);
|
|
48
|
+
const { videoMattingJobs } = (0, react_1.useContext)(context_1.RenderQueueContext);
|
|
49
|
+
if (!installed || videoMattingJobs.length === 0) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return (jsx_runtime_1.jsx(react_1.Suspense, { fallback: null, children: jsx_runtime_1.jsx(LazyProcessor, {}) }));
|
|
53
|
+
};
|
|
54
|
+
exports.VideoMattingQueueProcessorLoader = VideoMattingQueueProcessorLoader;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { WhisperWebGpuModel, WhisperWebGpuTask } from '@remotion/whisper-webgpu';
|
|
2
|
+
export type CaptionJobProgress = {
|
|
3
|
+
message: string;
|
|
4
|
+
value: number;
|
|
5
|
+
};
|
|
6
|
+
type CaptionJobStatus = {
|
|
7
|
+
status: 'idle';
|
|
8
|
+
} | {
|
|
9
|
+
status: 'running';
|
|
10
|
+
progress: CaptionJobProgress;
|
|
11
|
+
} | {
|
|
12
|
+
status: 'done';
|
|
13
|
+
captionCount: number;
|
|
14
|
+
} | {
|
|
15
|
+
status: 'failed';
|
|
16
|
+
error: {
|
|
17
|
+
message: string;
|
|
18
|
+
stack: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type AddCaptionJobParams = {
|
|
22
|
+
src: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
audioStreamIndex: number | null;
|
|
25
|
+
requestInit: Omit<RequestInit, 'signal'> | null;
|
|
26
|
+
outName: string;
|
|
27
|
+
model: WhisperWebGpuModel;
|
|
28
|
+
language: string | null;
|
|
29
|
+
task: WhisperWebGpuTask;
|
|
30
|
+
chunkLengthInSeconds: number;
|
|
31
|
+
strideLengthInSeconds: number;
|
|
32
|
+
forceFullSequences: boolean;
|
|
33
|
+
doSample: boolean;
|
|
34
|
+
temperature: number;
|
|
35
|
+
topK: number;
|
|
36
|
+
repetitionPenalty: number;
|
|
37
|
+
noRepeatNgramSize: number;
|
|
38
|
+
};
|
|
39
|
+
export type CaptionJob = AddCaptionJobParams & {
|
|
40
|
+
id: string;
|
|
41
|
+
type: 'caption';
|
|
42
|
+
startedAt: number;
|
|
43
|
+
} & CaptionJobStatus;
|
|
44
|
+
export declare const isCaptionJob: (job: {
|
|
45
|
+
type: string;
|
|
46
|
+
}) => job is CaptionJob;
|
|
47
|
+
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { CompletedClientRender, RenderJob } from '@remotion/studio-shared';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import type { AddCaptionJobParams, CaptionJob, CaptionJobProgress } from './caption-job-types';
|
|
3
4
|
import { type AddClientStillJobParams, type AddClientVideoJobParams, type CompositionRef } from './client-render-queue';
|
|
4
5
|
import type { ClientRenderJob, ClientRenderJobProgress, GetBlobCallback } from './client-side-render-types';
|
|
6
|
+
import type { AddVideoMattingJobParams, VideoMattingJob, VideoMattingJobProgress } from './video-matting-job-types';
|
|
5
7
|
declare global {
|
|
6
8
|
interface Window {
|
|
7
9
|
remotion_initialRenderQueue: RenderJob[] | null;
|
|
@@ -14,6 +16,8 @@ type RenderQueueContextType = {
|
|
|
14
16
|
jobs: AnyRenderJob[];
|
|
15
17
|
serverJobs: RenderJob[];
|
|
16
18
|
clientJobs: ClientRenderJob[];
|
|
19
|
+
captionJobs: CaptionJob[];
|
|
20
|
+
videoMattingJobs: VideoMattingJob[];
|
|
17
21
|
addClientStillJob: (params: AddClientStillJobParams, compositionRef: CompositionRef) => string;
|
|
18
22
|
addClientVideoJob: (params: AddClientVideoJobParams, compositionRef: CompositionRef) => string;
|
|
19
23
|
updateClientJobProgress: (jobId: string, progress: ClientRenderJobProgress) => void;
|
|
@@ -24,6 +28,18 @@ type RenderQueueContextType = {
|
|
|
24
28
|
removeClientJob: (jobId: string) => void;
|
|
25
29
|
cancelClientJob: (jobId: string) => void;
|
|
26
30
|
setProcessJobCallback: (callback: ((job: ClientRenderJob) => Promise<void>) | null) => void;
|
|
31
|
+
addCaptionJob: (params: AddCaptionJobParams) => string;
|
|
32
|
+
updateCaptionJobProgress: (jobId: string, progress: CaptionJobProgress) => void;
|
|
33
|
+
markCaptionJobDone: (jobId: string, captionCount: number) => void;
|
|
34
|
+
markCaptionJobFailed: (jobId: string, error: Error) => void;
|
|
35
|
+
removeCaptionJob: (jobId: string) => void;
|
|
36
|
+
setProcessCaptionJobCallback: (callback: ((job: CaptionJob) => Promise<void>) | null) => void;
|
|
37
|
+
addVideoMattingJob: (params: AddVideoMattingJobParams) => string;
|
|
38
|
+
updateVideoMattingJobProgress: (jobId: string, progress: VideoMattingJobProgress) => void;
|
|
39
|
+
markVideoMattingJobDone: (jobId: string) => void;
|
|
40
|
+
markVideoMattingJobFailed: (jobId: string, error: Error) => void;
|
|
41
|
+
removeVideoMattingJob: (jobId: string) => void;
|
|
42
|
+
setProcessVideoMattingJobCallback: (callback: ((job: VideoMattingJob) => Promise<void>) | null) => void;
|
|
27
43
|
getAbortController: (jobId: string) => AbortController;
|
|
28
44
|
getCompositionForJob: (jobId: string) => CompositionRef | undefined;
|
|
29
45
|
};
|
|
@@ -52,6 +52,8 @@ exports.RenderQueueContext = react_1.default.createContext({
|
|
|
52
52
|
jobs: [],
|
|
53
53
|
serverJobs: [],
|
|
54
54
|
clientJobs: [],
|
|
55
|
+
captionJobs: [],
|
|
56
|
+
videoMattingJobs: [],
|
|
55
57
|
addClientStillJob: noopString,
|
|
56
58
|
addClientVideoJob: noopString,
|
|
57
59
|
updateClientJobProgress: noop,
|
|
@@ -62,6 +64,18 @@ exports.RenderQueueContext = react_1.default.createContext({
|
|
|
62
64
|
removeClientJob: noop,
|
|
63
65
|
cancelClientJob: noop,
|
|
64
66
|
setProcessJobCallback: noop,
|
|
67
|
+
addCaptionJob: noopString,
|
|
68
|
+
updateCaptionJobProgress: noop,
|
|
69
|
+
markCaptionJobDone: noop,
|
|
70
|
+
markCaptionJobFailed: noop,
|
|
71
|
+
removeCaptionJob: noop,
|
|
72
|
+
setProcessCaptionJobCallback: noop,
|
|
73
|
+
addVideoMattingJob: noopString,
|
|
74
|
+
updateVideoMattingJobProgress: noop,
|
|
75
|
+
markVideoMattingJobDone: noop,
|
|
76
|
+
markVideoMattingJobFailed: noop,
|
|
77
|
+
removeVideoMattingJob: noop,
|
|
78
|
+
setProcessVideoMattingJobCallback: noop,
|
|
65
79
|
getAbortController: () => new AbortController(),
|
|
66
80
|
getCompositionForJob: () => undefined,
|
|
67
81
|
});
|
|
@@ -70,15 +84,85 @@ const RenderQueueContextProvider = ({ children }) => {
|
|
|
70
84
|
var _a;
|
|
71
85
|
const [serverJobs, setServerJobs] = (0, react_1.useState)((_a = window.remotion_initialRenderQueue) !== null && _a !== void 0 ? _a : []);
|
|
72
86
|
const [clientJobs, setClientJobs] = (0, react_1.useState)(restorePersistedClientRenders);
|
|
87
|
+
const [captionJobs, setCaptionJobs] = (0, react_1.useState)([]);
|
|
88
|
+
const [videoMattingJobs, setVideoMattingJobs] = (0, react_1.useState)([]);
|
|
89
|
+
const hasActiveLocalJob = clientJobs.some((job) => job.status === 'idle' ||
|
|
90
|
+
job.status === 'running' ||
|
|
91
|
+
job.status === 'saving') ||
|
|
92
|
+
captionJobs.some((job) => job.status === 'idle' || job.status === 'running') ||
|
|
93
|
+
videoMattingJobs.some((job) => job.status === 'idle' || job.status === 'running');
|
|
73
94
|
const [currentlyProcessing, setCurrentlyProcessing] = (0, react_1.useState)(null);
|
|
95
|
+
const lastLocalJobStartedAt = (0, react_1.useRef)(clientJobs.reduce((latest, job) => Math.max(latest, job.startedAt), 0));
|
|
74
96
|
const processJobCallbackRef = (0, react_1.useRef)(null);
|
|
75
|
-
|
|
97
|
+
const processCaptionJobCallbackRef = (0, react_1.useRef)(null);
|
|
98
|
+
const processVideoMattingJobCallbackRef = (0, react_1.useRef)(null);
|
|
99
|
+
const [processorCallbacksVersion, setProcessorCallbacksVersion] = (0, react_1.useState)(0);
|
|
100
|
+
(0, react_1.useEffect)(() => {
|
|
101
|
+
if (!hasActiveLocalJob) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const preventClose = (event) => {
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
event.returnValue = '';
|
|
107
|
+
};
|
|
108
|
+
window.addEventListener('beforeunload', preventClose);
|
|
109
|
+
return () => window.removeEventListener('beforeunload', preventClose);
|
|
110
|
+
}, [hasActiveLocalJob]);
|
|
111
|
+
const getLocalJobStartedAt = (0, react_1.useCallback)(() => {
|
|
112
|
+
const startedAt = Math.max(Date.now(), lastLocalJobStartedAt.current + 1);
|
|
113
|
+
lastLocalJobStartedAt.current = startedAt;
|
|
114
|
+
return startedAt;
|
|
115
|
+
}, []);
|
|
116
|
+
// Process the next local job when state changes. Server renders have their own
|
|
117
|
+
// queue and are intentionally independent from browser-local work.
|
|
76
118
|
(0, react_1.useEffect)(() => {
|
|
77
119
|
if (currentlyProcessing) {
|
|
78
120
|
return;
|
|
79
121
|
}
|
|
80
|
-
const nextJob = clientJobs
|
|
81
|
-
|
|
122
|
+
const nextJob = [...clientJobs, ...captionJobs, ...videoMattingJobs]
|
|
123
|
+
.filter((job) => job.status === 'idle')
|
|
124
|
+
.sort((a, b) => a.startedAt - b.startedAt)[0];
|
|
125
|
+
if (!nextJob) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (nextJob.type === 'caption') {
|
|
129
|
+
if (!processCaptionJobCallbackRef.current) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
setCurrentlyProcessing(nextJob.id);
|
|
133
|
+
setCaptionJobs((prev) => prev.map((job) => job.id === nextJob.id
|
|
134
|
+
? {
|
|
135
|
+
...job,
|
|
136
|
+
status: 'running',
|
|
137
|
+
progress: {
|
|
138
|
+
message: 'Starting transcription...',
|
|
139
|
+
value: 0,
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
: job));
|
|
143
|
+
processCaptionJobCallbackRef.current(nextJob);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (nextJob.type === 'video-matting') {
|
|
147
|
+
if (!processVideoMattingJobCallbackRef.current) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
setCurrentlyProcessing(nextJob.id);
|
|
151
|
+
setVideoMattingJobs((prev) => prev.map((job) => job.id === nextJob.id
|
|
152
|
+
? {
|
|
153
|
+
...job,
|
|
154
|
+
status: 'running',
|
|
155
|
+
progress: {
|
|
156
|
+
detail: null,
|
|
157
|
+
message: 'Starting video matting...',
|
|
158
|
+
value: 0,
|
|
159
|
+
},
|
|
160
|
+
}
|
|
161
|
+
: job));
|
|
162
|
+
processVideoMattingJobCallbackRef.current(nextJob);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (!processJobCallbackRef.current) {
|
|
82
166
|
return;
|
|
83
167
|
}
|
|
84
168
|
setCurrentlyProcessing(nextJob.id);
|
|
@@ -96,31 +180,37 @@ const RenderQueueContextProvider = ({ children }) => {
|
|
|
96
180
|
}
|
|
97
181
|
: job));
|
|
98
182
|
processJobCallbackRef.current(nextJob);
|
|
99
|
-
}, [
|
|
183
|
+
}, [
|
|
184
|
+
captionJobs,
|
|
185
|
+
clientJobs,
|
|
186
|
+
currentlyProcessing,
|
|
187
|
+
processorCallbacksVersion,
|
|
188
|
+
videoMattingJobs,
|
|
189
|
+
]);
|
|
100
190
|
const addClientStillJob = (0, react_1.useCallback)((params, compositionRef) => {
|
|
101
191
|
const id = (0, client_render_queue_1.generateJobId)();
|
|
102
192
|
(0, client_render_queue_1.registerCompositionForJob)(id, compositionRef);
|
|
103
193
|
const newJob = {
|
|
104
194
|
...params,
|
|
105
195
|
id,
|
|
106
|
-
startedAt:
|
|
196
|
+
startedAt: getLocalJobStartedAt(),
|
|
107
197
|
status: 'idle',
|
|
108
198
|
};
|
|
109
199
|
setClientJobs((prev) => [...prev, newJob]);
|
|
110
200
|
return id;
|
|
111
|
-
}, []);
|
|
201
|
+
}, [getLocalJobStartedAt]);
|
|
112
202
|
const addClientVideoJob = (0, react_1.useCallback)((params, compositionRef) => {
|
|
113
203
|
const id = (0, client_render_queue_1.generateJobId)();
|
|
114
204
|
(0, client_render_queue_1.registerCompositionForJob)(id, compositionRef);
|
|
115
205
|
const newJob = {
|
|
116
206
|
...params,
|
|
117
207
|
id,
|
|
118
|
-
startedAt:
|
|
208
|
+
startedAt: getLocalJobStartedAt(),
|
|
119
209
|
status: 'idle',
|
|
120
210
|
};
|
|
121
211
|
setClientJobs((prev) => [...prev, newJob]);
|
|
122
212
|
return id;
|
|
123
|
-
}, []);
|
|
213
|
+
}, [getLocalJobStartedAt]);
|
|
124
214
|
const updateClientJobProgress = (0, react_1.useCallback)((jobId, progress) => {
|
|
125
215
|
setClientJobs((prev) => prev.map((job) => job.id === jobId
|
|
126
216
|
? { ...job, status: 'running', progress }
|
|
@@ -135,7 +225,7 @@ const RenderQueueContextProvider = ({ children }) => {
|
|
|
135
225
|
(0, client_render_queue_1.deleteAbortController)(jobId);
|
|
136
226
|
(0, client_render_queue_1.cleanupCompositionForJob)(jobId);
|
|
137
227
|
setClientJobs((prev) => prev.map((job) => job.id === jobId ? { ...job, status: 'done', metadata, getBlob } : job));
|
|
138
|
-
setCurrentlyProcessing(null);
|
|
228
|
+
setCurrentlyProcessing((current) => (current === jobId ? null : current));
|
|
139
229
|
}, []);
|
|
140
230
|
const markClientJobFailed = (0, react_1.useCallback)((jobId, error) => {
|
|
141
231
|
(0, client_render_queue_1.deleteAbortController)(jobId);
|
|
@@ -147,7 +237,7 @@ const RenderQueueContextProvider = ({ children }) => {
|
|
|
147
237
|
error: { message: error.message, stack: error.stack },
|
|
148
238
|
}
|
|
149
239
|
: job));
|
|
150
|
-
setCurrentlyProcessing(null);
|
|
240
|
+
setCurrentlyProcessing((current) => (current === jobId ? null : current));
|
|
151
241
|
}, []);
|
|
152
242
|
const markClientJobCancelled = (0, react_1.useCallback)((jobId) => {
|
|
153
243
|
(0, client_render_queue_1.deleteAbortController)(jobId);
|
|
@@ -158,7 +248,7 @@ const RenderQueueContextProvider = ({ children }) => {
|
|
|
158
248
|
status: 'cancelled',
|
|
159
249
|
}
|
|
160
250
|
: job));
|
|
161
|
-
setCurrentlyProcessing(null);
|
|
251
|
+
setCurrentlyProcessing((current) => (current === jobId ? null : current));
|
|
162
252
|
}, []);
|
|
163
253
|
const removeClientJob = (0, react_1.useCallback)((jobId) => {
|
|
164
254
|
setClientJobs((prev) => {
|
|
@@ -176,6 +266,101 @@ const RenderQueueContextProvider = ({ children }) => {
|
|
|
176
266
|
}, []);
|
|
177
267
|
const setProcessJobCallback = (0, react_1.useCallback)((callback) => {
|
|
178
268
|
processJobCallbackRef.current = callback;
|
|
269
|
+
setProcessorCallbacksVersion((version) => version + 1);
|
|
270
|
+
}, []);
|
|
271
|
+
const addCaptionJob = (0, react_1.useCallback)((params) => {
|
|
272
|
+
const id = `caption-${Date.now()}-${Math.random()
|
|
273
|
+
.toString(36)
|
|
274
|
+
.substring(2, 11)}`;
|
|
275
|
+
const newJob = {
|
|
276
|
+
...params,
|
|
277
|
+
id,
|
|
278
|
+
type: 'caption',
|
|
279
|
+
startedAt: getLocalJobStartedAt(),
|
|
280
|
+
status: 'idle',
|
|
281
|
+
};
|
|
282
|
+
setCaptionJobs((prev) => [...prev, newJob]);
|
|
283
|
+
return id;
|
|
284
|
+
}, [getLocalJobStartedAt]);
|
|
285
|
+
const updateCaptionJobProgress = (0, react_1.useCallback)((jobId, progress) => {
|
|
286
|
+
setCaptionJobs((prev) => prev.map((job) => job.id === jobId
|
|
287
|
+
? { ...job, status: 'running', progress }
|
|
288
|
+
: job));
|
|
289
|
+
}, []);
|
|
290
|
+
const markCaptionJobDone = (0, react_1.useCallback)((jobId, captionCount) => {
|
|
291
|
+
setCaptionJobs((prev) => prev.map((job) => job.id === jobId
|
|
292
|
+
? { ...job, status: 'done', captionCount }
|
|
293
|
+
: job));
|
|
294
|
+
setCurrentlyProcessing((current) => (current === jobId ? null : current));
|
|
295
|
+
}, []);
|
|
296
|
+
const markCaptionJobFailed = (0, react_1.useCallback)((jobId, error) => {
|
|
297
|
+
setCaptionJobs((prev) => prev.map((job) => job.id === jobId
|
|
298
|
+
? {
|
|
299
|
+
...job,
|
|
300
|
+
status: 'failed',
|
|
301
|
+
error: { message: error.message, stack: error.stack },
|
|
302
|
+
}
|
|
303
|
+
: job));
|
|
304
|
+
setCurrentlyProcessing((current) => (current === jobId ? null : current));
|
|
305
|
+
}, []);
|
|
306
|
+
const removeCaptionJob = (0, react_1.useCallback)((jobId) => {
|
|
307
|
+
setCaptionJobs((prev) => {
|
|
308
|
+
const jobToRemove = prev.find((job) => job.id === jobId);
|
|
309
|
+
if ((jobToRemove === null || jobToRemove === void 0 ? void 0 : jobToRemove.status) === 'running') {
|
|
310
|
+
return prev;
|
|
311
|
+
}
|
|
312
|
+
return prev.filter((job) => job.id !== jobId);
|
|
313
|
+
});
|
|
314
|
+
}, []);
|
|
315
|
+
const setProcessCaptionJobCallback = (0, react_1.useCallback)((callback) => {
|
|
316
|
+
processCaptionJobCallbackRef.current = callback;
|
|
317
|
+
setProcessorCallbacksVersion((version) => version + 1);
|
|
318
|
+
}, []);
|
|
319
|
+
const addVideoMattingJob = (0, react_1.useCallback)((params) => {
|
|
320
|
+
const id = `video-matting-${Date.now()}-${Math.random()
|
|
321
|
+
.toString(36)
|
|
322
|
+
.substring(2, 11)}`;
|
|
323
|
+
setVideoMattingJobs((prev) => [
|
|
324
|
+
...prev,
|
|
325
|
+
{
|
|
326
|
+
...params,
|
|
327
|
+
id,
|
|
328
|
+
type: 'video-matting',
|
|
329
|
+
startedAt: getLocalJobStartedAt(),
|
|
330
|
+
status: 'idle',
|
|
331
|
+
},
|
|
332
|
+
]);
|
|
333
|
+
return id;
|
|
334
|
+
}, [getLocalJobStartedAt]);
|
|
335
|
+
const updateVideoMattingJobProgress = (0, react_1.useCallback)((jobId, progress) => {
|
|
336
|
+
setVideoMattingJobs((prev) => prev.map((job) => job.id === jobId ? { ...job, status: 'running', progress } : job));
|
|
337
|
+
}, []);
|
|
338
|
+
const markVideoMattingJobDone = (0, react_1.useCallback)((jobId) => {
|
|
339
|
+
setVideoMattingJobs((prev) => prev.map((job) => (job.id === jobId ? { ...job, status: 'done' } : job)));
|
|
340
|
+
setCurrentlyProcessing((current) => (current === jobId ? null : current));
|
|
341
|
+
}, []);
|
|
342
|
+
const markVideoMattingJobFailed = (0, react_1.useCallback)((jobId, error) => {
|
|
343
|
+
setVideoMattingJobs((prev) => prev.map((job) => job.id === jobId
|
|
344
|
+
? {
|
|
345
|
+
...job,
|
|
346
|
+
status: 'failed',
|
|
347
|
+
error: { message: error.message, stack: error.stack },
|
|
348
|
+
}
|
|
349
|
+
: job));
|
|
350
|
+
setCurrentlyProcessing((current) => (current === jobId ? null : current));
|
|
351
|
+
}, []);
|
|
352
|
+
const removeVideoMattingJob = (0, react_1.useCallback)((jobId) => {
|
|
353
|
+
setVideoMattingJobs((prev) => {
|
|
354
|
+
const jobToRemove = prev.find((job) => job.id === jobId);
|
|
355
|
+
if ((jobToRemove === null || jobToRemove === void 0 ? void 0 : jobToRemove.status) === 'running') {
|
|
356
|
+
return prev;
|
|
357
|
+
}
|
|
358
|
+
return prev.filter((job) => job.id !== jobId);
|
|
359
|
+
});
|
|
360
|
+
}, []);
|
|
361
|
+
const setProcessVideoMattingJobCallback = (0, react_1.useCallback)((callback) => {
|
|
362
|
+
processVideoMattingJobCallbackRef.current = callback;
|
|
363
|
+
setProcessorCallbacksVersion((version) => version + 1);
|
|
179
364
|
}, []);
|
|
180
365
|
(0, react_1.useImperativeHandle)(exports.renderJobsRef, () => ({
|
|
181
366
|
updateRenderJobs: (newJobs) => {
|
|
@@ -207,6 +392,8 @@ const RenderQueueContextProvider = ({ children }) => {
|
|
|
207
392
|
jobs: [...serverJobs, ...clientJobs].sort((a, b) => a.startedAt - b.startedAt),
|
|
208
393
|
serverJobs,
|
|
209
394
|
clientJobs,
|
|
395
|
+
captionJobs,
|
|
396
|
+
videoMattingJobs,
|
|
210
397
|
addClientStillJob,
|
|
211
398
|
addClientVideoJob,
|
|
212
399
|
updateClientJobProgress,
|
|
@@ -217,12 +404,26 @@ const RenderQueueContextProvider = ({ children }) => {
|
|
|
217
404
|
removeClientJob,
|
|
218
405
|
cancelClientJob,
|
|
219
406
|
setProcessJobCallback,
|
|
407
|
+
addCaptionJob,
|
|
408
|
+
updateCaptionJobProgress,
|
|
409
|
+
markCaptionJobDone,
|
|
410
|
+
markCaptionJobFailed,
|
|
411
|
+
removeCaptionJob,
|
|
412
|
+
setProcessCaptionJobCallback,
|
|
413
|
+
addVideoMattingJob,
|
|
414
|
+
updateVideoMattingJobProgress,
|
|
415
|
+
markVideoMattingJobDone,
|
|
416
|
+
markVideoMattingJobFailed,
|
|
417
|
+
removeVideoMattingJob,
|
|
418
|
+
setProcessVideoMattingJobCallback,
|
|
220
419
|
getAbortController: client_render_queue_1.getAbortController,
|
|
221
420
|
getCompositionForJob: client_render_queue_1.getCompositionForJob,
|
|
222
421
|
};
|
|
223
422
|
}, [
|
|
224
423
|
serverJobs,
|
|
225
424
|
clientJobs,
|
|
425
|
+
captionJobs,
|
|
426
|
+
videoMattingJobs,
|
|
226
427
|
addClientStillJob,
|
|
227
428
|
addClientVideoJob,
|
|
228
429
|
updateClientJobProgress,
|
|
@@ -233,6 +434,18 @@ const RenderQueueContextProvider = ({ children }) => {
|
|
|
233
434
|
removeClientJob,
|
|
234
435
|
cancelClientJob,
|
|
235
436
|
setProcessJobCallback,
|
|
437
|
+
addCaptionJob,
|
|
438
|
+
updateCaptionJobProgress,
|
|
439
|
+
markCaptionJobDone,
|
|
440
|
+
markCaptionJobFailed,
|
|
441
|
+
removeCaptionJob,
|
|
442
|
+
setProcessCaptionJobCallback,
|
|
443
|
+
addVideoMattingJob,
|
|
444
|
+
updateVideoMattingJobProgress,
|
|
445
|
+
markVideoMattingJobDone,
|
|
446
|
+
markVideoMattingJobFailed,
|
|
447
|
+
removeVideoMattingJob,
|
|
448
|
+
setProcessVideoMattingJobCallback,
|
|
236
449
|
]);
|
|
237
450
|
return (jsx_runtime_1.jsx(exports.RenderQueueContext.Provider, { value: value, children: children }));
|
|
238
451
|
};
|
|
@@ -40,10 +40,14 @@ const remotion_1 = require("remotion");
|
|
|
40
40
|
const colors_1 = require("../../helpers/colors");
|
|
41
41
|
const layout_1 = require("../layout");
|
|
42
42
|
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
43
|
+
const caption_job_types_1 = require("./caption-job-types");
|
|
44
|
+
const CaptionQueueItem_1 = require("./CaptionQueueItem");
|
|
43
45
|
const context_1 = require("./context");
|
|
44
46
|
const RenderQueueItem_1 = require("./RenderQueueItem");
|
|
47
|
+
const video_matting_job_types_1 = require("./video-matting-job-types");
|
|
48
|
+
const VideoMattingQueueItem_1 = require("./VideoMattingQueueItem");
|
|
45
49
|
const errorExplanation = {
|
|
46
|
-
fontSize:
|
|
50
|
+
fontSize: 13,
|
|
47
51
|
color: colors_1.LIGHT_TEXT,
|
|
48
52
|
fontFamily: 'sans-serif',
|
|
49
53
|
lineHeight: 1.5,
|
|
@@ -66,10 +70,11 @@ const renderQueue = {
|
|
|
66
70
|
paddingBottom: 4,
|
|
67
71
|
};
|
|
68
72
|
const RenderQueue = () => {
|
|
69
|
-
const { jobs } = (0, react_1.useContext)(context_1.RenderQueueContext);
|
|
73
|
+
const { jobs, captionJobs, videoMattingJobs } = (0, react_1.useContext)(context_1.RenderQueueContext);
|
|
70
74
|
const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
71
|
-
const
|
|
72
|
-
const
|
|
75
|
+
const allJobs = (0, react_1.useMemo)(() => [...jobs, ...captionJobs, ...videoMattingJobs].sort((a, b) => a.startedAt - b.startedAt), [jobs, captionJobs, videoMattingJobs]);
|
|
76
|
+
const previousJobCount = react_1.default.useRef(allJobs.length);
|
|
77
|
+
const jobCount = allJobs.length;
|
|
73
78
|
const divRef = react_1.default.useRef(null);
|
|
74
79
|
(0, react_1.useEffect)(() => {
|
|
75
80
|
if (!divRef.current) {
|
|
@@ -89,22 +94,41 @@ const RenderQueue = () => {
|
|
|
89
94
|
return -1;
|
|
90
95
|
}
|
|
91
96
|
if (canvasContent.type === 'output') {
|
|
92
|
-
for (let i = 0; i <
|
|
93
|
-
const job =
|
|
97
|
+
for (let i = 0; i < allJobs.length; i++) {
|
|
98
|
+
const job = allJobs[i];
|
|
99
|
+
if ((0, caption_job_types_1.isCaptionJob)(job) || (0, video_matting_job_types_1.isVideoMattingJob)(job)) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
94
102
|
if (job.status === 'done' && canvasContent.path === `/${job.outName}`) {
|
|
95
103
|
return i;
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
}
|
|
107
|
+
if (canvasContent.type === 'asset') {
|
|
108
|
+
for (let i = 0; i < allJobs.length; i++) {
|
|
109
|
+
const job = allJobs[i];
|
|
110
|
+
if ((0, caption_job_types_1.isCaptionJob)(job) &&
|
|
111
|
+
job.status === 'done' &&
|
|
112
|
+
canvasContent.asset === job.outName) {
|
|
113
|
+
return i;
|
|
114
|
+
}
|
|
115
|
+
if ((0, video_matting_job_types_1.isVideoMattingJob)(job) &&
|
|
116
|
+
job.status === 'done' &&
|
|
117
|
+
(canvasContent.asset === job.baseOutName ||
|
|
118
|
+
canvasContent.asset === job.foregroundOutName)) {
|
|
119
|
+
return i;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
99
123
|
return -1;
|
|
100
|
-
}, [
|
|
124
|
+
}, [allJobs, canvasContent]);
|
|
101
125
|
if (jobCount === 0) {
|
|
102
126
|
return (jsx_runtime_1.jsxs("div", { style: explainer, children: [
|
|
103
|
-
jsx_runtime_1.jsx(layout_1.Spacing, { y: 5 }), jsx_runtime_1.jsx("div", { style: errorExplanation, children: "
|
|
127
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { y: 5 }), jsx_runtime_1.jsx("div", { style: errorExplanation, children: "Renders, transcriptions and video matting jobs will show up here." }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 2, block: true })
|
|
104
128
|
] }));
|
|
105
129
|
}
|
|
106
|
-
return (jsx_runtime_1.jsx("div", { ref: divRef, style: renderQueue, className: ['css-reset', is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME].join(' '), children:
|
|
107
|
-
return (jsx_runtime_1.jsx(RenderQueueItem_1.RenderQueueItem, { selected: selectedJob === index, job:
|
|
130
|
+
return (jsx_runtime_1.jsx("div", { ref: divRef, style: renderQueue, className: ['css-reset', is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME].join(' '), children: allJobs.map((job, index) => {
|
|
131
|
+
return (0, caption_job_types_1.isCaptionJob)(job) ? (jsx_runtime_1.jsx(CaptionQueueItem_1.CaptionQueueItem, { job: job, selected: selectedJob === index }, job.id)) : (0, video_matting_job_types_1.isVideoMattingJob)(job) ? (jsx_runtime_1.jsx(VideoMattingQueueItem_1.VideoMattingQueueItem, { job: job, selected: selectedJob === index }, job.id)) : (jsx_runtime_1.jsx(RenderQueueItem_1.RenderQueueItem, { selected: selectedJob === index, job: job }, job.id));
|
|
108
132
|
}) }));
|
|
109
133
|
};
|
|
110
134
|
exports.RenderQueue = RenderQueue;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderQueueItemSubtitleStyle = void 0;
|
|
3
|
+
exports.renderQueueItemSubtitleStyle = exports.RENDER_QUEUE_ITEM_SELECTED_CLASSNAME = void 0;
|
|
4
4
|
const colors_1 = require("../../helpers/colors");
|
|
5
5
|
const layout_1 = require("../layout");
|
|
6
|
+
exports.RENDER_QUEUE_ITEM_SELECTED_CLASSNAME = '__remotion_selected_classname';
|
|
6
7
|
exports.renderQueueItemSubtitleStyle = {
|
|
7
8
|
fontSize: 13,
|
|
8
9
|
color: colors_1.LIGHT_TEXT,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const loadModelForJob: <Model extends string>({ isModelCached, loadModel, model, progressSpan, progressStart, updateProgress, }: {
|
|
2
|
+
isModelCached: (model: Model) => Promise<boolean>;
|
|
3
|
+
loadModel: (model: Model, onProgress: (progress: number | null) => void) => Promise<unknown>;
|
|
4
|
+
model: Model;
|
|
5
|
+
progressSpan: number;
|
|
6
|
+
progressStart: number;
|
|
7
|
+
updateProgress: (progress: {
|
|
8
|
+
message: string;
|
|
9
|
+
value: number;
|
|
10
|
+
}) => void;
|
|
11
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadModelForJob = void 0;
|
|
4
|
+
const loadModelForJob = async ({ isModelCached, loadModel, model, progressSpan, progressStart, updateProgress, }) => {
|
|
5
|
+
const cached = await isModelCached(model);
|
|
6
|
+
await loadModel(model, (progress) => {
|
|
7
|
+
const percentage = progress === null ? '' : ` ${Math.round(progress * 100)}%`;
|
|
8
|
+
updateProgress({
|
|
9
|
+
message: `${cached ? 'Loading' : 'Downloading'} ${model}${percentage}`,
|
|
10
|
+
value: progressStart + (progress !== null && progress !== void 0 ? progress : 0) * progressSpan,
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
exports.loadModelForJob = loadModelForJob;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { VideoLayerAudio, VideoMattingBitrate, VideoMattingModel } from '@remotion/video-matting';
|
|
2
|
+
export type VideoMattingJobProgress = {
|
|
3
|
+
detail: string | null;
|
|
4
|
+
message: string;
|
|
5
|
+
value: number;
|
|
6
|
+
};
|
|
7
|
+
type VideoMattingJobStatus = {
|
|
8
|
+
status: 'idle';
|
|
9
|
+
} | {
|
|
10
|
+
status: 'running';
|
|
11
|
+
progress: VideoMattingJobProgress;
|
|
12
|
+
} | {
|
|
13
|
+
status: 'done';
|
|
14
|
+
} | {
|
|
15
|
+
status: 'failed';
|
|
16
|
+
error: {
|
|
17
|
+
message: string;
|
|
18
|
+
stack: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type AddVideoMattingJobParams = {
|
|
22
|
+
src: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
baseOutName: string;
|
|
25
|
+
foregroundOutName: string;
|
|
26
|
+
model: VideoMattingModel;
|
|
27
|
+
audio: VideoLayerAudio;
|
|
28
|
+
videoBitrate: VideoMattingBitrate;
|
|
29
|
+
};
|
|
30
|
+
export type VideoMattingJob = AddVideoMattingJobParams & {
|
|
31
|
+
id: string;
|
|
32
|
+
type: 'video-matting';
|
|
33
|
+
startedAt: number;
|
|
34
|
+
} & VideoMattingJobStatus;
|
|
35
|
+
export declare const isVideoMattingJob: (job: {
|
|
36
|
+
type: string;
|
|
37
|
+
}) => job is VideoMattingJob;
|
|
38
|
+
export {};
|