Repository navigation
Fix audio indicator audibility signal - #6566
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughExtends the media playback reporting pipeline with an ChangesAudible Media Tracking
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (2 errors, 1 warning)
✅ Passed checks (20 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR separates media playback retention (keeping a hidden pane alive) from audible-audio UI state (the speaker glyph). Previously, any playing media — including muted, video-only, or silenced playback — triggered the speaker indicator. Now
Confidence Score: 5/5Safe to merge — the change correctly separates retention from audio-glyph state, both the Swift and JS logic handle all state transitions, and a new test suite validates the two key invariants. The split between No files require special attention; Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[JS: media event fires
play/pause/volumechange/timeupdate/...] --> B[reportIfTargetStateChanged]
B --> C{el matches
video, audio?}
C -- No --> D[report: full DOM scan]
C -- Yes --> E[compute isElementPlaying
isElementAudible]
E --> F{WeakMap state
changed?}
F -- No --> G[early exit: no-op]
F -- Yes --> H[update WeakMap
call report]
H --> D
D --> I[currentPlaybackState
full DOM scan]
I --> J{state changed
vs lastReported?}
J -- No --> K[skip post]
J -- Yes --> L[post: frameID, playing, audible]
L --> M[BrowserMediaPlaybackMessageHandler
main thread]
M --> N[applyMediaPlaybackReport]
N --> O[update playingMediaFrameIDs
update audibleMediaFrameIDs]
O --> P[isPlayingMedia = !playingMediaFrameIDs.isEmpty]
P --> Q[refreshAudioMediaActivity]
Q --> R[setMediaActivity
isPlayingAudio = !audibleMediaFrameIDs.isEmpty && !isMuted]
R --> S[onMediaActivityChanged callback
Workspace → tab/sidebar glyph]
T[setMuted called] --> U[isMuted = muted]
U --> Q
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[JS: media event fires
play/pause/volumechange/timeupdate/...] --> B[reportIfTargetStateChanged]
B --> C{el matches
video, audio?}
C -- No --> D[report: full DOM scan]
C -- Yes --> E[compute isElementPlaying
isElementAudible]
E --> F{WeakMap state
changed?}
F -- No --> G[early exit: no-op]
F -- Yes --> H[update WeakMap
call report]
H --> D
D --> I[currentPlaybackState
full DOM scan]
I --> J{state changed
vs lastReported?}
J -- No --> K[skip post]
J -- Yes --> L[post: frameID, playing, audible]
L --> M[BrowserMediaPlaybackMessageHandler
main thread]
M --> N[applyMediaPlaybackReport]
N --> O[update playingMediaFrameIDs
update audibleMediaFrameIDs]
O --> P[isPlayingMedia = !playingMediaFrameIDs.isEmpty]
P --> Q[refreshAudioMediaActivity]
Q --> R[setMediaActivity
isPlayingAudio = !audibleMediaFrameIDs.isEmpty && !isMuted]
R --> S[onMediaActivityChanged callback
Workspace → tab/sidebar glyph]
T[setMuted called] --> U[isMuted = muted]
U --> Q
Reviews (1): Last reviewed commit: "Fix audio indicator audibility signal" | Re-trigger Greptile |
Summary
Verification
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by cubic
Separate media playback from audibility so the speaker icon appears only when audio is actually audible; muted, silent, disabled-track, or video-only playback no longer shows the icon while still preventing hidden pane discard.
audioTracks, and decoded-byte checks; listens to media andvolumechange/timeupdateevents.isAudible; panel tracksplayingMediaFrameIDsandaudibleMediaFrameIDsseparately.isPlayingMediacontinues to block hidden WebView discard;isPlayingAudiodrives the speaker glyph and updates on mute/unmute and navigation resets.BrowserMediaPlaybackAudioActivityTeststo validate silent vs audible playback behavior.Written for commit b87f1dc. Summary will update on new commits.
Summary by CodeRabbit
New Features
Tests