Show local speaking indicator for group calls
This commit is contained in:
parent
dbb732e7cf
commit
41b4cce6ec
14 changed files with 87 additions and 32 deletions
|
@ -4291,17 +4291,10 @@ button.module-image__border-overlay:focus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&--audio-muted::before {
|
.CallingAudioIndicator {
|
||||||
@include color-svg(
|
|
||||||
'../images/icons/v2/mic-off-solid-28.svg',
|
|
||||||
$color-white
|
|
||||||
);
|
|
||||||
bottom: 6px;
|
bottom: 6px;
|
||||||
content: '';
|
|
||||||
height: 14px;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 6px;
|
right: 6px;
|
||||||
width: 14px;
|
|
||||||
z-index: $z-index-base;
|
z-index: $z-index-base;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
// Copyright 2020-2021 Signal Messenger, LLC
|
// Copyright 2020-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
export const AUDIO_LEVEL_INTERVAL_MS = 250;
|
||||||
|
export const AUDIO_LEVEL_FOR_SPEAKING = 0.25;
|
||||||
|
|
||||||
export const REQUESTED_VIDEO_WIDTH = 640;
|
export const REQUESTED_VIDEO_WIDTH = 640;
|
||||||
export const REQUESTED_VIDEO_HEIGHT = 480;
|
export const REQUESTED_VIDEO_HEIGHT = 480;
|
||||||
export const REQUESTED_VIDEO_FRAMERATE = 30;
|
export const REQUESTED_VIDEO_FRAMERATE = 30;
|
||||||
|
|
|
@ -50,6 +50,7 @@ const getCommonActiveCallData = () => ({
|
||||||
joinedAt: Date.now(),
|
joinedAt: Date.now(),
|
||||||
hasLocalAudio: boolean('hasLocalAudio', true),
|
hasLocalAudio: boolean('hasLocalAudio', true),
|
||||||
hasLocalVideo: boolean('hasLocalVideo', false),
|
hasLocalVideo: boolean('hasLocalVideo', false),
|
||||||
|
amISpeaking: boolean('amISpeaking', false),
|
||||||
isInSpeakerView: boolean('isInSpeakerView', false),
|
isInSpeakerView: boolean('isInSpeakerView', false),
|
||||||
outgoingRing: boolean('outgoingRing', true),
|
outgoingRing: boolean('outgoingRing', true),
|
||||||
pip: boolean('pip', false),
|
pip: boolean('pip', false),
|
||||||
|
|
|
@ -44,6 +44,7 @@ const conversation = getDefaultConversation({
|
||||||
type OverridePropsBase = {
|
type OverridePropsBase = {
|
||||||
hasLocalAudio?: boolean;
|
hasLocalAudio?: boolean;
|
||||||
hasLocalVideo?: boolean;
|
hasLocalVideo?: boolean;
|
||||||
|
amISpeaking?: boolean;
|
||||||
isInSpeakerView?: boolean;
|
isInSpeakerView?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -120,6 +121,7 @@ const createActiveCallProp = (
|
||||||
'hasLocalVideo',
|
'hasLocalVideo',
|
||||||
overrideProps.hasLocalVideo || false
|
overrideProps.hasLocalVideo || false
|
||||||
),
|
),
|
||||||
|
amISpeaking: boolean('amISpeaking', overrideProps.amISpeaking || false),
|
||||||
isInSpeakerView: boolean(
|
isInSpeakerView: boolean(
|
||||||
'isInSpeakerView',
|
'isInSpeakerView',
|
||||||
overrideProps.isInSpeakerView || false
|
overrideProps.isInSpeakerView || false
|
||||||
|
|
|
@ -38,6 +38,7 @@ import { NeedsScreenRecordingPermissionsModal } from './NeedsScreenRecordingPerm
|
||||||
import { missingCaseError } from '../util/missingCaseError';
|
import { missingCaseError } from '../util/missingCaseError';
|
||||||
import * as KeyboardLayout from '../services/keyboardLayout';
|
import * as KeyboardLayout from '../services/keyboardLayout';
|
||||||
import { useActivateSpeakerViewOnPresenting } from '../hooks/useActivateSpeakerViewOnPresenting';
|
import { useActivateSpeakerViewOnPresenting } from '../hooks/useActivateSpeakerViewOnPresenting';
|
||||||
|
import { CallingAudioIndicator } from './CallingAudioIndicator';
|
||||||
|
|
||||||
export type PropsType = {
|
export type PropsType = {
|
||||||
activeCall: ActiveCallType;
|
activeCall: ActiveCallType;
|
||||||
|
@ -125,6 +126,7 @@ export const CallScreen: React.FC<PropsType> = ({
|
||||||
conversation,
|
conversation,
|
||||||
hasLocalAudio,
|
hasLocalAudio,
|
||||||
hasLocalVideo,
|
hasLocalVideo,
|
||||||
|
amISpeaking,
|
||||||
isInSpeakerView,
|
isInSpeakerView,
|
||||||
presentingSource,
|
presentingSource,
|
||||||
remoteParticipants,
|
remoteParticipants,
|
||||||
|
@ -501,13 +503,12 @@ export const CallScreen: React.FC<PropsType> = ({
|
||||||
onClick={hangUpActiveCall}
|
onClick={hangUpActiveCall}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div className="module-ongoing-call__footer__local-preview">
|
||||||
className={classNames('module-ongoing-call__footer__local-preview', {
|
|
||||||
'module-ongoing-call__footer__local-preview--audio-muted':
|
|
||||||
!hasLocalAudio,
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
{localPreviewNode}
|
{localPreviewNode}
|
||||||
|
<CallingAudioIndicator
|
||||||
|
hasAudio={hasLocalAudio}
|
||||||
|
isSpeaking={amISpeaking}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,25 +1,41 @@
|
||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
import { noop } from 'lodash';
|
||||||
import type { ReactElement } from 'react';
|
import type { ReactElement } from 'react';
|
||||||
import React from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import animationData from '../../images/lottie-animations/CallingSpeakingIndicator.json';
|
import animationData from '../../images/lottie-animations/CallingSpeakingIndicator.json';
|
||||||
import { Lottie } from './Lottie';
|
import { Lottie } from './Lottie';
|
||||||
|
|
||||||
|
const SPEAKING_LINGER_MS = 100;
|
||||||
|
|
||||||
export function CallingAudioIndicator({
|
export function CallingAudioIndicator({
|
||||||
hasRemoteAudio,
|
hasAudio,
|
||||||
isSpeaking,
|
isSpeaking,
|
||||||
}: Readonly<{
|
}: Readonly<{ hasAudio: boolean; isSpeaking: boolean }>): ReactElement {
|
||||||
hasRemoteAudio: boolean;
|
const [shouldShowSpeaking, setShouldShowSpeaking] = useState(isSpeaking);
|
||||||
isSpeaking: boolean;
|
|
||||||
}>): ReactElement {
|
useEffect(() => {
|
||||||
if (!hasRemoteAudio) {
|
if (isSpeaking) {
|
||||||
|
setShouldShowSpeaking(true);
|
||||||
|
} else if (shouldShowSpeaking) {
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
setShouldShowSpeaking(false);
|
||||||
|
}, SPEAKING_LINGER_MS);
|
||||||
|
return () => {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return noop;
|
||||||
|
}, [isSpeaking, shouldShowSpeaking]);
|
||||||
|
|
||||||
|
if (!hasAudio) {
|
||||||
return (
|
return (
|
||||||
<div className="CallingAudioIndicator CallingAudioIndicator--muted" />
|
<div className="CallingAudioIndicator CallingAudioIndicator--muted" />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSpeaking) {
|
if (shouldShowSpeaking) {
|
||||||
return (
|
return (
|
||||||
<Lottie animationData={animationData} className="CallingAudioIndicator" />
|
<Lottie animationData={animationData} className="CallingAudioIndicator" />
|
||||||
);
|
);
|
||||||
|
|
|
@ -39,6 +39,7 @@ const getCommonActiveCallData = () => ({
|
||||||
conversation,
|
conversation,
|
||||||
hasLocalAudio: boolean('hasLocalAudio', true),
|
hasLocalAudio: boolean('hasLocalAudio', true),
|
||||||
hasLocalVideo: boolean('hasLocalVideo', false),
|
hasLocalVideo: boolean('hasLocalVideo', false),
|
||||||
|
amISpeaking: boolean('amISpeaking', false),
|
||||||
isInSpeakerView: boolean('isInSpeakerView', false),
|
isInSpeakerView: boolean('isInSpeakerView', false),
|
||||||
joinedAt: Date.now(),
|
joinedAt: Date.now(),
|
||||||
outgoingRing: true,
|
outgoingRing: true,
|
||||||
|
|
|
@ -285,7 +285,7 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
|
||||||
title={title}
|
title={title}
|
||||||
/>
|
/>
|
||||||
<CallingAudioIndicator
|
<CallingAudioIndicator
|
||||||
hasRemoteAudio={hasRemoteAudio}
|
hasAudio={hasRemoteAudio}
|
||||||
isSpeaking={props.isSpeaking}
|
isSpeaking={props.isSpeaking}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -82,6 +82,7 @@ import type { ProcessedEnvelope } from '../textsecure/Types.d';
|
||||||
import { missingCaseError } from '../util/missingCaseError';
|
import { missingCaseError } from '../util/missingCaseError';
|
||||||
import { normalizeGroupCallTimestamp } from '../util/ringrtc/normalizeGroupCallTimestamp';
|
import { normalizeGroupCallTimestamp } from '../util/ringrtc/normalizeGroupCallTimestamp';
|
||||||
import {
|
import {
|
||||||
|
AUDIO_LEVEL_INTERVAL_MS,
|
||||||
REQUESTED_VIDEO_WIDTH,
|
REQUESTED_VIDEO_WIDTH,
|
||||||
REQUESTED_VIDEO_HEIGHT,
|
REQUESTED_VIDEO_HEIGHT,
|
||||||
REQUESTED_VIDEO_FRAMERATE,
|
REQUESTED_VIDEO_FRAMERATE,
|
||||||
|
@ -624,7 +625,7 @@ export class CallingClass {
|
||||||
groupIdBuffer,
|
groupIdBuffer,
|
||||||
this.sfuUrl,
|
this.sfuUrl,
|
||||||
Buffer.alloc(0),
|
Buffer.alloc(0),
|
||||||
500,
|
AUDIO_LEVEL_INTERVAL_MS,
|
||||||
{
|
{
|
||||||
onLocalDeviceStateChanged: groupCall => {
|
onLocalDeviceStateChanged: groupCall => {
|
||||||
const localDeviceState = groupCall.getLocalDeviceState();
|
const localDeviceState = groupCall.getLocalDeviceState();
|
||||||
|
@ -677,9 +678,11 @@ export class CallingClass {
|
||||||
if (!remoteDeviceStates) {
|
if (!remoteDeviceStates) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const localAudioLevel = groupCall.getLocalDeviceState().audioLevel;
|
||||||
|
|
||||||
this.uxActions?.groupCallAudioLevelsChange({
|
this.uxActions?.groupCallAudioLevelsChange({
|
||||||
conversationId,
|
conversationId,
|
||||||
|
localAudioLevel,
|
||||||
remoteDeviceStates,
|
remoteDeviceStates,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -1971,7 +1974,7 @@ export class CallingClass {
|
||||||
hideIp: shouldRelayCalls || isContactUnknown,
|
hideIp: shouldRelayCalls || isContactUnknown,
|
||||||
bandwidthMode: BandwidthMode.Normal,
|
bandwidthMode: BandwidthMode.Normal,
|
||||||
// TODO: DESKTOP-3101
|
// TODO: DESKTOP-3101
|
||||||
// audioLevelsIntervalMillis: 500,
|
// audioLevelsIntervalMillis: AUDIO_LEVEL_INTERVAL_MS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { getPlatform } from '../selectors/user';
|
||||||
import { isConversationTooBigToRing } from '../../conversations/isConversationTooBigToRing';
|
import { isConversationTooBigToRing } from '../../conversations/isConversationTooBigToRing';
|
||||||
import { missingCaseError } from '../../util/missingCaseError';
|
import { missingCaseError } from '../../util/missingCaseError';
|
||||||
import { calling } from '../../services/calling';
|
import { calling } from '../../services/calling';
|
||||||
|
import { AUDIO_LEVEL_FOR_SPEAKING } from '../../calling/constants';
|
||||||
import type { StateType as RootStateType } from '../reducer';
|
import type { StateType as RootStateType } from '../reducer';
|
||||||
import type {
|
import type {
|
||||||
ChangeIODevicePayloadType,
|
ChangeIODevicePayloadType,
|
||||||
|
@ -102,6 +103,7 @@ export type ActiveCallStateType = {
|
||||||
conversationId: string;
|
conversationId: string;
|
||||||
hasLocalAudio: boolean;
|
hasLocalAudio: boolean;
|
||||||
hasLocalVideo: boolean;
|
hasLocalVideo: boolean;
|
||||||
|
amISpeaking: boolean;
|
||||||
isInSpeakerView: boolean;
|
isInSpeakerView: boolean;
|
||||||
joinedAt?: number;
|
joinedAt?: number;
|
||||||
outgoingRing: boolean;
|
outgoingRing: boolean;
|
||||||
|
@ -463,6 +465,7 @@ type DeclineCallActionType = {
|
||||||
|
|
||||||
type GroupCallAudioLevelsChangeActionPayloadType = Readonly<{
|
type GroupCallAudioLevelsChangeActionPayloadType = Readonly<{
|
||||||
conversationId: string;
|
conversationId: string;
|
||||||
|
localAudioLevel: number;
|
||||||
remoteDeviceStates: ReadonlyArray<{ audioLevel: number; demuxId: number }>;
|
remoteDeviceStates: ReadonlyArray<{ audioLevel: number; demuxId: number }>;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
@ -1431,6 +1434,7 @@ export function reducer(
|
||||||
conversationId: action.payload.conversationId,
|
conversationId: action.payload.conversationId,
|
||||||
hasLocalAudio: action.payload.hasLocalAudio,
|
hasLocalAudio: action.payload.hasLocalAudio,
|
||||||
hasLocalVideo: action.payload.hasLocalVideo,
|
hasLocalVideo: action.payload.hasLocalVideo,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
pip: false,
|
pip: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
@ -1458,6 +1462,7 @@ export function reducer(
|
||||||
conversationId: action.payload.conversationId,
|
conversationId: action.payload.conversationId,
|
||||||
hasLocalAudio: action.payload.hasLocalAudio,
|
hasLocalAudio: action.payload.hasLocalAudio,
|
||||||
hasLocalVideo: action.payload.hasLocalVideo,
|
hasLocalVideo: action.payload.hasLocalVideo,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
pip: false,
|
pip: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
@ -1480,6 +1485,7 @@ export function reducer(
|
||||||
conversationId: action.payload.conversationId,
|
conversationId: action.payload.conversationId,
|
||||||
hasLocalAudio: true,
|
hasLocalAudio: true,
|
||||||
hasLocalVideo: action.payload.asVideoCall,
|
hasLocalVideo: action.payload.asVideoCall,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
pip: false,
|
pip: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
@ -1633,6 +1639,7 @@ export function reducer(
|
||||||
conversationId: action.payload.conversationId,
|
conversationId: action.payload.conversationId,
|
||||||
hasLocalAudio: action.payload.hasLocalAudio,
|
hasLocalAudio: action.payload.hasLocalAudio,
|
||||||
hasLocalVideo: action.payload.hasLocalVideo,
|
hasLocalVideo: action.payload.hasLocalVideo,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
pip: false,
|
pip: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
@ -1690,24 +1697,36 @@ export function reducer(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.type === GROUP_CALL_AUDIO_LEVELS_CHANGE) {
|
if (action.type === GROUP_CALL_AUDIO_LEVELS_CHANGE) {
|
||||||
const { conversationId, remoteDeviceStates } = action.payload;
|
const { conversationId, localAudioLevel, remoteDeviceStates } =
|
||||||
|
action.payload;
|
||||||
|
|
||||||
|
const { activeCallState } = state;
|
||||||
const existingCall = getGroupCall(conversationId, state);
|
const existingCall = getGroupCall(conversationId, state);
|
||||||
if (!existingCall) {
|
|
||||||
|
// The PiP check is an optimization. We don't need to update audio levels if the user
|
||||||
|
// cannot see them.
|
||||||
|
if (!activeCallState || activeCallState.pip || !existingCall) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const amISpeaking = localAudioLevel > AUDIO_LEVEL_FOR_SPEAKING;
|
||||||
|
|
||||||
const speakingDemuxIds = new Set<number>();
|
const speakingDemuxIds = new Set<number>();
|
||||||
remoteDeviceStates.forEach(({ audioLevel, demuxId }) => {
|
remoteDeviceStates.forEach(({ audioLevel, demuxId }) => {
|
||||||
// We expect `audioLevel` to be a number but have this check just in case.
|
// We expect `audioLevel` to be a number but have this check just in case.
|
||||||
if (typeof audioLevel === 'number' && audioLevel > 0.25) {
|
if (
|
||||||
|
typeof audioLevel === 'number' &&
|
||||||
|
audioLevel > AUDIO_LEVEL_FOR_SPEAKING
|
||||||
|
) {
|
||||||
speakingDemuxIds.add(demuxId);
|
speakingDemuxIds.add(demuxId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// This action is dispatched frequently. This equality check helps avoid re-renders.
|
// This action is dispatched frequently. This equality check helps avoid re-renders.
|
||||||
|
const oldAmISpeaking = activeCallState.amISpeaking;
|
||||||
const oldSpeakingDemuxIds = existingCall.speakingDemuxIds;
|
const oldSpeakingDemuxIds = existingCall.speakingDemuxIds;
|
||||||
if (
|
if (
|
||||||
|
oldAmISpeaking === amISpeaking &&
|
||||||
oldSpeakingDemuxIds &&
|
oldSpeakingDemuxIds &&
|
||||||
setUtil.isEqual(oldSpeakingDemuxIds, speakingDemuxIds)
|
setUtil.isEqual(oldSpeakingDemuxIds, speakingDemuxIds)
|
||||||
) {
|
) {
|
||||||
|
@ -1716,6 +1735,7 @@ export function reducer(
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
activeCallState: { ...activeCallState, amISpeaking },
|
||||||
callsByConversation: {
|
callsByConversation: {
|
||||||
...callsByConversation,
|
...callsByConversation,
|
||||||
[conversationId]: { ...existingCall, speakingDemuxIds },
|
[conversationId]: { ...existingCall, speakingDemuxIds },
|
||||||
|
|
|
@ -130,6 +130,7 @@ const mapStateToActiveCallProp = (
|
||||||
conversation,
|
conversation,
|
||||||
hasLocalAudio: activeCallState.hasLocalAudio,
|
hasLocalAudio: activeCallState.hasLocalAudio,
|
||||||
hasLocalVideo: activeCallState.hasLocalVideo,
|
hasLocalVideo: activeCallState.hasLocalVideo,
|
||||||
|
amISpeaking: activeCallState.amISpeaking,
|
||||||
isInSpeakerView: activeCallState.isInSpeakerView,
|
isInSpeakerView: activeCallState.isInSpeakerView,
|
||||||
joinedAt: activeCallState.joinedAt,
|
joinedAt: activeCallState.joinedAt,
|
||||||
outgoingRing: activeCallState.outgoingRing,
|
outgoingRing: activeCallState.outgoingRing,
|
||||||
|
|
|
@ -50,6 +50,7 @@ describe('calling duck', () => {
|
||||||
conversationId: 'fake-direct-call-conversation-id',
|
conversationId: 'fake-direct-call-conversation-id',
|
||||||
hasLocalAudio: true,
|
hasLocalAudio: true,
|
||||||
hasLocalVideo: false,
|
hasLocalVideo: false,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
showParticipantsList: false,
|
showParticipantsList: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
@ -128,6 +129,7 @@ describe('calling duck', () => {
|
||||||
conversationId: 'fake-group-call-conversation-id',
|
conversationId: 'fake-group-call-conversation-id',
|
||||||
hasLocalAudio: true,
|
hasLocalAudio: true,
|
||||||
hasLocalVideo: false,
|
hasLocalVideo: false,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
showParticipantsList: false,
|
showParticipantsList: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
@ -433,6 +435,7 @@ describe('calling duck', () => {
|
||||||
conversationId: 'fake-direct-call-conversation-id',
|
conversationId: 'fake-direct-call-conversation-id',
|
||||||
hasLocalAudio: true,
|
hasLocalAudio: true,
|
||||||
hasLocalVideo: true,
|
hasLocalVideo: true,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
showParticipantsList: false,
|
showParticipantsList: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
@ -525,6 +528,7 @@ describe('calling duck', () => {
|
||||||
conversationId: 'fake-group-call-conversation-id',
|
conversationId: 'fake-group-call-conversation-id',
|
||||||
hasLocalAudio: true,
|
hasLocalAudio: true,
|
||||||
hasLocalVideo: true,
|
hasLocalVideo: true,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
showParticipantsList: false,
|
showParticipantsList: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
@ -762,6 +766,7 @@ describe('calling duck', () => {
|
||||||
it("does nothing if there's no relevant call", () => {
|
it("does nothing if there's no relevant call", () => {
|
||||||
const action = groupCallAudioLevelsChange({
|
const action = groupCallAudioLevelsChange({
|
||||||
conversationId: 'garbage',
|
conversationId: 'garbage',
|
||||||
|
localAudioLevel: 1,
|
||||||
remoteDeviceStates,
|
remoteDeviceStates,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -784,6 +789,7 @@ describe('calling duck', () => {
|
||||||
};
|
};
|
||||||
const action = groupCallAudioLevelsChange({
|
const action = groupCallAudioLevelsChange({
|
||||||
conversationId: 'fake-group-call-conversation-id',
|
conversationId: 'fake-group-call-conversation-id',
|
||||||
|
localAudioLevel: 0.1,
|
||||||
remoteDeviceStates,
|
remoteDeviceStates,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -792,13 +798,16 @@ describe('calling duck', () => {
|
||||||
assert.strictEqual(result, state);
|
assert.strictEqual(result, state);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('updates the set of speaking participants', () => {
|
it('updates the set of speaking participants, including yourself', () => {
|
||||||
const action = groupCallAudioLevelsChange({
|
const action = groupCallAudioLevelsChange({
|
||||||
conversationId: 'fake-group-call-conversation-id',
|
conversationId: 'fake-group-call-conversation-id',
|
||||||
|
localAudioLevel: 0.8,
|
||||||
remoteDeviceStates,
|
remoteDeviceStates,
|
||||||
});
|
});
|
||||||
const result = reducer(stateWithActiveGroupCall, action);
|
const result = reducer(stateWithActiveGroupCall, action);
|
||||||
|
|
||||||
|
assert.isTrue(result.activeCallState?.amISpeaking);
|
||||||
|
|
||||||
const call =
|
const call =
|
||||||
result.callsByConversation['fake-group-call-conversation-id'];
|
result.callsByConversation['fake-group-call-conversation-id'];
|
||||||
if (call?.callMode !== CallMode.Group) {
|
if (call?.callMode !== CallMode.Group) {
|
||||||
|
@ -1100,6 +1109,7 @@ describe('calling duck', () => {
|
||||||
conversationId: 'fake-group-call-conversation-id',
|
conversationId: 'fake-group-call-conversation-id',
|
||||||
hasLocalAudio: true,
|
hasLocalAudio: true,
|
||||||
hasLocalVideo: false,
|
hasLocalVideo: false,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
showParticipantsList: false,
|
showParticipantsList: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
@ -1628,6 +1638,7 @@ describe('calling duck', () => {
|
||||||
conversationId: 'fake-conversation-id',
|
conversationId: 'fake-conversation-id',
|
||||||
hasLocalAudio: true,
|
hasLocalAudio: true,
|
||||||
hasLocalVideo: true,
|
hasLocalVideo: true,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
showParticipantsList: false,
|
showParticipantsList: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
@ -1913,6 +1924,7 @@ describe('calling duck', () => {
|
||||||
conversationId: 'fake-conversation-id',
|
conversationId: 'fake-conversation-id',
|
||||||
hasLocalAudio: true,
|
hasLocalAudio: true,
|
||||||
hasLocalVideo: false,
|
hasLocalVideo: false,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
showParticipantsList: false,
|
showParticipantsList: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2019-2021 Signal Messenger, LLC
|
// Copyright 2019-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
|
@ -51,6 +51,7 @@ describe('state/selectors/calling', () => {
|
||||||
conversationId: 'fake-direct-call-conversation-id',
|
conversationId: 'fake-direct-call-conversation-id',
|
||||||
hasLocalAudio: true,
|
hasLocalAudio: true,
|
||||||
hasLocalVideo: false,
|
hasLocalVideo: false,
|
||||||
|
amISpeaking: false,
|
||||||
isInSpeakerView: false,
|
isInSpeakerView: false,
|
||||||
showParticipantsList: false,
|
showParticipantsList: false,
|
||||||
safetyNumberChangedUuids: [],
|
safetyNumberChangedUuids: [],
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020-2021 Signal Messenger, LLC
|
// Copyright 2020-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { AudioDevice } from 'ringrtc';
|
import type { AudioDevice } from 'ringrtc';
|
||||||
|
@ -28,6 +28,7 @@ type ActiveCallBaseType = {
|
||||||
conversation: ConversationType;
|
conversation: ConversationType;
|
||||||
hasLocalAudio: boolean;
|
hasLocalAudio: boolean;
|
||||||
hasLocalVideo: boolean;
|
hasLocalVideo: boolean;
|
||||||
|
amISpeaking: boolean;
|
||||||
isInSpeakerView: boolean;
|
isInSpeakerView: boolean;
|
||||||
isSharingScreen?: boolean;
|
isSharingScreen?: boolean;
|
||||||
joinedAt?: number;
|
joinedAt?: number;
|
||||||
|
|
Loading…
Add table
Reference in a new issue