If I check "Enable Video Player UI Patching", none of the subsequent options in the settings menu does anything.
In customUI.js, if I sleep the script for 8 seconds before checking if (document.readyState === 'complete' || document.readyState === 'interactive'), then applyPatches() is run and installs YtlrPlayerActionsContainer, but the hooked function is never called (at least after the toast system is loaded, which I'm using as printf debugging). Simulating in Firefox I also found that the hooked function is never called after I add a breakpoint (and it's difficult to programmatically breakpoint)
If I queue up messages and print them repeatedly so they're shown when the toast system is up, the last code reached is `window.addEventListener('DOMContentLoaded', applyPatches); The same thing happens when I had AI generate a persistent on-screen console accessible by TizenTube's code (your diagnostic view treats TizenTube as a black box, and cannot be directly manipulated by the userscript either).
I think there's a bug in (my version of) the YouTube app's addEventListener(DOMContentLoaded) where it can never fire even when document.readyState is currently "loading". We'd have to fall back to "load", and avoid invoking applyPatches but instead a "call once" function shim so we don't run applyPatches() twice and stack two layers of YtlrPlayerActionsContainer if both listeners succeed.
log("document.readyState =", document.readyState);
if (document.readyState === 'complete' || document.readyState === 'interactive') {
applyPatches();
} else {
let hasRun = false;
const applyPatchesOnce = () => {
if (hasRun) return;
hasRun = true;
return applyPatches();
};
log(`window.addEventListener('...', applyPatches)`);
window.addEventListener('DOMContentLoaded', applyPatchesOnce);
window.addEventListener('load', applyPatchesOnce);
}
This works, but is a hack for a platform not officially supported by TizenTube, so is it worth upstreaming?