diff --git a/src/components/media.jsx b/src/components/media.jsx index f0390458..52509532 100644 --- a/src/components/media.jsx +++ b/src/components/media.jsx @@ -328,6 +328,7 @@ function Media({ const formattedDuration = formatDuration(original.duration); const hoverAnimate = !showOriginal && !autoAnimate && isGIF; const autoGIFAnimate = !showOriginal && autoAnimate && isGIF; + const showProgress = original.duration > 5; const videoHTML = ` `; @@ -431,6 +437,22 @@ function Media({ playsinline loop muted + onTimeUpdate={ + showProgress + ? (e) => { + const { target } = e; + const container = target?.closest('.media-gif'); + if (container) { + const percentage = + (target.currentTime / target.duration) * 100; + container.style.setProperty( + '--progress', + `${percentage}%`, + ); + } + } + : undefined + } /> ) : ( <> diff --git a/src/components/status.css b/src/components/status.css index 0fd1890b..e110e1af 100644 --- a/src/components/status.css +++ b/src/components/status.css @@ -940,6 +940,28 @@ body:has(#modal-container .carousel) .status .media img:hover { border-radius: 4px; padding: 0 4px; } +.media-gif { + position: relative; + + &:before { + content: ''; + position: absolute; + top: auto !important; + bottom: 0; + left: 0; + right: 0; + height: 2px; + background-color: var(--media-outline-color); + transform: translateX(calc(var(--progress, 0%) - 100%)); + border-radius: 0 !important; + border: 0 !important; + border-right: 1px solid var(--media-fg-color) !important; + transition: transform 0.15s linear; + } + &:before { + height: 3px; + } +} .status .media-gif video { object-fit: cover; pointer-events: none;