mirror of
https://github.com/vector-im/element-call.git
synced 2024-11-15 00:04:59 +08:00
Fix active speaker and speaking
This commit is contained in:
parent
d813509541
commit
01d2a7136c
@ -328,7 +328,6 @@ export function useGroupCall(client, roomId) {
|
||||
|
||||
useEffect(() => {
|
||||
function onParticipantsChanged(...args) {
|
||||
console.log(...args);
|
||||
updateState({ participants: getParticipants(groupCallRef.current) });
|
||||
}
|
||||
|
||||
@ -348,8 +347,8 @@ export function useGroupCall(client, roomId) {
|
||||
groupCall.on("participants_changed", onParticipantsChanged);
|
||||
groupCall.on("speaking", onParticipantsChanged);
|
||||
groupCall.on("mute_state_changed", onParticipantsChanged);
|
||||
groupCall.on("participant_call_replaced", onParticipantsChanged);
|
||||
groupCall.on("participant_call_feeds_changed", onParticipantsChanged);
|
||||
groupCall.on("call_replaced", onParticipantsChanged);
|
||||
groupCall.on("call_feeds_changed", onParticipantsChanged);
|
||||
groupCall.on("local_mute_state_changed", onLocalMuteStateChanged);
|
||||
|
||||
updateState({
|
||||
@ -368,14 +367,8 @@ export function useGroupCall(client, roomId) {
|
||||
groupCall.removeListener("participants_changed", onParticipantsChanged);
|
||||
groupCall.removeListener("speaking", onParticipantsChanged);
|
||||
groupCall.removeListener("mute_state_changed", onParticipantsChanged);
|
||||
groupCall.removeListener(
|
||||
"participant_call_replaced",
|
||||
onParticipantsChanged
|
||||
);
|
||||
groupCall.removeListener(
|
||||
"participant_call_feeds_changed",
|
||||
onParticipantsChanged
|
||||
);
|
||||
groupCall.removeListener("call_replaced", onParticipantsChanged);
|
||||
groupCall.removeListener("call_feeds_changed", onParticipantsChanged);
|
||||
groupCall.removeListener(
|
||||
"local_mute_state_changed",
|
||||
onLocalMuteStateChanged
|
||||
|
@ -167,6 +167,10 @@ export function EnteringRoomView() {
|
||||
}
|
||||
|
||||
export function LoadingErrorView({ error }) {
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={styles.centerMessage}>
|
||||
@ -190,7 +194,6 @@ function RoomSetupView({
|
||||
localVideoMuted,
|
||||
toggleLocalVideoMuted,
|
||||
toggleMicrophoneMuted,
|
||||
groupCall,
|
||||
}) {
|
||||
const videoRef = useRef();
|
||||
const [permissionState, setPermissionState] = useState(
|
||||
@ -206,7 +209,9 @@ function RoomSetupView({
|
||||
setPermissionState(PermissionState.Granted);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
|
||||
if (videoRef.current) {
|
||||
setPermissionState(PermissionState.Denied);
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ export function VideoGrid({ participants, layout }) {
|
||||
let presenter;
|
||||
|
||||
if (layout === "spotlight") {
|
||||
presenter = participant.activeSpeaker;
|
||||
presenter = participant.isActiveSpeaker();
|
||||
} else {
|
||||
presenter = layout === lastLayoutRef.current ? tile.presenter : false;
|
||||
}
|
||||
@ -459,7 +459,7 @@ export function VideoGrid({ participants, layout }) {
|
||||
key: participant.member.userId,
|
||||
participant,
|
||||
remove: false,
|
||||
presenter: layout === "spotlight" && participant.activeSpeaker,
|
||||
presenter: layout === "spotlight" && participant.isActiveSpeaker(),
|
||||
});
|
||||
}
|
||||
|
||||
@ -740,10 +740,10 @@ function ParticipantTile({ style, participant, remove, presenter, ...rest }) {
|
||||
<animated.div className={styles.participantTile} style={style} {...rest}>
|
||||
<div
|
||||
className={classNames(styles.participantName, {
|
||||
[styles.speaking]: participant.usermediaStream?.speaking,
|
||||
[styles.speaking]: participant.usermediaFeed?.isSpeaking(),
|
||||
})}
|
||||
>
|
||||
{participant.usermediaStream?.speaking ? (
|
||||
{participant.usermediaFeed?.isSpeaking() ? (
|
||||
<MicIcon />
|
||||
) : participant.isAudioMuted() ? (
|
||||
<MuteMicIcon className={styles.muteMicIcon} />
|
||||
|
Loading…
Reference in New Issue
Block a user