Fix unknown media not working
This commit is contained in:
parent
61e1a5042f
commit
f02cd50d7b
|
@ -103,7 +103,11 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
|||
[to],
|
||||
);
|
||||
|
||||
const isImage = type === 'image' || (type === 'unknown' && previewUrl);
|
||||
const isVideoMaybe =
|
||||
type === 'unknown' &&
|
||||
/\.(mp4|m4a|m4p|m4b|m4r|m4v|mov|webm)$/i.test(remoteMediaURL);
|
||||
const isImage =
|
||||
type === 'image' || (type === 'unknown' && previewUrl && !isVideoMaybe);
|
||||
|
||||
const parentRef = useRef();
|
||||
const [imageSmallerThanParent, setImageSmallerThanParent] = useState(false);
|
||||
|
@ -221,7 +225,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
|||
)}
|
||||
</Parent>
|
||||
);
|
||||
} else if (type === 'gifv' || type === 'video') {
|
||||
} else if (type === 'gifv' || type === 'video' || isVideoMaybe) {
|
||||
const shortDuration = original.duration < 31;
|
||||
const isGIF = type === 'gifv' && shortDuration;
|
||||
// If GIF is too long, treat it as a video
|
||||
|
|
|
@ -779,7 +779,7 @@ body:has(#modal-container .carousel) .status .media img:hover {
|
|||
position: relative;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
.status :is(.media-video, .media-audio)[data-formatted-duration] .media-play {
|
||||
.status :is(.media-video, .media-audio) .media-play {
|
||||
pointer-events: none;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
|
@ -797,9 +797,7 @@ body:has(#modal-container .carousel) .status .media img:hover {
|
|||
border-radius: 70px;
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
.status
|
||||
:is(.media-video, .media-audio)[data-formatted-duration]:hover:not(:active)
|
||||
.media-play {
|
||||
.status :is(.media-video, .media-audio):hover:not(:active) .media-play {
|
||||
transform: translate(-50%, -50%) scale(1.1);
|
||||
background-color: var(--bg-color);
|
||||
box-shadow: 0 0 16px var(--drop-shadow-color),
|
||||
|
|
Loading…
Reference in a new issue