Fix outbound audio track attach for pre-media peers
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||||
window.CHGRID_WEB_VERSION = "2026.02.25 R264";
|
window.CHGRID_WEB_VERSION = "2026.02.25 R265";
|
||||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -113,12 +113,19 @@ export class PeerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async replaceOutgoingTrack(stream: MediaStream): Promise<void> {
|
async replaceOutgoingTrack(stream: MediaStream): Promise<void> {
|
||||||
|
const newTrack = stream.getAudioTracks()[0];
|
||||||
|
if (!newTrack) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (const peer of this.peers.values()) {
|
for (const peer of this.peers.values()) {
|
||||||
const sender = peer.pc.getSenders().find((candidate) => candidate.track?.kind === 'audio');
|
const sender =
|
||||||
const newTrack = stream.getAudioTracks()[0];
|
peer.pc.getSenders().find((candidate) => candidate.track?.kind === 'audio') ??
|
||||||
if (sender && newTrack) {
|
peer.pc
|
||||||
await sender.replaceTrack(newTrack);
|
.getTransceivers()
|
||||||
}
|
.find((transceiver) => transceiver.receiver.track?.kind === 'audio' || transceiver.sender.track?.kind === 'audio')
|
||||||
|
?.sender;
|
||||||
|
if (!sender) continue;
|
||||||
|
await sender.replaceTrack(newTrack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user