Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Popout Player with Single Left (Primary) Click #380

Open
rthaut opened this issue Apr 16, 2022 · 1 comment
Open

Open Popout Player with Single Left (Primary) Click #380

rthaut opened this issue Apr 16, 2022 · 1 comment

Comments

@rthaut
Copy link
Owner

rthaut commented Apr 16, 2022

From #375 - Add a way to open the popout player with a single left click.

@rthaut
Copy link
Owner Author

rthaut commented Apr 17, 2022

Development Notes

2022.04.16 - I tried unsuccessfully to use webRequest.onBeforeRequest with "main_frame" webRequest.ResourceType filtering to intercept and cancel navigation events to a YouTube video and open the popout player instead.

  • Unfortunately, this did not capture the pseudo "navigation" events that occur when browsing on youtube.com, which is the primary driver for the feature.
  • Additionally, including more ResourceTypes in the filter (or not filtering by ResourceType at all) does not seem like it will be a viable option for this use case, given:
    1. The event handler would fire only after the DOM has changed (or at least started to change) to/for the video page, so we would have to somehow undo whatever took place during the pseudo "navigation," rather than simply cancelling the request completely.
    2. It will require logic to only open the popout player once despite the event handler potentially firing many times (for all of the various sub-requests that could occur as a result of the DOM changing).

2022.04.19 - I tried unsuccessfully to add onclick event handlers to hyperlinks (<a> tags) pointing at the YouTube video page (ex: youtube.com/watch?v=...) to intercept and cancel navigation events to a YouTube video and open the popout player instead.

  • Unfortunately, this did not work either as the standard onclick handlers (which are registered on custom elements higher in the DOM tree) are fired first.
  • This may be possible if I traverse the DOM tree from the hyperlinks to a different element and add the onclick handler there, or if I could remove/disable the standard onclick handlers, but then this solution becomes highly dependent on the current DOM structure (and may vary between pages).

2022.04.20 - I tried partially successfully to use tabs.onUpdated to open the popout player when a tab navigates to a YouTube video page.

  • While this did capture all navigation events and opened the popout player as expected, it fired after the original page had loaded (or started to load). This could potentially be overcome by using tabs.goBack() once the popout player is opened, but that feels a little too hacky.
  • Conveniently, this solution is perfect for opening the popout player automatically when navigating to a YouTube video page (Open Popout Player Automatically #367), so that feature is developed and should be available in the next release.

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

No branches or pull requests

1 participant