chrome/script.js
/**
 * Entering Picture-in-Picture mode
 */
Entering Picture-in-Picture mode
Entering Picture - in - Picture mode
async function enterPiP(videos, position) {
  position = (position < videoLength) ? position : 0;
  if (videoLength === 0 || document.body.hasAttribute('__pip_watch__') === false) {
    exitPiP();
    return;
  }
  try {
    await requestPiP(videos[position]);
  } catch(e) {
    videos = videos.splice(position, 1);
    videoLength = videos.length;
  }
  if (videoLength > 1) {
    await sleep(delayTime);
    await enterPiP(videos, position + 1);
  }
}
async function enterPiP ( videos , position ) { position = ( position < videoLength ) ? position : 0 ; if ( videoLength === 0 || document . body . hasAttribute ( '__pip_watch__' ) === false ) { exitPiP ( ) ; return ; } try { await requestPiP ( videos [ position ] ) ; } catch ( e ) { videos = videos . splice ( position , 1 ) ; videoLength = videos . length ; } if ( videoLength > 1 ) { await sleep ( delayTime ) ; await enterPiP ( videos , position + 1 ) ; } }
Entering Picture-in-Picture mode
Entering Picture - in - Picture mode
//console.log(e);