PiedPiPer.safariextension icon indicating copy to clipboard operation
PiedPiPer.safariextension copied to clipboard

Plex no longer works

Open marcelinollano opened this issue 7 years ago • 3 comments

Recently Plex updated their web player and this extension no longer works:

screen shot 2017-08-04 at 11 10 58 screen shot 2017-08-04 at 11 13 52

marcelinollano avatar Aug 04 '17 09:08 marcelinollano

FWIW until this extension updates, I wrote one that just makes right-clicking on the video (full-screen or mini-player) expose the PiP controls: http://drp.joe.sh/pb-uWXRTJqlfO.png

https://twitter.com/josephschmitt/status/904044229613297664

josephschmitt avatar Sep 03 '17 19:09 josephschmitt

@josephschmitt: Thanks, but I will not install an arbitrary extension offered by some person without inspecting the source code first.

Just in case anyone is wondering the same, here's the content of plexPip.js inside the extension as of today:

(function (plex) {
  let timeout;
  
  plex && plex.addEventListener('contextmenu', (e) => {
    const button = plex.querySelector('[class*="AudioVideoFullPlayer-isVideo"]');
    const miniPlayer = plex.querySelector('[class*="MiniPlayerContainer-miniPlayer"]')
  
    const wasVideoBlocked = (button && button.contains(e.target) || (miniPlayer && miniPlayer.contains(e.target)));
  
    toggleBlock(wasVideoBlocked, button, miniPlayer);
  });
  
  function toggleBlock(disableBlock, button, miniPlayer) {  
    if (button) {
      button.style.pointerEvents = disableBlock ? 'none' : '';
    }
  
    if (miniPlayer) {
      miniPlayer.style.pointerEvents = disableBlock ? 'none' : '';
    }
    
    // Reset after a few secs
    if (disableBlock) {
      clearTimeout(timeout);
      timeout = setTimeout(() => toggleBlock(false, button, miniPlayer), 3000)
    }
  }
})(document.querySelector('#plex'));

Quite innocent. So thanks again!

herrbischoff avatar Oct 06 '17 14:10 herrbischoff

@herrbischoff be my guest, source code was linked in the tweet https://gist.github.com/josephschmitt/f0a3ab7057b0632dfb4b2bc233769077

josephschmitt avatar Oct 06 '17 15:10 josephschmitt