Skip to content

Fix #1637: Apply forced volume in iframe/embed context on first load#3795

Open
tarai-dl wants to merge 1 commit intocode-charity:masterfrom
tarai-dl:rn/fix-iframe-volume
Open

Fix #1637: Apply forced volume in iframe/embed context on first load#3795
tarai-dl wants to merge 1 commit intocode-charity:masterfrom
tarai-dl:rn/fix-iframe-volume

Conversation

@tarai-dl
Copy link
Copy Markdown

Fix #1637: Apply forced volume in iframe/embed context on first load

Problem

When YouTube videos are embedded in iframes (e.g., on Google search results), the forced volume setting is not applied on first load or in incognito mode.

Root Cause

initPlayer() is only called from init(). In embedded player contexts, the yt-page-data-updated event does not fire, so initPlayer() is never called after the player element is detected.

Fix

Added initPlayer() call directly in ytElementsHandler when movie_player is first detected.

Testing

  • Open a YouTube video embedded in an iframe (e.g., from Google search results)
  • Set forced volume to a specific value in ImprovedTube settings
  • Load the page in incognito mode or with cache cleared (ctrl+f5)
  • Volume should be applied immediately without requiring a refresh

… first load

When YouTube videos are embedded in iframes (e.g., on Google search results),
the forced volume setting was not applied on first load or in incognito mode.

The issue was that initPlayer() (which calls playerVolume()) was only called
from init(), which might run before the player element is detected. In the
main YouTube page, the yt-page-data-updated event re-triggers initPlayer(),
but this event does not fire in embedded player contexts.

The fix calls initPlayer() directly when the movie_player element is first
detected in ytElementsHandler, ensuring forced volume is applied regardless
of the initialization timing or context (main page vs iframe).
@ImprovedTube
Copy link
Copy Markdown
Member

hi and thanks @tarai-dl; please disclose LLM content and PR acceptance rate of your setup and avoid statement about tests which might not have happened.

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.

[bug] No forced volume in embedded player at first load or ctrl+f5 or incognito

2 participants