webFileReader
warning
Unstable API: This package is experimental. The API may change in the future.
The API for getting video metadata is stable and may be used in production.
A reader for @remotion/media-parser that reads from a File object.
It only works in the browser.
Useful if you want to parse a video from a <input type="file"> element.
Example
Reading a local filetsxReact , {useCallback } from 'react';import {parseMedia } from '@remotion/media-parser';import {webFileReader } from '@remotion/media-parser/web-file';constMyComp :React .FC = () => {constonFile =useCallback (async (file :File ) => {constresult = awaitparseMedia ({src :file ,fields : {durationInSeconds : true,dimensions : true,},reader :webFileReader ,});}, []);return <input type ="file"onChange ={(e ) =>onFile (e .target .files ?.[0]!)} />;};