Maybe some videos are short

This commit is contained in:
Lim Chee Aun 2023-01-06 19:14:47 +08:00
parent ca18ea138a
commit 6d893967ec

View file

@ -756,7 +756,8 @@ function Media({ media, showOriginal, autoAnimate, onClick = () => {} }) {
} else if (type === 'gifv' || type === 'video') { } else if (type === 'gifv' || type === 'video') {
// 20 seconds, treat as a gif // 20 seconds, treat as a gif
const shortDuration = original.duration <= 20; const shortDuration = original.duration <= 20;
const isGIF = type === 'gifv' || shortDuration; const isGIFV = type === 'gifv';
const isGIF = isGIFV || shortDuration;
const loopable = original.duration <= 60; const loopable = original.duration <= 60;
const formattedDuration = formatDuration(original.duration); const formattedDuration = formatDuration(original.duration);
const hoverAnimate = !showOriginal && !autoAnimate && isGIF; const hoverAnimate = !showOriginal && !autoAnimate && isGIF;
@ -810,7 +811,7 @@ function Media({ media, showOriginal, autoAnimate, onClick = () => {} }) {
preload="auto" preload="auto"
autoplay autoplay
muted="${isGIF}" muted="${isGIF}"
${isGIF ? '' : 'controls'} ${isGIFV ? '' : 'controls'}
playsinline playsinline
loop="${loopable}" loop="${loopable}"
></video> ></video>