Skip to content

🎥 Make videos programmatically with React

fix missing types

Jonny Burger3d21e20c6bd2
diff --git a/packages/core/src/audio/AudioForDevelopment.tsx b/packages/core/src/audio/AudioForDevelopment.tsx
index a96112b376..0bd18bd0ad 100644
--- a/packages/core/src/audio/AudioForDevelopment.tsx
+++ b/packages/core/src/audio/AudioForDevelopment.tsx
@@ -22,21 +22,25 @@ export const AudioForDevelopment: React.FC<RemotionAudioProps> = (props) => {
const audioFrame = useAudioFrame();
const videoConfig = useUnsafeVideoConfig();
const [playing] = usePlayingState();
- const {rootId} = useContext(TimelineContext);
+ const {rootId} = useContext(TimelineContext);
const parentSequence = useContext(SequenceContext);
const actualFrom = parentSequence
? parentSequence.relativeFrom + parentSequence.cumulatedFrom
: 0;
-
const startsAt = useAudioStartsAt();
-
const {registerSequence, unregisterSequence} = useContext(CompositionManager);
-
const [id] = useState(() => String(Math.random()));
-
const {volume, ...nativeProps} = props;
+ useEffect(() => {
+ if (playing) {
+ audioRef.current?.play();
+ } else {
+ audioRef.current?.pause();
+ }
+ }, [playing]);
+
const actualVolume = useMediaTagVolume(audioRef);
useSyncVolumeWithMediaTag({
@@ -46,14 +50,6 @@ export const AudioForDevelopment: React.FC<RemotionAudioProps> = (props) => {
mediaRef: audioRef,
});
- useEffect(() => {
- if (playing) {
- audioRef.current?.play();
- } else {
- audioRef.current?.pause();
- }
- }, [playing]);
-
const duration = (() => {
if (!videoConfig) {
return 0;
@@ -128,6 +124,7 @@ export const AudioForDevelopment: React.FC<RemotionAudioProps> = (props) => {
playing,
videoConfig,
src: nativeProps.src,
+ mediaType: 'audio',
});
return <audio ref={audioRef} {...nativeProps} />;
diff --git a/packages/core/src/video/VideoForDevelopment.tsx b/packages/core/src/video/VideoForDevelopment.tsx
index 4434cff244..b9d2113004 100644
--- a/packages/core/src/video/VideoForDevelopment.tsx
+++ b/packages/core/src/video/VideoForDevelopment.tsx
@@ -43,6 +43,7 @@ export const VideoForDevelopment: React.FC<RemotionVideoProps> = (props) => {
playing,
src: nativeProps.src,
videoConfig,
+ mediaType: 'video',
});
return <video ref={videoRef} {...nativeProps} />;