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

See also

AltStyle によって変換されたページ (->オリジナル) /