Skip to content

Match background notification volume to video player#1431

Open
TriumphantSam wants to merge 2 commits into
CaptainFact:stagingfrom
TriumphantSam:codex/background-notifier-volume-93
Open

Match background notification volume to video player#1431
TriumphantSam wants to merge 2 commits into
CaptainFact:stagingfrom
TriumphantSam:codex/background-notifier-volume-93

Conversation

@TriumphantSam
Copy link
Copy Markdown

Summary

  • Track the current ReactPlayer volume in the video playback context.
  • Read both YouTube-style getVolume() values and HTML media volume values.
  • Apply the stored player volume before playing background notification sounds.
  • Add focused coverage for player volume normalization/reading.

Fixes CaptainFact/captain-fact#93.

Verification

  • npx --yes prettier@3.5.3 --check ...
  • git diff --check
  • Node smoke test for player_volume
  • esbuild syntax parse for touched JSX/context files

Note: Full Jest/lint could not run locally because npm ci --ignore-scripts timed out before creating local npm binaries.

@TriumphantSam TriumphantSam marked this pull request as ready for review May 22, 2026 07:30
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In VideoDebatePlayer, updateVolumeFromPlayer is invoked on every onProgress tick; if ReactPlayer or the underlying players provide a dedicated volume-change hook/event, consider using that instead or throttling the volume sync to avoid unnecessary work on frequent progress updates.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `VideoDebatePlayer`, `updateVolumeFromPlayer` is invoked on every `onProgress` tick; if ReactPlayer or the underlying players provide a dedicated volume-change hook/event, consider using that instead or throttling the volume sync to avoid unnecessary work on frequent progress updates.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d17693dada

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/lib/player_volume.js Outdated
return null
}

const normalizedVolume = numericVolume > 1 ? numericVolume / 100 : numericVolume
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Treat YouTube volume value 1 as 1%, not 100%

normalizePlayerVolume only converts values greater than 1 from a 0–100 scale, so a YouTube getVolume() result of 1 is interpreted as already normalized and becomes 1.0. In that case, background notifications play at full volume even though the player is set to 1%, which breaks the intended volume matching behavior.

Useful? React with 👍 / 👎.

Comment thread app/lib/player_volume.js Outdated
Comment on lines +20 to +21
if (typeof internalPlayer.getVolume === 'function') {
return normalizePlayerVolume(internalPlayer.getVolume())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Honor muted player state before deriving notification volume

getReactPlayerVolume returns numeric volume directly from getVolume()/volume without checking mute state. For both YouTube and HTML media players, mute is tracked separately from the numeric volume, so a muted player can still report a non-zero volume; this makes background notification sounds audible while the video is muted.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adapt background sound volume based on video volume

1 participant