toggle()v4.0.287
Toggles playback in the Remotion Studio. If the composition is currently playing, it will pause. If it's paused, it will start playing.
The function accepts an optional event parameter which can be a React.SyntheticEvent or a PointerEvent. This allows the function to be used directly as an event handler.
Examples
Toggle playback on button clickimport {toggle } from '@remotion/studio'; constToggleButton = () => { // Call with the event parameter for better browser audio autoplay return <button onClick ={(e ) =>toggle (e )}>Play/Pause</button >; };
Toggle playback programmaticallyimport {toggle } from '@remotion/studio'; // Call without event parametertoggle ();