Userscript: Disney+ PiP

Disney+ disables picture-in-picture, this reenables it.

// ==UserScript==
// @name         Disney+ PiP
// @namespace    pauljones.io
// @version      0.1
// @description  Enable PiP on Disney+ videos.
// @author       Paul Jones
// @match        https://www.disneyplus.com/*
// @grant        none
// ==/UserScript==

'use strict';

(function() {
  const targetNode = document.getElementById('app_index');
  const observer = new MutationObserver((mutationsList, observer) => {
    mutationsList.forEach((item) => {
      if (item.type === 'attributes' && item.attributeName === 'autoplay') {
        item.target.disablePictureInPicture = false;
      }
    });
  });
  observer.observe(targetNode, { attributes: true, childList: true, subtree: true });
})();

Install it from the gist on Github.