Skip to content

Commit 9090fd5

Browse files
authored
fix: allow 0 as a valid time value for poster thumbnails (#432)
Previously, passing `time = 0` (intending to fetch the first frame of the video) was ignored because the code used a truthy check (`if (time)`). Since `0` is falsy in JavaScript, the `time` param was not included in the request, causing Mux to fall back to its default thumbnail time. This commit updates the condition to check explicitly for `undefined` instead of falsiness. As a result, `0` is now correctly passed through as a valid value, while `undefined` continues to omit the `time` parameter. Signed-off-by: Stefan Göllner <[email protected]>
1 parent 5d03267 commit 9090fd5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/getPosterSrc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function getPosterSrc({
1818
width,
1919
}: PosterSrcOptions): MuxThumbnailUrl {
2020
const params = {fit_mode, height, width}
21-
if (time) {
21+
if (time !== undefined) {
2222
;(params as any).time = time
2323
}
2424

0 commit comments

Comments
 (0)