Skip to content

🎥 Make videos programmatically with React

add premount and postmount display for new video preview

Igor Samokhovets22085ba40cdf
diff --git a/packages/media/src/video/video-for-preview.tsx b/packages/media/src/video/video-for-preview.tsx
index 2cc486e032..8ecfa80c64 100644
--- a/packages/media/src/video/video-for-preview.tsx
+++ b/packages/media/src/video/video-for-preview.tsx
@@ -26,6 +26,7 @@ const {
warnAboutTooHighVolume,
usePreload,
useMediaInTimeline,
+ SequenceContext,
} = Internals;
const calculateLoopDuration = ({
@@ -108,6 +109,8 @@ const NewVideoForPreview: React.FC<NewVideoForPreviewProps> = ({
const [timelineId] = useState(() => String(Math.random()));
+ const parentSequence = useContext(SequenceContext);
+
useMediaInTimeline({
volume,
mediaVolume,
@@ -118,8 +121,8 @@ const NewVideoForPreview: React.FC<NewVideoForPreviewProps> = ({
id: timelineId,
stack: null,
showInTimeline: true,
- premountDisplay: null,
- postmountDisplay: null,
+ premountDisplay: parentSequence?.premountDisplay ?? null,
+ postmountDisplay: parentSequence?.postmountDisplay ?? null,
});
if (!videoConfig) {