chrome/script.js
/**
 * Find largest playing video in a document
 */
Find largest playing video in a document
Find largest playing video in a document
function findVideo() {
  return Array.from(document.querySelectorAll('video'))
    .filter(video => video.readyState !== 0)
    .filter(video => video.disablePictureInPicture === false)
    .filter(video => {
      let isVideo = true;
      if (urlHost !== 'undefined' && urlHost === 'meet.google.com') {
        let videoParentElement = 'div[jscontroller="J3CtX"]';
        let presentationElement = 'div[jscontroller="LvT0m"]';
        let peopleNameElement = '[data-self-name]';
        let videoParent = video.closest(videoParentElement);
        isVideo = false;
        if (videoParent != null && videoParent.querySelector(presentationElement) != null) {
          let selfName = videoParent.querySelector(peopleNameElement);
          isVideo = selfName.dataset.selfName !== selfName.innerHTML
        }
      }
      return isVideo;
    })
    .sort((video1, video2) => {
      const video1Rect = video1.getClientRects()[0]||{width:0,height:0};
      const video2Rect = video2.getClientRects()[0]||{width:0,height:0};
      return ((video2Rect.width * video2Rect.height) - (video1Rect.width * video1Rect.height));
    });
}
function findVideo ( ) { return Array . from ( document . querySelectorAll ( 'video' ) ) . filter ( video => video . readyState !== 0 ) . filter ( video => video . disablePictureInPicture === false ) . filter ( video => { let isVideo = true ; if ( urlHost !== 'undefined' && urlHost === 'meet.google.com' ) { let videoParentElement = 'div[jscontroller="J3CtX"]' ; let presentationElement = 'div[jscontroller="LvT0m"]' ; let peopleNameElement = '[data-self-name]' ; let videoParent = video . closest ( videoParentElement ) ; isVideo = false ; if ( videoParent != null && videoParent . querySelector ( presentationElement ) != null ) { let selfName = videoParent . querySelector ( peopleNameElement ) ; isVideo = selfName . dataset . selfName !== selfName . innerHTML } } return isVideo ; } ) . sort ( ( video1 , video2 ) => { const video1Rect = video1 . getClientRects ( ) [ 0 ] || { width : 0 , height : 0 } ; const video2Rect = video2 . getClientRects ( ) [ 0 ] || { width : 0 , height : 0 } ; return ( ( video2Rect . width * video2Rect . height ) - ( video1Rect . width * video1Rect . height ) ) ; } ) ; }
Find largest playing video in a document
Find largest playing video in a document
// google meet