Skip to content

Manifest V3 killed video query selector #75

Open
@shanewazabbas

Description

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.

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions