Skip to content

Commit f35809e

Browse files
committed
code update
1 parent ccd56b1 commit f35809e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/components/Stream.astro

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ url.searchParams.set("letterboxColor", "transparent");
1616
1717
1818
// full url option
19-
if (!thumbnailTimeOrURL.startsWith("http")) {
20-
const thumbnailUrl = new URL(`${videoId}/thumbnails/thumbnail.jpg`, baseUrl);
21-
thumbnailUrl.searchParams.set("fit", "crop");
22-
thumbnailUrl.searchParams.set("time", thumbnailTimeOrURL);
23-
24-
url.searchParams.set("poster", encodeURI(thumbnailUrl.toString()));
25-
} else {
26-
url.searchParams.set("poster", thumbnailTimeOrURL);
19+
if (thumbnailTimeOrURL !== undefined) {
20+
if (!thumbnailTimeOrURL.startsWith("http")) {
21+
const thumbnailUrl = new URL(`${videoId}/thumbnails/thumbnail.jpg`, baseUrl);
22+
thumbnailUrl.searchParams.set("fit", "crop");
23+
thumbnailUrl.searchParams.set("time", thumbnailTimeOrURL);
24+
25+
url.searchParams.set("poster", encodeURI(thumbnailUrl.toString()));
26+
} else {
27+
url.searchParams.set("poster", thumbnailTimeOrURL);
28+
}
2729
}
2830
2931
---

0 commit comments

Comments
 (0)