Oops! Thought I’d replied to this days ago, but just found my partially-written message. Finished message follows…
Instead of using MediaStream.removeTrack() and addTrack(), use RTCRtpSender.replaceTrack():
audioStream.replaceTrack(this.state.windowTrack, this.state.videoTrack);
This will swap between the streams without breaking things. We don’t have it documented yet, but it does work.
Sheppy