Support » Plugin: Gutenberg » Disable video loop in cover block

  • Resolved Thune

    (@thune)


    Using the cover block in Gutenberg 6.4 and don’t want the video to loop. Just want it to run it once. Possible? I can take a geeky answer…need to solve this 🙂

    Regards
    Øystein

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey, to disable this feature, you have to add a filter to the save function of the block and override the cover block.

    
    wp.hooks.addFilter(
    	'blocks.getSaveElement',
    	'cover/disableAutoPlay',
    	disableAutoPlay
    );
    
    function disableAutoPlay( element, blockType, attributes ) {
    	if ( blockType.name !== 'core/cover' ) {
    		return element;
    	}
    	return (
    		// use the save function of the cover block and modify it.
    	);
    }
    

    An alternative would be to disable this attribute via JS on the frontend.

    Thanks for answering. I will try this next time. I solved it yesterday where I just copied the HTML source, removed the loop and added that HTML-code in the editor.

    Øystein

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable video loop in cover block’ is closed to new replies.