Skip to content

Commit c2510e0

Browse files
authored
fix(route): set preload to metadata as suggested by the [spec](https://html.spec.whatwg.org/multipage/media.html#attr-media-preload) (#15448)
1 parent aecdcd9 commit c2510e0

File tree

13 files changed

+13
-13
lines changed

13 files changed

+13
-13
lines changed

lib/routes/caixin/templates/article.art

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<% const video = $('script').text().match(/initPlayer\('(.*?)','(.*?)'\)/); %>
1616
<% const videoUrl = video[1]; %>
1717
<% const poster = video[2]; %>
18-
<video controls preload="none" poster="{{ poster }}" src="{{ videoUrl }}"></video>
18+
<video controls preload="metadata" poster="{{ poster }}" src="{{ videoUrl }}"></video>
1919
<br>
2020
{{ /if }}
2121

lib/routes/douyin/templates/embed.art

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<video controls preload="none" referrerpolicy="no-referrer"
1+
<video controls preload="metadata" referrerpolicy="no-referrer"
22
style="width:50%"
33
{{ if img }}
44
poster="{{ img }}"

lib/routes/fansly/templates/media.art

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ if poster && src }}
2-
<video controls preload="none" poster="{{ poster.location }}">
2+
<video controls preload="metadata" poster="{{ poster.location }}">
33
<source src="{{ src.location }}" type="video/mp4">
44
</video>
55
{{ else if src }}

lib/routes/ifeng/templates/video.art

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ if videoInfo.mobileUrl }}
2-
<video controls poster="{{ videoInfo.bigPosterUrl }}" preload="none">
2+
<video controls poster="{{ videoInfo.bigPosterUrl }}" preload="metadata">
33
<source src="{{ videoInfo.mobileUrl }}" type="video/mp4">
44
</video>
55
{{ /if }}

lib/routes/instagram/templates/video.art

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<br>
44
{{ /if }}
55

6-
<video controls preload="none" poster="{{ image }}" width="{{ video.width }}">
6+
<video controls preload="metadata" poster="{{ image }}" width="{{ video.width }}">
77
<source src="{{ video.url }}" type="video/mp4">
88
</video>

lib/routes/kcna/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const fetchVideo = (ctx, url) =>
5454
const js = $('script[type="text/javascript"]:not([src])').html();
5555
let sources = js.match(/<[^>]*source[^>]+src[^>]+>/g);
5656
sources = sources && sources.map((item) => item.replaceAll("'", '"').replaceAll(/src="([^"]+)"/g, `src="${rootUrl}$1"`));
57-
return `<video controls preload="none">${sources.join('\n')}</video>`;
57+
return `<video controls preload="metadata">${sources.join('\n')}</video>`;
5858
});
5959

6060
export { parseJucheDate, fixDesc, fetchPhoto, fetchVideo };

lib/routes/mingpao/templates/fancybox.art

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{ each media }}
22
{{ if $value.video }}
3-
<video controls preload="none" poster="{{ $value.video.replace('.mp4', '.jpg') }}"><source src="{{ $value.video }}" type="video/mp4"></video>
3+
<video controls preload="metadata" poster="{{ $value.video.replace('.mp4', '.jpg') }}"><source src="{{ $value.video }}" type="video/mp4"></video>
44
{{ else }}
55
<figure><img src="{{ $value.href }}" alt="{{ $value.title }}"><figcaption>{{ $value.title }}</figcaption></figure>
66
{{ /if }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<video controls preload="none" poster="{{ poster }}">
1+
<video controls preload="metadata" poster="{{ poster }}">
22
<source src="{{ video }}" type="{{ type }}">
33
</video>

lib/routes/pikabu/templates/video.art

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{ if videoId }}
22
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube-nocookie.com/embed/{{ videoId }}" frameborder="0" allowfullscreen></iframe>
33
{{ else if webm || mp4 }}
4-
<video controls preload="none" poster="{{ preview }}" width="{{ width }}">
4+
<video controls preload="metadata" poster="{{ preview }}" width="{{ width }}">
55
{{ if webm }}<source src="{{ webm }}" type="video/webm">{{ /if }}
66
{{ if mp4 }}<source src="{{ mp4 }}" type="video/mp4">{{ /if }}
77
</video>

lib/routes/pornhub/templates/description.art

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ if previewVideo }}
2-
<video controls preload="none" poster="{{ poster }}">
2+
<video controls preload="metadata" poster="{{ poster }}">
33
<source src="{{ previewVideo }}" type="video/webm">
44
</video>
55
{{ /if }}

lib/routes/sina/templates/video.art

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ if videoUrl }}
2-
<video controls poster="{{ poster }}" preload="none">
2+
<video controls poster="{{ poster }}" preload="metadata">
33
<source src="{{ videoUrl }}">
44
</video>
55
{{ /if }}

lib/routes/tiktok/templates/user.art

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{ if useIframe }}
22
<iframe src="https://www.tiktok.com/embed/{{ id }}" height="757" frameborder="0" referrerpolicy="no-referrer"></iframe>
33
{{ else }}
4-
<video controls loop poster="{{ poster }}" preload="none">
4+
<video controls loop poster="{{ poster }}" preload="metadata">
55
<source src="{{ source }}">
66
</video>
77
{{ /if }}

lib/routes/zhihu/topic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ async function handler(ctx) {
107107
case 'zvideo':
108108
title = item.title;
109109
description = `${item.description}<br>
110-
<video controls poster="${item.video.thumbnail}" preload="none">
110+
<video controls poster="${item.video.thumbnail}" preload="metadata">
111111
<source src="${item.video.playlist.fhd?.url ?? item.video.playlist.hd?.url ?? item.video.playlist.ld?.url ?? item.video.playlist.sd?.url}" type="video/mp4">
112112
</video>`;
113113
link = item.url;

0 commit comments

Comments
 (0)