Files
discord-decomp/modules/calls/ParticipantFocusManager.tsx
T
2026-11-01 12:12:55 +02:00

21 lines
1.0 KiB
TypeScript

// Metro module 16299 (f16300).
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import ChannelRTCStore from "./ChannelRTCStore";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
class ParticipantFocusManager extends AutomaticLifecycleManager {
stores = new Map().set(ChannelRTCStore, this.handleFocusParticipant);
handleFocusParticipant() {
const channelId = RTCConnectionStore.getChannelId();
if (channelId != null) {
const selectedParticipantId = ChannelRTCStore.getSelectedParticipantId(channelId);
const videoParticipants = ChannelRTCStore.getVideoParticipants(channelId);
const rTCConnection = RTCConnectionStore.getRTCConnection();
if (rTCConnection != null) {
rTCConnection.setSelectedParticipant(videoParticipants.find((videoParticipant) => videoParticipant.id === selectedParticipantId && !videoParticipant.localVideoDisabled)?.id);
}
}
}
}
const participantFocusManager = new ParticipantFocusManager();
export default participantFocusManager;