Chapter 201: getGifDurationInSeconds()
Core Idea
Part of the @remotion/gif package
Key Concepts
- Arguments
- src
- options?<AvailableFrom v="4.0.471" />
- requestInit?<AvailableFrom v="4.0.471" />
- Return value
- Example
- See also
Code Examples
const MyComp: React.FC = () => {
const getDuration = useCallback(async () => {
const imported = await getGifDurationInSeconds(gif); // 127.452
const publicFile = await getGifDurationInSeconds(staticFile('giphy.gif')); // 2.10
const remote = await getGifDurationInSeconds('https://media.giphy.com/media/xT0GqH01ZyKwd3aT3G/giphy.gif'); // 3.23
}, []);
useEffect(() => {
getDuration();
}, []);
return null;
};
- What it demonstrates: Usage pattern for getGifDurationInSeconds() from the official docs.
Key Takeaways
- Understand arguments when working with getGifDurationInSeconds().
- Understand src when working with getGifDurationInSeconds().
- Understand options?<availablefrom v="4.0.471" /> when working with getGifDurationInSeconds().
- Understand requestinit?<availablefrom v="4.0.471" /> when working with getGifDurationInSeconds().
- Understand return value when working with getGifDurationInSeconds().
Connects To
- Animatedimage: related page in the Assets & Media section.
- Delaying: related page in the Assets & Media section.
- Exporting: related page in the Assets & Media section.