diff --git a/src/components/Stream.astro b/src/components/Stream.astro index 415554d9a8e52b..5ff964f85654f5 100644 --- a/src/components/Stream.astro +++ b/src/components/Stream.astro @@ -2,10 +2,10 @@ interface Props { videoId: string; videoTitle: string; - thumbnailStartTime: string; + thumbnailTimeOrURL: string; } -const { videoId, videoTitle, thumbnailStartTime } = Astro.props; +const { videoId, videoTitle, thumbnailTimeOrURL } = Astro.props; const customerId = "1mwganm1ma0xgnmj"; const baseUrl = `https://customer-${customerId}.cloudflarestream.com/`; @@ -14,11 +14,18 @@ const url = new URL(`${videoId}/iframe`, baseUrl); url.searchParams.set("preload", "true"); url.searchParams.set("letterboxColor", "transparent"); -const thumbnailUrl = new URL(`${videoId}/thumbnails/thumbnail.jpg`, baseUrl); -thumbnailUrl.searchParams.set("fit", "crop"); -thumbnailUrl.searchParams.set("time", thumbnailStartTime); -url.searchParams.set("poster", encodeURI(thumbnailUrl.toString())); +// full url option +if (!thumbnailTimeOrURL.startsWith("http")) { + const thumbnailUrl = new URL(`${videoId}/thumbnails/thumbnail.jpg`, baseUrl); + thumbnailUrl.searchParams.set("fit", "crop"); + thumbnailUrl.searchParams.set("time", thumbnailTimeOrURL); + + url.searchParams.set("poster", encodeURI(thumbnailUrl.toString())); +} else { + url.searchParams.set("poster", thumbnailTimeOrURL); +} + ---