Background Demo

Background Video

This page demonstrates the background video feature with autoplay, looping, and overlay support. The video plays automatically in the background while you scroll.

Autoplay

Videos start playing automatically when the page loads. Muted by default to comply with browser autoplay policies.

Seamless Loop

Videos loop seamlessly, creating a continuous ambient background that enhances the visual experience.

Mobile Fallback

Option to show a poster image on mobile devices instead of video to save bandwidth and battery.

Configuration

Configure per-page background videos in config/params/canvasAnimations.php:

'site/bg-video' => [ 'enabled' => true, 'type' => 'video', 'video' => [ 'src' => '@web/videos/spaceship.mp4', 'poster' => '@web/images/backgrounds/background-1.jpg', 'loop' => true, 'muted' => true, 'autoplay' => true, 'overlay' => 'rgba(0,0,0,0.4)', 'mobileDisabled' => false, ],],

Available Options

OptionTypeDescription
srcstring|arrayVideo path (MP4). Use array with light/dark keys for theme-aware videos.
posterstring|arrayPoster image shown before video loads or on mobile fallback.
loopbooleanIf true, video loops continuously.
mutedbooleanIf true, video plays muted. Required for autoplay in most browsers.
autoplaybooleanIf true, video starts playing automatically on page load.
playsinlinebooleanIf true, video plays inline on mobile (not fullscreen).
overlaystringOptional overlay color for text readability.
mobileDisabledbooleanIf true, shows poster image on mobile instead of video.
Theme-Aware Videos

Like images, videos can also be theme-aware. Use an array with light/dark keys to serve different videos based on the current theme:

'src' => [ 'light' => '@web/videos/light-theme.mp4', 'dark' => '@web/videos/dark-theme.mp4',],