Skip to content

Commit

Permalink
reimplemented vc logic from scratch, Should hopefully be more stable 🤞
Browse files Browse the repository at this point in the history
  • Loading branch information
SupertigerDev committed Oct 17, 2024
1 parent 9292c7f commit 552e748
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/chat-api/store/useVoiceUsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ const setCurrentChannelId = (channelId: string | null) => {
removeAllPeers(current?.channelId);
current.vadInstance?.destroy();
current.vadAudioStream?.getAudioTracks()[0]?.stop();
batch(() => {
getVoiceUsersByChannelId(current.channelId).forEach((voiceUser) => {
voiceUser.vadInstance?.destroy();
setVoiceUsers(current.channelId, voiceUser.userId, {
voiceActivity: false,
vadInstance: undefined,
});
});
});
}
if (!channelId) {
setCurrentVoiceUser(undefined);
Expand All @@ -88,6 +97,8 @@ const setCurrentChannelId = (channelId: string | null) => {
channelId,
audioStream: null,
videoStream: null,
vadAudioStream: null,
vadInstance: undefined,
micMuted: true,
});
};
Expand Down

0 comments on commit 552e748

Please sign in to comment.