[Perf] Avatar: Temporarly disable video avatars

This commit is contained in:
Alexander Zinchuk 2022-09-14 13:57:19 +02:00
parent 24d0289401
commit 78f37836b2
4 changed files with 11 additions and 5 deletions

View File

@ -6,10 +6,10 @@ import { withGlobal } from '../../../global';
import type { ApiChat, ApiUser } from '../../../api/types';
import { GROUP_CALL_THUMB_VIDEO_DISABLED } from '../../../config';
import buildClassName from '../../../util/buildClassName';
import { selectChat, selectUser } from '../../../global/selectors';
import useLang from '../../../hooks/useLang';
import { ENABLE_THUMBNAIL_VIDEO } from '../../../config';
import Avatar from '../../common/Avatar';
@ -61,7 +61,7 @@ const GroupCallParticipantVideo: FC<OwnProps & StateProps> = ({
</button>
)}
<Avatar user={user} chat={chat} className="thumbnail-avatar" />
{ENABLE_THUMBNAIL_VIDEO && (
{!GROUP_CALL_THUMB_VIDEO_DISABLED && (
<div className="thumbnail-wrapper">
<video className="thumbnail" muted autoPlay playsInline srcObject={streams?.[type]} />
</div>

View File

@ -13,6 +13,7 @@ import type { AnimationLevel } from '../../types';
import { ApiMediaFormat } from '../../api/types';
import { ANIMATION_LEVEL_MAX, IS_TEST } from '../../config';
import { VIDEO_AVATARS_DISABLED } from '../../util/environment';
import {
getChatAvatarHash,
getChatTitle,
@ -87,8 +88,10 @@ const Avatar: FC<OwnProps> = ({
let imageHash: string | undefined;
let videoHash: string | undefined;
const shouldShowVideo = isIntersecting && animationLevel === ANIMATION_LEVEL_MAX && withVideo && user?.isPremium
&& user?.hasVideoAvatar;
const shouldShowVideo = (
!VIDEO_AVATARS_DISABLED && animationLevel === ANIMATION_LEVEL_MAX
&& isIntersecting && withVideo && user?.isPremium && user?.hasVideoAvatar
);
const profilePhoto = user?.fullInfo?.profilePhoto;
const shouldLoadVideo = shouldShowVideo && profilePhoto?.isVideo;

View File

@ -223,7 +223,7 @@ export const MAX_UPLOAD_FILEPART_SIZE = 524288;
// Group calls
export const GROUP_CALL_VOLUME_MULTIPLIER = 100;
export const GROUP_CALL_DEFAULT_VOLUME = 100 * GROUP_CALL_VOLUME_MULTIPLIER;
export const ENABLE_THUMBNAIL_VIDEO = false;
export const GROUP_CALL_THUMB_VIDEO_DISABLED = true;
export const DEFAULT_LIMITS: Record<ApiLimitType, readonly [number, number]> = {
uploadMaxFileparts: [4000, 8000],

View File

@ -118,6 +118,9 @@ export const MESSAGE_LIST_SENSITIVE_AREA = IS_SCROLL_PATCH_NEEDED ? 300 : 750;
export const MAX_BUFFER_SIZE = (IS_ANDROID || IS_IOS ? 512 : 2000) * 1024 ** 2; // 512 OR 2000 MB
// TODO Turn on later as `!IS_IOS && !IS_ANDROID`
export const VIDEO_AVATARS_DISABLED = true;
function isLastEmojiVersionSupported() {
const ALLOWABLE_CALCULATION_ERROR_SIZE = 5;
const inlineEl = document.createElement('span');