Scale background notification sounds with player volume#1426
Open
SimplyRayYZL wants to merge 2 commits into
Open
Scale background notification sounds with player volume#1426SimplyRayYZL wants to merge 2 commits into
SimplyRayYZL wants to merge 2 commits into
Conversation
3 tasks
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
playNotificationSound, consider skippingaudioFile.play()when the normalizedvolumeis 0 to avoid triggering unnecessary playback operations when the video volume is effectively muted. - In
getNormalizedPlayerVolume, theinternalPlayer.volumebranch assumes a 0–1 range; for consistency with thegetVolumebranch it might be safer to clamp or normalize this value in case some players expose 0–100 there as well. - The
handleProgresscallback now callsupdateVolumeFromPlayeron each progress event; if progress events are frequent for some providers, you might want to throttle or compare with the last stored volume before dispatching to reduce redundant context updates.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `playNotificationSound`, consider skipping `audioFile.play()` when the normalized `volume` is 0 to avoid triggering unnecessary playback operations when the video volume is effectively muted.
- In `getNormalizedPlayerVolume`, the `internalPlayer.volume` branch assumes a 0–1 range; for consistency with the `getVolume` branch it might be safer to clamp or normalize this value in case some players expose 0–100 there as well.
- The `handleProgress` callback now calls `updateVolumeFromPlayer` on each progress event; if progress events are frequent for some providers, you might want to throttle or compare with the last stored volume before dispatching to reduce redundant context updates.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Author
|
Addressed Sourcery's high-level feedback in
Validation re-run:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VideoPlaybackContext, normalized to the 0..1 range used byHTMLAudioElement.volume.volumechangeevents when available.Fixes CaptainFact/captain-fact#93
Validation
npm run typescript.\node_modules\.bin\eslint.cmd --quiet app\components\App\BackgroundNotifier.jsx app\components\VideoDebate\VideoDebatePlayer.jsx app\contexts\VideoPlaybackContext.jsx.\node_modules\.bin\prettier.cmd --check app\components\App\BackgroundNotifier.jsx app\components\VideoDebate\VideoDebatePlayer.jsx app\contexts\VideoPlaybackContext.jsxgit diff --check -- app\contexts\VideoPlaybackContext.jsx app\components\VideoDebate\VideoDebatePlayer.jsx app\components\App\BackgroundNotifier.jsxnpm run build