diff --git a/src/components/common/helpers/mediaDimensions.ts b/src/components/common/helpers/mediaDimensions.ts index 9334b45c..7c8ce84c 100644 --- a/src/components/common/helpers/mediaDimensions.ts +++ b/src/components/common/helpers/mediaDimensions.ts @@ -9,7 +9,7 @@ import { getPhotoInlineDimensions, getVideoDimensions } from '../../../modules/h export const MEDIA_VIEWER_MEDIA_QUERY = '(max-height: 640px)'; export const REM = parseInt(getComputedStyle(document.documentElement).fontSize, 10); -export const ROUND_VIDEO_DIMENSIONS = 240; +export const ROUND_VIDEO_DIMENSIONS_PX = 240; export const GIF_MIN_WIDTH = 300; export const AVATAR_FULL_DIMENSIONS = { width: 640, height: 640 }; export const LIKE_STICKER_ID = '1258816259753933'; diff --git a/src/components/middle/message/Message.tsx b/src/components/middle/message/Message.tsx index 650a53f6..77f83968 100644 --- a/src/components/middle/message/Message.tsx +++ b/src/components/middle/message/Message.tsx @@ -64,7 +64,7 @@ import buildClassName from '../../../util/buildClassName'; import useEnsureMessage from '../../../hooks/useEnsureMessage'; import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers'; import { renderMessageText } from '../../common/helpers/renderMessageText'; -import { ROUND_VIDEO_DIMENSIONS } from '../../common/helpers/mediaDimensions'; +import { ROUND_VIDEO_DIMENSIONS_PX } from '../../common/helpers/mediaDimensions'; import { buildContentClassName, isEmojiOnlyMessage } from './helpers/buildContentClassName'; import { getMinMediaWidth, calculateMediaDimensions } from './helpers/mediaDimensions'; import { calculateAlbumLayout } from './helpers/calculateAlbumLayout'; @@ -428,7 +428,7 @@ const Message: FC = ({ width = calculateMediaDimensions(message, noAvatars).width; } else if (video) { if (video.isRound) { - width = ROUND_VIDEO_DIMENSIONS; + width = ROUND_VIDEO_DIMENSIONS_PX; } else { width = calculateMediaDimensions(message, noAvatars).width; } diff --git a/src/components/middle/message/RoundVideo.tsx b/src/components/middle/message/RoundVideo.tsx index fa80bc75..5d4f1a86 100644 --- a/src/components/middle/message/RoundVideo.tsx +++ b/src/components/middle/message/RoundVideo.tsx @@ -9,7 +9,7 @@ import { getDispatch } from '../../../lib/teact/teactn'; import { ApiMediaFormat, ApiMessage } from '../../../api/types'; -import { ROUND_VIDEO_DIMENSIONS } from '../../common/helpers/mediaDimensions'; +import { ROUND_VIDEO_DIMENSIONS_PX } from '../../common/helpers/mediaDimensions'; import { formatMediaDuration } from '../../../util/dateFormat'; import { getMessageMediaFormat, getMessageMediaHash } from '../../../modules/helpers'; import { ObserveFn, useIsIntersecting } from '../../../hooks/useIntersectionObserver'; @@ -105,7 +105,9 @@ const RoundVideo: FC = ({ return; } - const circumference = 94 * 2 * Math.PI; + const svgCenter = ROUND_VIDEO_DIMENSIONS_PX / 2; + const svgMargin = 6; + const circumference = (svgCenter - svgMargin) * 2 * Math.PI; const strokeDashOffset = circumference - progress * circumference; const playerEl = playerRef.current!; @@ -113,8 +115,10 @@ const RoundVideo: FC = ({ const svgEl = playingProgressEl.firstElementChild; if (!svgEl) { - playingProgressEl.innerHTML = ` - + @@ -208,7 +212,7 @@ const RoundVideo: FC = ({ ref={thumbRef} className="thumbnail" // @ts-ignore teact feature - style={`width: ${ROUND_VIDEO_DIMENSIONS}px; height: ${ROUND_VIDEO_DIMENSIONS}px`} + style={`width: ${ROUND_VIDEO_DIMENSIONS_PX}px; height: ${ROUND_VIDEO_DIMENSIONS_PX}px`} /> )} @@ -218,8 +222,8 @@ const RoundVideo: FC = ({