🎥 Make videos programmatically with React
fix tests
Jonny Burger9b36115b14b5
diff --git a/packages/core/src/sequencing/index.tsx b/packages/core/src/sequencing/index.tsxindex 6ddcc15aeb..cae15919f9 100644--- a/packages/core/src/sequencing/index.tsx+++ b/packages/core/src/sequencing/index.tsx@@ -10,7 +10,7 @@ import {FEATURE_FLAG_V2_BREAKING_CHANGES} from '../feature-flags';import {getTimelineClipName} from '../get-timeline-clip-name';import {TimelineContext} from '../timeline-position-state';import {useAbsoluteCurrentFrame} from '../use-frame';-import {useVideoConfig} from '../use-video-config';+import {useUnsafeVideoConfig} from '../use-unsafe-video-config';type SequenceContextType = {from: number;@@ -28,21 +28,9 @@ export const Sequence: React.FC<{layout?: 'absolute-fill' | 'none';}> = ({from, durationInFrames, children, name, layout = 'absolute-fill'}) => {const [id] = useState(() => String(Math.random()));- const absoluteFrame = useAbsoluteCurrentFrame();const parentSequence = useContext(SequenceContext);const {isThumbnail, rootId} = useContext(TimelineContext);const actualFrom = (parentSequence?.from ?? 0) + from;- const {durationInFrames: compositionDuration} = useVideoConfig();- const actualDurationInFrames = Math.min(- compositionDuration - from,- parentSequence- ? Math.min(- parentSequence.durationInFrames + parentSequence.from - actualFrom,- durationInFrames- )- : durationInFrames- );- const {registerSequence, unregisterSequence} = useContext(CompositionManager);if (layout !== 'absolute-fill' && layout !== 'none') {throw new TypeError(@@ -66,6 +54,22 @@ export const Sequence: React.FC<{);}+ const absoluteFrame = useAbsoluteCurrentFrame();+ const unsafeVideoConfig = useUnsafeVideoConfig();+ const compositionDuration = unsafeVideoConfig+ ? unsafeVideoConfig.durationInFrames+ : 0;+ const actualDurationInFrames = Math.min(+ compositionDuration - from,+ parentSequence+ ? Math.min(+ parentSequence.durationInFrames + parentSequence.from - actualFrom,+ durationInFrames+ )+ : durationInFrames+ );+ const {registerSequence, unregisterSequence} = useContext(CompositionManager);+const contextValue = useMemo((): SequenceContextType => {return {from: actualFrom,diff --git a/packages/core/src/test/media-validation.test.tsx b/packages/core/src/test/media-validation.test.tsxindex 976d4f2c7d..b7ed1294fc 100644--- a/packages/core/src/test/media-validation.test.tsx+++ b/packages/core/src/test/media-validation.test.tsx@@ -70,7 +70,7 @@ test('It should not allow an audio element to have a wrong type', () => {<Audio src="hi" volume="wrong" /></Wrapper>),- /You have passed a volume of type string to your <Audio \/> component. Volume must be a number or undefined./+ /You have passed a volume of type string to your <Audio \/> component. Volume must be a number or a function/);});@@ -85,7 +85,7 @@ test('It should not allow an video element to have a wrong type', () => {<Video src="hi" volume="wrong" /></Wrapper>),- /You have passed a volume of type string to your <Video \/> component. Volume must be a number or undefined./+ /You have passed a volume of type string to your <Video \/> component. Volume must be a number or a function/);});