Avatar: Fix unexpected video avatars (#2413)

This commit is contained in:
Alexander Zinchuk 2023-01-30 15:55:32 +01:00
parent 5b225c0fa7
commit 847139e7ce

View File

@ -124,7 +124,8 @@ const Avatar: FC<OwnProps> = ({
const imgBlobUrl = useMedia(imageHash, false, ApiMediaFormat.BlobUrl, lastSyncTime);
const videoBlobUrl = useMedia(videoHash, !shouldLoadVideo, ApiMediaFormat.BlobUrl, lastSyncTime);
const hasBlobUrl = Boolean(imgBlobUrl || videoBlobUrl);
const shouldPlayVideo = Boolean(isIntersecting && videoBlobUrl);
// `videoBlobUrl` can be taken from memory cache, so we need to check `shouldLoadVideo` again
const shouldPlayVideo = Boolean(isIntersecting && videoBlobUrl && shouldLoadVideo);
const { transitionClassNames } = useShowTransition(hasBlobUrl, undefined, hasBlobUrl, 'slow');