Skip to content

Commit 94727c7

Browse files
committed
mobile
1 parent 820fb16 commit 94727c7

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

public/AMS/index.html

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,45 @@
7373
<script src="./static/js/bulma-carousel.min.js"></script>
7474
<script src="./static/js/bulma-slider.min.js"></script>
7575
<script src="./static/js/index.js"></script>
76+
<script>
77+
document.addEventListener('DOMContentLoaded', function() {
78+
var heroVideo = document.querySelector('.hero-video video');
79+
if (heroVideo) {
80+
heroVideo.load();
81+
82+
var playPromise = heroVideo.play();
83+
if (playPromise !== undefined) {
84+
playPromise.catch(function(error) {
85+
console.log('Video auto-play failed, will play on user interaction:', error);
86+
document.addEventListener('touchstart', function playVideoOnce() {
87+
heroVideo.play().catch(function(e) {
88+
console.log('Video playback failed:', e);
89+
});
90+
document.removeEventListener('touchstart', playVideoOnce);
91+
}, { once: true });
92+
});
93+
}
94+
95+
heroVideo.addEventListener('error', function(e) {
96+
console.error('Video loading failed:', e);
97+
});
98+
99+
heroVideo.addEventListener('loadeddata', function() {
100+
heroVideo.play().catch(function(e) {
101+
console.log('Video playback failed:', e);
102+
});
103+
});
104+
}
105+
});
106+
</script>
76107
</head>
77-
<body onload="updateComparativeVideos();">
108+
<body>
78109

79110

80111

81112
<section class="hero is-link is-fullheight video" style="overflow: hidden; position:relative;">
82113
<div class="hero-video" style="height: 100%; width: 177.77777778vh; min-width: 100%;min-height: 56.25vw;">
83-
<video playsinline autoplay muted loop>
114+
<video playsinline autoplay muted loop preload="auto" style="width: 100%; height: 100%; object-fit: cover;">
84115
<source src="https://raw.githubusercontent.com/OpenDriveLab/opendrivelab.github.io/master/AMS/teaser.mp4" type="video/mp4">
85116
<!-- <source src="https://assets.kinetixai.cn/AMS/video/teaser.mp4" type="video/mp4"> -->
86117
</video>

0 commit comments

Comments
 (0)