Skip to content

Commit

Permalink
Add cleanup guard to prevent double calling
Browse files Browse the repository at this point in the history
  • Loading branch information
longnguyen2004 committed Mar 1, 2025
1 parent 56f89ab commit b5d5d47
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/media/newApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,11 @@ export async function playStream(
udp.mediaConnection.setSpeaking(false);
udp.mediaConnection.setVideoAttributes(false);
});
let cleanedUp = false;
const cleanup = () => {
if (cleanedUp)
return;
cleanedUp = true;
for (const f of cleanupFuncs)
f();
}
Expand Down

0 comments on commit b5d5d47

Please sign in to comment.