From 1367a2257f0ade3c762c924623d071ee9f4ab453 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Tue, 1 Sep 2026 22:26:34 +0700 Subject: [PATCH] fix(gateway): detect camera-only video (selfVideo) for stream watch Previously only member.voice.streaming (screen share, self_stream) triggered video capture. Discord reports camera via self_video:true, so camera-only users were never watched. Now scanExistingStreamers and handleVoiceStateUpdate start a watch when streaming OR selfVideo is set, and stop it when both clear. --- .../src/modules/voice-recording/videoRecorder.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/services/discord-gateway/src/modules/voice-recording/videoRecorder.ts b/services/discord-gateway/src/modules/voice-recording/videoRecorder.ts index 131242ed..91a2bf76 100644 --- a/services/discord-gateway/src/modules/voice-recording/videoRecorder.ts +++ b/services/discord-gateway/src/modules/voice-recording/videoRecorder.ts @@ -96,8 +96,13 @@ export function scanExistingStreamers(channel: VoiceChannel): void { if (!members || members.size === 0) return; let watched = 0; for (const [, member] of members) { - const vs = member.voice?.streaming; - if (vs && member.id !== _client?.user?.id) { + // Watch anyone with video ACTIVE: screen share (streaming) OR camera + // (selfVideo). Camera on Discord (mobile/desktop "video") is reported via + // self_video:true, NOT self_stream — previously only streaming was checked + // so camera-only users were never watched. + const vs = member.voice; + const hasVideo = Boolean(vs?.streaming || vs?.selfVideo); + if (hasVideo && member.id !== _client?.user?.id) { startVideoRecording(channel, member.id); watched++; } @@ -129,11 +134,13 @@ async function handleVoiceStateUpdate( if (!channel) return; // not an actively-recorded channel const streaming = Boolean(newState.streaming); + const cameraOn = Boolean(newState.selfVideo); + const hasVideo = streaming || cameraOn; const inChannel = newState.channelId === channel.id; - if (streaming && inChannel) { + if (hasVideo && inChannel) { startVideoRecording(channel, newState.id); - } else if (!inChannel || !streaming) { + } else if (!inChannel || !hasVideo) { stopVideoRecording(channel.guild.id, newState.id); } } catch (err) {