Skip to main content

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 click
import {toggle} from '@remotion/studio'; const ToggleButton = () => { // Call with the event parameter for better browser audio autoplay return <button onClick={(e) => toggle(e)}>Play/Pause</button>; };
Toggle playback programmatically
import {toggle} from '@remotion/studio'; // Call without event parameter toggle();

See also