UNPKG

@wordpress/block-library

Version:
24 lines (21 loc) • 544 B
import { getElement, store } from '@wordpress/interactivity'; import { prefersReducedMotion } from '../utils/reduced-motion'; store( 'core/video', { callbacks: { stopAutoplay() { if ( ! prefersReducedMotion() ) { return; } // The video is saved with `autoplay`, so it is stopped here // rather than never started. Clearing the attribute as well // keeps it from playing again if the source reloads. const { ref } = getElement(); ref.autoplay = false; ref.pause(); }, }, }, { lock: true } );