🎥 Make videos programmatically with React
don't show helper sequences in timeline
Jonny Burger952324389b1a
diff --git a/packages/cli/src/editor/components/Timeline/TimelineListItem.tsx b/packages/cli/src/editor/components/Timeline/TimelineListItem.tsxindex f904ab110d..df1aec160a 100644--- a/packages/cli/src/editor/components/Timeline/TimelineListItem.tsx+++ b/packages/cli/src/editor/components/Timeline/TimelineListItem.tsx@@ -67,7 +67,7 @@ export const TimelineListItem: React.FC<{return (<div style={outer}><div style={padder} />- {sequence.parent ? (+ {sequence.parent && nestedDepth > 0 ? (<><div style={smallSpace} /><div style={hookContainer}>diff --git a/packages/cli/src/editor/helpers/calculate-timeline.ts b/packages/cli/src/editor/helpers/calculate-timeline.tsindex bfa2d33ccc..bd77e79a2a 100644--- a/packages/cli/src/editor/helpers/calculate-timeline.ts+++ b/packages/cli/src/editor/helpers/calculate-timeline.ts@@ -36,6 +36,7 @@ export const calculateTimeline = ({parent: null,type: 'sequence',rootId: '-',+ showInTimeline: true,},depth: 0,},@@ -49,6 +50,9 @@ export const calculateTimeline = ({if (!hashesUsedInRoot[sequence.rootId]) {hashesUsedInRoot[sequence.rootId] = [];}+ if (!sequence.showInTimeline) {+ continue;+ }const baseHash = getTimelineSequenceHash(sequence, sequences);const depth = getTimelineNestedLevel(sequence, sequences, 0);const visibleStart = getTimelineVisibleStart(sequence, sequences);diff --git a/packages/cli/src/editor/helpers/get-timeline-nestedness.ts b/packages/cli/src/editor/helpers/get-timeline-nestedness.tsindex c3ac7947e6..7364133af4 100644--- a/packages/cli/src/editor/helpers/get-timeline-nestedness.ts+++ b/packages/cli/src/editor/helpers/get-timeline-nestedness.ts@@ -12,5 +12,9 @@ export const getTimelineNestedLevel = (if (!parentSequence) {throw new Error('has parentId but no parent');}- return getTimelineNestedLevel(parentSequence, allSequences, depth + 1);+ return getTimelineNestedLevel(+ parentSequence,+ allSequences,+ depth + (parentSequence.showInTimeline ? 1 : 0)+ );};diff --git a/packages/core/src/CompositionManager.tsx b/packages/core/src/CompositionManager.tsxindex 68ae5b5558..d72e0a1c93 100644--- a/packages/core/src/CompositionManager.tsx+++ b/packages/core/src/CompositionManager.tsx@@ -40,6 +40,7 @@ export type TSequence = {displayName: string;parent: string | null;rootId: string;+ showInTimeline: boolean;} & EnhancedTSequenceData;export type TAsset = {diff --git a/packages/core/src/audio/Audio.tsx b/packages/core/src/audio/Audio.tsxindex 9cda3e4a7a..6bbee571a7 100644--- a/packages/core/src/audio/Audio.tsx+++ b/packages/core/src/audio/Audio.tsx@@ -15,7 +15,11 @@ export const Audio: React.FC<RemotionAudioProps & RemotionMainAudioProps> = (const startAtFrameNo = startAt ?? 0;const endAtFrameNo = endAt ?? Infinity;return (- <Sequence from={0 - startAtFrameNo} durationInFrames={endAtFrameNo}>+ <Sequence+ from={0 - startAtFrameNo}+ showInTimeline={false}+ durationInFrames={endAtFrameNo}+ ><Audio {...otherProps} /></Sequence>);diff --git a/packages/core/src/audio/AudioForDevelopment.tsx b/packages/core/src/audio/AudioForDevelopment.tsxindex 106471b9ee..33a7217207 100644--- a/packages/core/src/audio/AudioForDevelopment.tsx+++ b/packages/core/src/audio/AudioForDevelopment.tsx@@ -118,6 +118,7 @@ export const AudioForDevelopment: React.FC<RemotionAudioProps> = (props) => {displayName: getAssetFileName(props.src),rootId,volume: volumes,+ showInTimeline: true,});return () => unregisterSequence(id);}, [diff --git a/packages/core/src/sequencing/index.tsx b/packages/core/src/sequencing/index.tsxindex f8286c40ad..20383ea359 100644--- a/packages/core/src/sequencing/index.tsx+++ b/packages/core/src/sequencing/index.tsx@@ -28,7 +28,15 @@ export const Sequence: React.FC<{durationInFrames: number;name?: string;layout?: 'absolute-fill' | 'none';-}> = ({from, durationInFrames, children, name, layout = 'absolute-fill'}) => {+ showInTimeline?: boolean;+}> = ({+ from,+ durationInFrames,+ children,+ name,+ layout = 'absolute-fill',+ showInTimeline = true,+}) => {const [id] = useState(() => String(Math.random()));const parentSequence = useContext(SequenceContext);const {rootId} = useContext(TimelineContext);@@ -106,6 +114,7 @@ export const Sequence: React.FC<{parent: parentSequence?.id ?? null,type: 'sequence',rootId,+ showInTimeline,});return () => {unregisterSequence(id);@@ -122,6 +131,7 @@ export const Sequence: React.FC<{actualDurationInFrames,rootId,from,+ showInTimeline,]);const endThreshold = (() => {diff --git a/packages/core/src/video/Video.tsx b/packages/core/src/video/Video.tsxindex 6d4ecfafe2..aeafe4e867 100644--- a/packages/core/src/video/Video.tsx+++ b/packages/core/src/video/Video.tsx@@ -16,7 +16,11 @@ export const Video: React.FC<RemotionVideoProps & RemotionMainVideoProps> = (const startAtFrameNo = startAt ?? 0;const endAtFrameNo = endAt ?? Infinity;return (- <Sequence from={0 - startAtFrameNo} durationInFrames={endAtFrameNo}>+ <Sequence+ showInTimeline={false}+ from={0 - startAtFrameNo}+ durationInFrames={endAtFrameNo}+ ><Video {...otherProps} /></Sequence>);diff --git a/packages/example/src/AudioTesting/index.tsx b/packages/example/src/AudioTesting/index.tsxindex bdcc74ae15..dabb05aa1a 100644--- a/packages/example/src/AudioTesting/index.tsx+++ b/packages/example/src/AudioTesting/index.tsx@@ -1,20 +1,22 @@-import {Audio, interpolate} from 'remotion';+import {Audio, interpolate, Sequence} from 'remotion';import music from './music.mp3';const AudioTesting: React.FC = () => {return (<div>- <Audio- startAt={100}- endAt={200}- src={music}- volume={(f) =>- interpolate(f, [0, 50, 100], [0, 1, 0], {- extrapolateLeft: 'clamp',- extrapolateRight: 'clamp',- })- }- />+ <Sequence from={100} durationInFrames={Infinity}>+ <Audio+ startAt={100}+ endAt={200}+ src={music}+ volume={(f) =>+ interpolate(f, [0, 50, 100], [0, 1, 0], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })+ }+ />+ </Sequence></div>);};