/* Force Native Squarespace Background Videos to Preload & Play Early */
(function() {
function accelerateBgVideos() {
var bgVideos = document.querySelectorAll('.sqs-video-background video, .section-background video, section video');
bgVideos.forEach(function(video) {
// Override Squarespace's lazy video loading defaults
video.setAttribute('preload', 'auto');
video.setAttribute('playsinline', '');
// Force playback as soon as enough data is buffered
if (video.paused) {
video.play().catch(function() {
// Silently handle browser autoplay policy restrictions if muted
});
}
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', accelerateBgVideos);
} else {
accelerateBgVideos();
}
})();