diff --git a/sisvietnamvn_main/src/main/resources/static/js/ambient-video.js b/sisvietnamvn_main/src/main/resources/static/js/ambient-video.js index bc3c2a9a..3ac206ff 100644 --- a/sisvietnamvn_main/src/main/resources/static/js/ambient-video.js +++ b/sisvietnamvn_main/src/main/resources/static/js/ambient-video.js @@ -18,6 +18,16 @@ document.addEventListener('DOMContentLoaded', function () { var video = videoContainer.querySelector('video'); if (!video) return; + // Attempt to explicitly play the video to bypass browser autoplay issues + var playPromise = video.play(); + if (playPromise !== undefined) { + playPromise.catch(function(error) { + console.log("Auto-play was prevented by the browser:", error); + if (playBtn) playBtn.classList.remove('active'); + if (pauseBtn) pauseBtn.classList.add('hidden'); + }); + } + if (pauseBtn) { pauseBtn.addEventListener('click', function (e) { e.preventDefault(); diff --git a/sisvietnamvn_main/src/main/resources/templates/pages/home.html b/sisvietnamvn_main/src/main/resources/templates/pages/home.html index bf4fff6f..da3663ad 100644 --- a/sisvietnamvn_main/src/main/resources/templates/pages/home.html +++ b/sisvietnamvn_main/src/main/resources/templates/pages/home.html @@ -1,26 +1,29 @@ - - - -
+ + +