diff --git a/discord.js-selfbot-v13 b/discord.js-selfbot-v13 index 9d6ca7a..943f9e5 160000 --- a/discord.js-selfbot-v13 +++ b/discord.js-selfbot-v13 @@ -1 +1 @@ -Subproject commit 9d6ca7a1b9fbc7362ffcb3732487ed78f2ff9769 +Subproject commit 943f9e54add4eda8983d83f78e0942ed9e137387 diff --git a/src/services/webcamRecording.js b/src/services/webcamRecording.js index e55f6f6..384c801 100644 --- a/src/services/webcamRecording.js +++ b/src/services/webcamRecording.js @@ -468,19 +468,30 @@ class WebcamRecordingService { textChannel ) { // Listen for streaming events to detect when camera is turned off - connection.on("startStreaming", ({ video_ssrc, user_id, audio_ssrc }) => { - // Check if this is our target user and they turned off their camera - if (user_id === targetUserId && (video_ssrc === 0 || !video_ssrc)) { - console.log( - `[Docker] Target user ${targetUserId} turned off camera, stopping webcam recording` - ); - this.stopRecording( - voiceChannelId, - textChannel, - "🎥 Webcam recording stopped - user turned off camera." - ); + connection.on( + "startStreaming", + ({ video_ssrc, user_id, audio_ssrc, streams }) => { + // Check if this is our target user + if (user_id === targetUserId) { + // Check if any stream is active for video + const hasActiveVideo = + streams && + streams.some((stream) => stream.active && stream.type === "video"); + + // Stop recording if no active video streams or video_ssrc is 0 + if (!hasActiveVideo || video_ssrc === 0 || !video_ssrc) { + console.log( + `[Docker] Target user ${targetUserId} turned off camera (active video: ${hasActiveVideo}, video_ssrc: ${video_ssrc}), stopping webcam recording` + ); + this.stopRecording( + voiceChannelId, + textChannel, + "🎥 Webcam recording stopped - user turned off camera." + ); + } + } } - }); + ); // Listen for user disconnect events connection.on("disconnect", (userId) => {