Skip to content

Commit

Permalink
Catch InvalidStateError: RTCPeerConnection is closed exception
Browse files Browse the repository at this point in the history
  • Loading branch information
conroywhitney committed Nov 19, 2024
1 parent f04272c commit 3d66a42
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/room/track/LocalTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,17 @@ export default abstract class LocalTrack<
}
}
if (this.sender) {
await this.sender.replaceTrack(processedTrack ?? newTrack);
try {
await this.sender.replaceTrack(processedTrack ?? newTrack);
} catch (e) {
this.log.error('failed to replace track on sender', {
...this.logContext,
error: e,
newTrack: newTrack,
processedTrack: processedTrack,
sender: this.sender
});
}
}
// if `newTrack` is different from the existing track, stop the
// older track just before replacing it
Expand Down

0 comments on commit 3d66a42

Please sign in to comment.