UNPKG

remotion

Version:

Make videos programmatically

40 lines (39 loc) 1.61 kB
import type { ComponentType, LazyExoticComponent } from 'react'; import React from 'react'; import type { RemotionAudioProps } from './props.js'; /** * This functionality of Remotion will keep a certain amount * of <audio> tags pre-mounted and by default filled with an empty audio track. * If the user interacts, the empty audio will be played. * If one of Remotions <Audio /> tags get mounted, the audio will not be rendered at this location, but into one of the prerendered audio tags. * * This helps with autoplay issues on iOS Safari and soon other browsers, * which only allow audio playback upon user interaction. * * The behavior can be disabled by passing `0` as the number of shared audio tracks. */ type AudioElem = { id: number; props: RemotionAudioProps; el: React.RefObject<HTMLAudioElement | null>; audioId: string; }; type SharedContext = { registerAudio: (aud: RemotionAudioProps, audioId: string) => AudioElem; unregisterAudio: (id: number) => void; updateAudio: (options: { id: number; aud: RemotionAudioProps; audioId: string; }) => void; playAllAudios: () => void; numberOfAudioTags: number; }; export declare const SharedAudioContext: React.Context<SharedContext | null>; export declare const SharedAudioContextProvider: React.FC<{ readonly numberOfAudioTags: number; readonly children: React.ReactNode; readonly component: LazyExoticComponent<ComponentType<Record<string, unknown>>> | null; }>; export declare const useSharedAudio: (aud: RemotionAudioProps, audioId: string) => AudioElem; export {};