Skip to content

Commit 45547ad

Browse files
committed
Use static hero poster in mobile webviews
1 parent 4a96c86 commit 45547ad

3 files changed

Lines changed: 36 additions & 13 deletions

File tree

public/RoboNaldo/index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<!-- <link rel="preconnect" href="https://fonts.googleapis.com"> -->
1919
<!-- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> -->
2020
<!-- <link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT@9..144,400;9..144,500;9..144,600;9..144,700;9..144,800;9..144,900&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600;8..60,700&family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet"> -->
21-
<link rel="stylesheet" href="static/css/index.css?v=20260612b">
21+
<link rel="stylesheet" href="static/css/index.css?v=20260612c">
2222
</head>
2323
<body>
2424
<div class="top-progress" aria-hidden="true"><span class="top-progress-bar"></span></div>
@@ -72,19 +72,19 @@ <h1 class="paper-title">
7272
</svg>
7373
<span>paper</span>
7474
</a>
75-
<a class="hero-link" href="https://github.com/opendrivelab/RoboNaldo" target="_blank" rel="noopener">
76-
<svg class="hero-link-ic" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
77-
<path d="M12 .5a11.5 11.5 0 0 0-3.64 22.42c.58.1.79-.25.79-.56v-2c-3.2.7-3.88-1.39-3.88-1.39-.53-1.35-1.3-1.71-1.3-1.71-1.07-.73.08-.72.08-.72 1.18.08 1.8 1.21 1.8 1.21 1.05 1.8 2.76 1.28 3.43.98.1-.77.41-1.28.74-1.58-2.55-.29-5.24-1.28-5.24-5.69 0-1.26.45-2.29 1.19-3.09-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.04 11.04 0 0 1 5.79 0c2.2-1.49 3.17-1.18 3.17-1.18.63 1.59.23 2.76.11 3.05.74.8 1.18 1.83 1.18 3.09 0 4.42-2.69 5.39-5.25 5.68.42.36.79 1.07.79 2.16v3.2c0 .31.21.66.8.55A11.5 11.5 0 0 0 12 .5z"/>
78-
</svg>
79-
<span>Code</span>
80-
</a>
8175
<a class="hero-link" href="https://youtu.be/BuHNzqebIqc" target="_blank" rel="noopener">
8276
<svg class="hero-link-ic" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
8377
<path d="M22 8a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v8a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4z"/>
8478
<path d="M10 9l5 3-5 3z" fill="currentColor"/>
8579
</svg>
8680
<span>Video</span>
8781
</a>
82+
<a class="hero-link" href="https://github.com/opendrivelab/RoboNaldo" target="_blank" rel="noopener">
83+
<svg class="hero-link-ic" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
84+
<path d="M12 .5a11.5 11.5 0 0 0-3.64 22.42c.58.1.79-.25.79-.56v-2c-3.2.7-3.88-1.39-3.88-1.39-.53-1.35-1.3-1.71-1.3-1.71-1.07-.73.08-.72.08-.72 1.18.08 1.8 1.21 1.8 1.21 1.05 1.8 2.76 1.28 3.43.98.1-.77.41-1.28.74-1.58-2.55-.29-5.24-1.28-5.24-5.69 0-1.26.45-2.29 1.19-3.09-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.04 11.04 0 0 1 5.79 0c2.2-1.49 3.17-1.18 3.17-1.18.63 1.59.23 2.76.11 3.05.74.8 1.18 1.83 1.18 3.09 0 4.42-2.69 5.39-5.25 5.68.42.36.79 1.07.79 2.16v3.2c0 .31.21.66.8.55A11.5 11.5 0 0 0 12 .5z"/>
85+
</svg>
86+
<span>Code</span>
87+
</a>
8888
</nav>
8989

9090
<p class="one-liner">World's first less-than-1-meter-level accurate humanoid soccer shooting policy in general cases.<br> Single human reference, learn to track, then deviate and adapt.</p>
@@ -544,6 +544,6 @@ <h2>BibTeX</h2>
544544
</div>
545545
</footer>
546546

547-
<script src="static/js/index.js?v=20260612f"></script>
547+
<script src="static/js/index.js?v=20260612h"></script>
548548
</body>
549549
</html>

public/RoboNaldo/static/css/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ img { display: block; max-width: 100%; }
186186
width: 100%;
187187
height: 100%;
188188
object-fit: cover;
189+
display: block;
189190
z-index: 0;
190191
transform: scale(1.04);
191192
}

public/RoboNaldo/static/js/index.js

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ document.querySelectorAll("[data-copy-target]").forEach((button) => {
6262
const isIOS = /iP(?:hone|ad|od)/i.test(ua);
6363
const isKnownIOSBrowser = /Version\/[\d.]+.*Safari|CriOS|FxiOS|EdgiOS/i.test(ua);
6464
const isIOSWebView = isIOS && !isKnownIOSBrowser;
65+
const isMobileLike = isIOS || /Android|Mobile|Windows Phone/i.test(ua);
6566
const isConstrainedBrowser = isIOSWebView || /Twitter|MicroMessenger|FBAN|FBAV|Instagram|Line|LinkedInApp|Feishu|Lark|Bytedance|Aweme|MQQBrowser|QQ\//i.test(ua);
6667

6768
const hydrate = (video) => {
@@ -107,10 +108,27 @@ document.querySelectorAll("[data-copy-target]").forEach((button) => {
107108
parent.appendChild(button);
108109
};
109110

110-
if (isConstrainedBrowser) {
111+
const replaceHeroWithPoster = () => {
111112
heroVideos.forEach((video) => {
113+
if (!video.parentElement) return;
114+
const poster = video.getAttribute("poster");
115+
if (!poster) return;
116+
117+
const image = document.createElement("img");
118+
image.className = video.className;
119+
image.src = poster;
120+
image.alt = "";
121+
image.setAttribute("aria-hidden", "true");
122+
112123
video.autoplay = false;
124+
video.removeAttribute("autoplay");
125+
video.pause();
126+
video.replaceWith(image);
113127
});
128+
};
129+
130+
if (isConstrainedBrowser) {
131+
replaceHeroWithPoster();
114132

115133
[...primaryDeferredVideos, ...videos].forEach((video) => {
116134
video.autoplay = false;
@@ -127,10 +145,14 @@ document.querySelectorAll("[data-copy-target]").forEach((button) => {
127145
return;
128146
}
129147

130-
heroVideos.forEach((video) => {
131-
hydrate(video);
132-
tryPlay(video);
133-
});
148+
if (isMobileLike) {
149+
replaceHeroWithPoster();
150+
} else {
151+
heroVideos.forEach((video) => {
152+
hydrate(video);
153+
tryPlay(video);
154+
});
155+
}
134156

135157
primaryDeferredVideos.forEach((video) => {
136158
hydrate(video);

0 commit comments

Comments
 (0)