Skip to content

fix: sync YouTube live panel mute state with native player controls#298

Closed
koala73 wants to merge 3 commits intomainfrom
claude/review-pr-285-eHzVm
Closed

fix: sync YouTube live panel mute state with native player controls#298
koala73 wants to merge 3 commits intomainfrom
claude/review-pr-285-eHzVm

Conversation

@koala73
Copy link
Owner

@koala73 koala73 commented Feb 24, 2026

Summary

Fixes mute state synchronization between the LiveNewsPanel's mute button and YouTube's native player controls. Previously, toggling mute via the player's native UI would not update the panel's mute icon, causing the UI to drift out of sync with the actual player state.

Implements dual sync paths:

  1. Desktop embed proxy (api/youtube/embed.js): Polls player mute state and posts yt-mute-state messages to parent on change
  2. Native YT IFrame API (src/components/LiveNewsPanel.ts): Polls player mute state directly when not using the embed proxy

Both paths use 500ms polling intervals with change-only updates to minimize overhead, and properly clean up intervals on player destruction.

Type of change

  • Bug fix
  • New feature
  • New data source / feed
  • New map layer
  • Refactor / code cleanup
  • Documentation
  • CI / Build / Infrastructure

Affected areas

  • News panels / RSS feeds
  • Map / Globe
  • AI Insights / World Brief
  • Market Radar / Crypto
  • Desktop app (Tauri)
  • API endpoints (/api/*)
  • Config / Settings
  • Other

Changes

  • Added getVolume?(): number to YouTubePlayer type definition
  • Removed unused OPTIONAL_LIVE_CHANNELS and OPTIONAL_CHANNEL_REGIONS exports (cleanup)
  • Added mute state polling infrastructure to LiveNewsPanel:
    • startMuteSyncPolling() / stopMuteSyncPolling() lifecycle methods
    • syncMuteStateFromPlayer() polls native player mute state
    • Message handler for yt-mute-state events from embed proxy
  • Added mute sync to api/youtube/embed.js:
    • readMuted() helper checks isMuted() with getVolume() === 0 fallback
    • startMuteSync() / stopMuteSync() polling functions
    • Posts yt-mute-state messages only on state changes

Checklist

Test Plan

Manual testing:

  1. Open Live News panel on either variant
  2. Play a live stream
  3. Toggle mute via YouTube player's native mute button
  4. Verify the panel's mute icon updates to reflect the actual player state
  5. Verify toggling mute via the panel's button still works correctly
  6. Switch channels and verify intervals are properly cleaned up (no console errors)

https://claude.ai/code/session_01JCZAToYxRZs6dg7Wi2yH37

Request changes: The mute-sync fix is correct, but the PR bundles
unrelated regressions (ACLED shared cache deletion, TTL reversals,
AIS visibility guard removal, optional channels removal, test deletion,
User-Agent stripping) that need separate PRs and justification.

https://claude.ai/code/session_01JCZAToYxRZs6dg7Wi2yH37
…eNewsPanel.ts only)

Approve with minor suggestions: the mute-sync fix is clean and
well-scoped. Suggestions around embed interval cleanup, origin
validation on postMessage, and a static constant nit.

https://claude.ai/code/session_01JCZAToYxRZs6dg7Wi2yH37
- Add stopMuteSync() in embed.js and call it on player error to
  prevent polling a dead player
- Make MUTE_SYNC_POLL_MS static readonly (class-level constant)

https://claude.ai/code/session_01JCZAToYxRZs6dg7Wi2yH37
@vercel
Copy link

vercel bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldmonitor Error Error Feb 24, 2026 5:50am
worldmonitor-finance Error Error Feb 24, 2026 5:50am
worldmonitor-happy Error Error Feb 24, 2026 5:50am
worldmonitor-startup Error Error Feb 24, 2026 5:50am

Request Review

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@koala73 koala73 closed this Feb 24, 2026
@koala73 koala73 deleted the claude/review-pr-285-eHzVm branch February 25, 2026 07:59
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.

2 participants