How to use a large amount of audio clips in the video efficiently? #1526
-
For instance, I have a list of times to play the audio: const audioTimes = useMemo(() => Array(1500).fill(0).map((_, i) => i / 8), []) And use the return (
<>
{audioTimes.map((time, i) => (
<Sequence from={Math.round(time * fps)} durationInFrames={fps * 2} key={i}>
<Audio src={staticFile('core/HitSong0.ogg')} />
</Sequence>
))}
</>
) the preview and the Is there any efficient way to do this? |
Beta Was this translation helpful? Give feedback.
Answered by
JonnyBurger
Nov 30, 2022
Replies: 1 comment 3 replies
-
You could not render the sequences which are not relevant at a certain time: return (
<>
{audioTimes.map((time, i) => {
const from = Math.round(time * fps);
if (frame < from || frame + (fps * 2) > from) {
return null;
}
return (
<Sequence from={from} durationInFrames={fps * 2} key={i}>
<Audio src={staticFile('core/HitSong0.ogg')} />
</Sequence>
)
})}
</>
) |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
Ivan-1F
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could not render the sequences which are not relevant at a certain time: