Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hard mute conditional compile - part 3 #5594

Merged
merged 10 commits into from
Jan 31, 2025
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "improvement",
"workstream": "Hard mute",
"comment": "Remove hard mute conditional compile - part 3",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "improvement",
"workstream": "Hard mute",
"comment": "Remove hard mute conditional compile - part 3",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3220,7 +3220,13 @@ export const DEFAULT_COMPOSITE_ICONS: {
CaptionsSettingsIcon: React_2.JSX.Element;
ChangeSpokenLanguageIcon: React_2.JSX.Element;
ChangeCaptionLanguageIcon: React_2.JSX.Element;
ContextMenuCameraIcon: React_2.JSX.Element;
ContextMenuCameraIcon: React_2.JSX.Element; /**
* Icons that can be overridden in one of the composites exported by this library.
*
* See {@link ChatCompositeIcons}, {@link CallCompositeIcons} and {@link CallWithChatCompositeIcons} for more targeted types.
*
* @public
*/
ContextMenuMicIcon: React_2.JSX.Element;
ContextMenuSpeakerIcon: React_2.JSX.Element;
ContextMenuRemoveParticipant: React_2.JSX.Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export const _LocalVideoTile = React.memo(
reactionResources?: ReactionResources;
participantsCount?: number;
isScreenSharingOn?: boolean;
/* @conditional-compile-remove(media-access) */
mediaAccess?: MediaAccess;
}) => {
const {
Expand Down Expand Up @@ -104,7 +103,6 @@ export const _LocalVideoTile = React.memo(
strings,
reactionResources,
isScreenSharingOn,
/* @conditional-compile-remove(media-access) */
mediaAccess
} = props;

Expand All @@ -118,7 +116,6 @@ export const _LocalVideoTile = React.memo(
onDisposeLocalStreamView,
renderElementExists: !!renderElement,
scalingMode: localVideoViewOptions?.scalingMode,
/* @conditional-compile-remove(media-access) */
isVideoPermitted: mediaAccess ? mediaAccess.isVideoPermitted : true
}),
[
Expand All @@ -128,7 +125,6 @@ export const _LocalVideoTile = React.memo(
onCreateLocalStreamView,
onDisposeLocalStreamView,
renderElement,
/* @conditional-compile-remove(media-access) */
mediaAccess
]
);
Expand Down Expand Up @@ -278,7 +274,7 @@ export const _LocalVideoTile = React.memo(
)
}
overlay={videoTileOverlay}
/* @conditional-compile-remove(media-access) */ mediaAccess={mediaAccess}
mediaAccess={mediaAccess}
>
{drawerMenuItemProps.length > 0 && (
<Layer hostId={props.drawerMenuHostId}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,26 +268,18 @@ export interface NotificationStackStrings {
* Message shown in notification when breakout room is closing soon
*/
breakoutRoomClosingSoon?: NotificationStrings;

/* @conditional-compile-remove(media-access) */
/**
* Message shown in notification when capability turnVideoOn is present
*/
capabilityTurnVideoOnPresent?: NotificationStrings;

/* @conditional-compile-remove(media-access) */
/**
* Message shown in notification when capability turnVideoOn is absent
*/
capabilityTurnVideoOnAbsent?: NotificationStrings;

/* @conditional-compile-remove(media-access) */
/**
* Message shown in notification when capability unMuteMic is present
*/
capabilityUnmuteMicPresent?: NotificationStrings;

/* @conditional-compile-remove(media-access) */
/**
* Message shown in notification when capability unMuteMic is absent
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ export interface ParticipantItemStrings {
participantItemWithMoreOptionsAriaLabel?: string;
/** String for the attendee role */
attendeeRole: string;
/* @conditional-compile-remove(media-access) */
/** Label for the disabled microphone icon in participant state stack */
micDisabledIconLabel: string;
/* @conditional-compile-remove(media-access) */
/** Label for the disabled camera icon in participant state stack */
cameraDisabledIconLabel: string;
}
Expand Down
63 changes: 18 additions & 45 deletions packages/react-components/src/components/ParticipantList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,29 +151,17 @@ const onRenderParticipantDefault = (
const displayName = formatDisplayName(participant.displayName);

const callingPalette = (theme as unknown as CallingTheme).callingPalette;

const isPinned = pinnedParticipants && pinnedParticipants?.includes(participant.userId);
const isScreenSharing = callingParticipant?.isScreenSharing;
const isMuted = callingParticipant?.isMuted;
const hasRaisedHand = callingParticipant?.raisedHand;
const isAudioPermitted = callingParticipant?.mediaAccess ? callingParticipant.mediaAccess.isAudioPermitted : true;
const isVideoPermitted = callingParticipant?.mediaAccess ? callingParticipant.mediaAccess.isVideoPermitted : true;

const showRenderIconTrampoline = (): boolean => {
/* @conditional-compile-remove(media-access) */
return !!(
callingParticipant?.isScreenSharing ||
callingParticipant?.isMuted ||
callingParticipant?.raisedHand ||
isPinned ||
!(callingParticipant?.mediaAccess ? callingParticipant.mediaAccess.isAudioPermitted : true) ||
!(callingParticipant?.mediaAccess ? callingParticipant.mediaAccess.isVideoPermitted : true)
);

return !!(
callingParticipant?.isScreenSharing ||
callingParticipant?.isMuted ||
callingParticipant?.raisedHand ||
isPinned
);
};
const shouldRenderParticipantIcon =
isScreenSharing || isMuted || hasRaisedHand || isPinned || !isAudioPermitted || !isVideoPermitted;

const onRenderIcon = showRenderIconTrampoline()
const onRenderIcon = shouldRenderParticipantIcon
? () => (
<Stack horizontal={true} tokens={{ childrenGap: '0.5rem' }}>
{callingParticipant.raisedHand && (
Expand Down Expand Up @@ -206,29 +194,16 @@ const onRenderParticipantDefault = (
)}
{callingParticipant.spotlight && <Icon iconName="ParticipantItemSpotlighted" className={iconStyles} />}
{isPinned && <Icon iconName="ParticipantItemPinned" className={iconStyles} />}
{
/* @conditional-compile-remove(media-access) */ callingParticipant.mediaAccess &&
!callingParticipant.mediaAccess.isVideoPermitted ? (
<Icon
iconName="ControlButtonCameraProhibited"
className={iconStyles}
ariaLabel={strings.mutedIconLabel}
/>
) : undefined
}
{
/* @conditional-compile-remove(media-access) */ callingParticipant.mediaAccess &&
!callingParticipant.mediaAccess?.isAudioPermitted ? (
<Icon iconName="ControlButtonMicProhibited" className={iconStyles} ariaLabel={strings.mutedIconLabel} />
) : undefined
}
{
/* @conditional-compile-remove(media-access) */ (callingParticipant.mediaAccess
? callingParticipant.mediaAccess.isAudioPermitted
: true) && callingParticipant.isMuted ? (
<Icon iconName="ParticipantItemMicOff" className={iconStyles} ariaLabel={strings.mutedIconLabel} />
) : undefined
}
{callingParticipant.mediaAccess && !callingParticipant.mediaAccess.isVideoPermitted ? (
<Icon iconName="ControlButtonCameraProhibited" className={iconStyles} ariaLabel={strings.mutedIconLabel} />
) : undefined}
{callingParticipant.mediaAccess && !callingParticipant.mediaAccess?.isAudioPermitted ? (
<Icon iconName="ControlButtonMicProhibited" className={iconStyles} ariaLabel={strings.mutedIconLabel} />
) : undefined}
{(callingParticipant.mediaAccess ? callingParticipant.mediaAccess.isAudioPermitted : true) &&
callingParticipant.isMuted ? (
<Icon iconName="ParticipantItemMicOff" className={iconStyles} ariaLabel={strings.mutedIconLabel} />
) : undefined}
</Stack>
)
: () => null;
Expand All @@ -254,10 +229,8 @@ const onRenderParticipantDefault = (
displayName: displayName ?? '',
connectionState: formatParticipantStateString(callingParticipant, strings) ?? '',
mutedState: (callingParticipant.isMuted ? strings?.mutedIconLabel : undefined) ?? '',
/* @conditional-compile-remove(media-access) */
micDisabledState:
(callingParticipant.mediaAccess?.isAudioPermitted === false ? strings?.micDisabledIconLabel : undefined) ?? '',
/* @conditional-compile-remove(media-access) */
cameraDisabledState:
(callingParticipant.mediaAccess?.isVideoPermitted === false ? strings?.cameraDisabledIconLabel : undefined) ?? '',
sharingState: (callingParticipant.isScreenSharing ? strings?.sharingIconLabel : undefined) ?? '',
Expand Down
19 changes: 4 additions & 15 deletions packages/react-components/src/components/RemoteVideoTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,9 @@ export const _RemoteVideoTile = React.memo(
toggleAnnouncerString?: (announcerString: string) => void;
reactionResources?: ReactionResources;
onLongTouch?: (() => void) | undefined;
/* @conditional-compile-remove(media-access) */
onForbidAudio?: (userIds: string[]) => Promise<void>;
/* @conditional-compile-remove(media-access) */
onPermitAudio?: (userIds: string[]) => Promise<void>;
/* @conditional-compile-remove(media-access) */
onForbidVideo?: (userIds: string[]) => Promise<void>;
/* @conditional-compile-remove(media-access) */
onPermitVideo?: (userIds: string[]) => Promise<void>;
}) => {
const {
Expand Down Expand Up @@ -109,13 +105,9 @@ export const _RemoteVideoTile = React.memo(
strings,
reactionResources,
streamId,
/* @conditional-compile-remove(media-access) */
onForbidAudio,
/* @conditional-compile-remove(media-access) */
onPermitAudio,
/* @conditional-compile-remove(media-access) */
onForbidVideo,
/* @conditional-compile-remove(media-access) */
onPermitVideo
} = props;

Expand All @@ -131,7 +123,6 @@ export const _RemoteVideoTile = React.memo(
renderElementExists: !!renderElement,
scalingMode: remoteVideoViewOptions?.scalingMode,
streamId,
/* @conditional-compile-remove(media-access) */
isVideoPermitted: remoteParticipant.mediaAccess ? remoteParticipant.mediaAccess.isVideoPermitted : true
}),
[
Expand All @@ -145,7 +136,6 @@ export const _RemoteVideoTile = React.memo(
renderElement,
userId,
streamId,
/* @conditional-compile-remove(media-access) */
remoteParticipant.mediaAccess
]
);
Expand All @@ -168,10 +158,10 @@ export const _RemoteVideoTile = React.memo(
onStopSpotlight,
maxParticipantsToSpotlight,
onMuteParticipant,
/* @conditional-compile-remove(media-access) */ onForbidAudio,
/* @conditional-compile-remove(media-access) */ onPermitAudio,
/* @conditional-compile-remove(media-access) */ onForbidVideo,
/* @conditional-compile-remove(media-access) */ onPermitVideo
onForbidAudio,
onPermitAudio,
onForbidVideo,
onPermitVideo
});

const videoTileContextualMenuProps = useMemo(() => {
Expand Down Expand Up @@ -277,7 +267,6 @@ export const _RemoteVideoTile = React.memo(
}
isSpotlighted={isSpotlighted}
overlay={reactionOverlay}
/* @conditional-compile-remove(media-access) */
mediaAccess={remoteParticipant.mediaAccess}
/>
{drawerMenuItemProps.length > 0 && (
Expand Down
17 changes: 0 additions & 17 deletions packages/react-components/src/components/VideoGallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,22 +345,18 @@ export interface VideoGalleryProps {
togetherModeSeatingCoordinates?: VideoGalleryTogetherModeParticipantPosition;
/* @conditional-compile-remove(together-mode) */
onDisposeTogetherModeStreamView?: () => Promise<void>;
/* @conditional-compile-remove(media-access) */
/**
* This callback is to forbid audio for remote participant(s)
*/
onForbidAudio?: (userIds: string[]) => Promise<void>;
/* @conditional-compile-remove(media-access) */
/**
* This callback is to permit audio for remote participant(s)
*/
onPermitAudio?: (userIds: string[]) => Promise<void>;
/* @conditional-compile-remove(media-access) */
/**
* This callback is to forbid video for remote participant(s)
*/
onForbidVideo?: (userIds: string[]) => Promise<void>;
/* @conditional-compile-remove(media-access) */
/**
* This callback is to permit video for remote participant(s)
*/
Expand Down Expand Up @@ -466,13 +462,9 @@ export const VideoGallery = (props: VideoGalleryProps): JSX.Element => {
togetherModeSeatingCoordinates,
/* @conditional-compile-remove(together-mode) */
onDisposeTogetherModeStreamView,
/* @conditional-compile-remove(media-access) */
onForbidAudio,
/* @conditional-compile-remove(media-access) */
onPermitAudio,
/* @conditional-compile-remove(media-access) */
onForbidVideo,
/* @conditional-compile-remove(media-access) */
onPermitVideo
} = props;

Expand Down Expand Up @@ -592,7 +584,6 @@ export const VideoGallery = (props: VideoGalleryProps): JSX.Element => {
reactionResources={reactionResources}
participantsCount={remoteParticipants.length + 1}
isScreenSharingOn={localParticipant.isScreenSharingOn}
/* @conditional-compile-remove(media-access) */
mediaAccess={localParticipant.mediaAccess}
/>
</Stack>
Expand Down Expand Up @@ -724,13 +715,9 @@ export const VideoGallery = (props: VideoGalleryProps): JSX.Element => {
maxParticipantsToSpotlight={maxParticipantsToSpotlight}
reactionResources={reactionResources}
onMuteParticipant={onMuteParticipant}
/* @conditional-compile-remove(media-access) */
onForbidAudio={onForbidAudio}
/* @conditional-compile-remove(media-access) */
onPermitAudio={onPermitAudio}
/* @conditional-compile-remove(media-access) */
onForbidVideo={onForbidVideo}
/* @conditional-compile-remove(media-access) */
onPermitVideo={onPermitVideo}
/>
);
Expand All @@ -757,13 +744,9 @@ export const VideoGallery = (props: VideoGalleryProps): JSX.Element => {
maxParticipantsToSpotlight,
reactionResources,
onMuteParticipant,
/* @conditional-compile-remove(media-access) */
onForbidAudio,
/* @conditional-compile-remove(media-access) */
onPermitAudio,
/* @conditional-compile-remove(media-access) */
onForbidVideo,
/* @conditional-compile-remove(media-access) */
onPermitVideo,
remoteVideoViewOptions
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export const LocalScreenShare = React.memo(
) : undefined
}
onRenderPlaceholder={() => <LoadingSpinner loadingMessage={loadingMessage} />}
/* @conditional-compile-remove(media-access) */
mediaAccess={localParticipant.mediaAccess}
/>
);
Expand Down
Loading