UNPKG

use-ffmpeg

Version:

A React hook for browser-based media processing using FFmpeg WASM - handles video and other file formats conversion with ease

32 lines 1.38 kB
import React from "react"; import type { UseFFmpeg } from "../types/useFFmpeg"; /** * FFmpegContextProvider is a React component that wraps the application and provides * the FFmpeg hook using context. This provider must be placed higher in the component tree * where the `useFFmpeg` hook needs access to FFmpeg functionality. * * @param {React.PropsWithChildren} props - The props to be passed to the children components. * @returns {React.ReactNode} - The wrapped children components with the FFmpeg context provided. * * @example * <FFmpegContextProvider> * <YourComponent /> * </FFmpegContextProvider> */ export declare const FFmpegContextProvider: (props: React.PropsWithChildren) => React.JSX.Element; /** * Custom hook to access the FFmpeg context value. * If the context is not available (i.e., the hook is called outside the provider), * it will fallback to using the base `useFFmpeg` hook directly. * * @returns {UseFFmpeg} - The FFmpeg hook, providing FFmpeg functionality and methods. * * @throws {Error} - Throws an error if the hook is used outside of the FFmpegContextProvider * and the fallback logic is not invoked (since the base hook will be used in that case). * * @example * const ffmpeg = useFFmpeg(); * ffmpeg.load(); // Example usage */ export declare const useFFmpeg: () => UseFFmpeg; //# sourceMappingURL=FFmpegContext.d.ts.map