fix(voice): screen share restore is best-effort — Discord session teardown race
GoLive (dank074 Streamer) needs the single voice session; after the stream ends, an automatic @discordjs/voice reconnect often races Discord's session teardown and times out (AbortError). Restore is now best-effort with a 5s delay; if it fails the FE shows disconnected and the user clicks Connect — an accepted tradeoff for one-voice-session-per-user.
This commit is contained in:
@@ -127,17 +127,19 @@ export class ScreenShareController {
|
|||||||
/* already gone */
|
/* already gone */
|
||||||
}
|
}
|
||||||
if (this.restoreVoice) {
|
if (this.restoreVoice) {
|
||||||
// Wait for Discord to fully release the Streamer's voice session
|
// Best-effort restore after a short delay. Discord often needs the
|
||||||
// before re-joining with @discordjs/voice — an immediate join races
|
// Streamer's session fully torn down before @discordjs/voice can
|
||||||
// the session teardown and times out with AbortError.
|
// re-join; if that races, the reconnect times out — the FE shows
|
||||||
|
// disconnected and the user just clicks Connect again. This is an
|
||||||
|
// accepted UX tradeoff for GoLive (single voice session per user).
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Promise.resolve(this.restoreVoice(status)).catch((err) => {
|
Promise.resolve(this.restoreVoice(status)).catch((err) => {
|
||||||
this.logger.warn(
|
this.logger.warn(
|
||||||
{ error: err instanceof Error ? err.message : String(err) },
|
{ error: err instanceof Error ? err.message : String(err) },
|
||||||
"Failed to restore voice connection after screen share",
|
"Failed to restore voice connection after screen share (user can reconnect manually)",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}, 4000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const done = playStream(output, this.streamer, {
|
const done = playStream(output, this.streamer, {
|
||||||
|
|||||||
Reference in New Issue
Block a user