diff --git a/src/components/middle/AudioPlayer.tsx b/src/components/middle/AudioPlayer.tsx index 68bab1651..f4a79db61 100644 --- a/src/components/middle/AudioPlayer.tsx +++ b/src/components/middle/AudioPlayer.tsx @@ -1,13 +1,14 @@ -import type { FC } from '../../lib/teact/teact'; import React, { useCallback, useEffect, useMemo } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; +import type { FC } from '../../lib/teact/teact'; import type { AudioOrigin } from '../../types'; import type { ApiAudio, ApiChat, ApiMessage, ApiUser, } from '../../api/types'; import { IS_IOS, IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../util/environment'; +import { PLAYBACK_RATE_FOR_AUDIO_MIN_DURATION } from '../../config'; import * as mediaLoader from '../../util/mediaLoader'; import { @@ -67,6 +68,7 @@ const AudioPlayer: FC = ({ const lang = useLang(); const { audio, voice, video } = getMessageContent(message); const isVoice = Boolean(voice || video); + const shouldRenderPlaybackButton = isVoice || (audio?.duration || 0) > PLAYBACK_RATE_FOR_AUDIO_MIN_DURATION; const senderName = sender ? getSenderTitle(lang, sender) : undefined; const mediaData = mediaLoader.getFromMemory(getMessageMediaHash(message, 'inline')!) as (string | undefined); const mediaMetadata = useMessageMediaMetadata(message, sender, chat); @@ -220,7 +222,7 @@ const AudioPlayer: FC = ({ )} - {isVoice && ( + {shouldRenderPlaybackButton && (