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

Manifest V3 killed video query selector #75

Open
shanewazabbas opened this issue Mar 20, 2022 · 6 comments
Open

Manifest V3 killed video query selector #75

shanewazabbas opened this issue Mar 20, 2022 · 6 comments

Comments

@shanewazabbas
Copy link

shanewazabbas commented Mar 20, 2022

Tried to see why Array.from(document.querySelectorAll('video')) was returning videos for this extension, so I made some changes to make it work in manifest v3 and the query selector no longer finds videos in certain websites. Those in iframes to be specific. Which is odd since the setting: allFrames is true. I was using this extension as a reference for my own where I need to find the playing video in any site, but ran into this one issue.

const videos = Array.from(document.querySelectorAll('video'))
    .filter(video => video.readyState != 0)
    .filter(video => video.disablePictureInPicture == false)
    .sort((v1, v2) => {
      const v1Rect = v1.getClientRects()[0] || {
        width: 0,
        height: 0
      };
      const v2Rect = v2.getClientRects()[0] || {
        width: 0,
        height: 0
      };
      return ((v2Rect.width * v2Rect.height) - (v1Rect.width * v1Rect.height));
    });

Not really sure this can be fixed, but wanted to post it just for visibility. Now the real question is: was the chrome built in pip extension an actual chrome extension (and does it use v3?) or was it developed directly in the browser source code.

@beaufortfrancois
Copy link
Collaborator

This extension is an actual chrome extension and uses manifest v2. See https://github.com/GoogleChromeLabs/picture-in-picture-chrome-extension/blob/master/src/manifest.json#L38

@shanewazabbas
Copy link
Author

But what about this:
image

Isn't this builtin or does it use https://github.com/GoogleChromeLabs/picture-in-picture-chrome-extension

@beaufortfrancois
Copy link
Collaborator

This icon comes from Chrome and has nothing with this extension.

@shanewazabbas
Copy link
Author

I know... I'm just wondering if the chrome built in one is an extension thats internal or its built to the browser.

This extension is an actual chrome extension and uses manifest v2. See https://github.com/GoogleChromeLabs/picture-in-picture-chrome-extension/blob/master/src/manifest.json#L38

I'm also well aware this is an extension...
You should probably archive it if its not needed.

@beaufortfrancois
Copy link
Collaborator

It is built into the browser. See https://source.chromium.org/chromium/chromium/src/+/main:components/global_media_controls/ for details. It doesn't use any extension mechanism as far as I can tell.

This extension was created when Global Media Controls (the UI you've mentioned above) was not created there.

I still use this extension because of the global keyboard shortcut for what it's worth.

@nopeless
Copy link

nopeless commented Sep 9, 2022

@shanewazabbas #78 Is a V3 migration

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

No branches or pull requests

3 participants