Remove temporary Media Session interceptor and Video Event Log diagnostics

Clean up the exploratory Disney+ diagnostics now that the Shadow DOM
timeline/seek integration is in place:

- Remove Proposal 1 (Media Session interceptor): the background.js
  interceptor injection and the content.js message listener capturing
  __koalaMediaSessionCapture, plus the now-unused mediaSessionPosition
  reporting in content.js and popup.js.
- Remove Proposal 3 (Video Event Log): videoEventsLog, logVideoEvent(),
  the per-video event logging listeners, and the popup.html/popup.js UI.
- Keep Proposal 2 (DOM timestamp scraper) for ongoing diagnostics.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Timo
2026-07-02 14:18:50 +02:00
parent a9f5c0b9bf
commit 51da169d69
4 changed files with 2 additions and 104 deletions
-50
View File
@@ -1654,42 +1654,6 @@ async function devRemoteToolsAllowed() {
return data.username === 'KoalaDev';
}
const mediaSessionInterceptorHosts = [
'disneyplus.com'
];
function shouldInstallMediaSessionInterceptor(url) {
try {
const host = new URL(url).hostname.toLowerCase();
return mediaSessionInterceptorHosts.some(h => host === h || host.endsWith('.' + h));
} catch (_e) {
return false;
}
}
function installMediaSessionInterceptor() {
if (window.__koalaMediaSessionInterceptorInstalled) return;
window.__koalaMediaSessionInterceptorInstalled = true;
if (!navigator.mediaSession || typeof navigator.mediaSession.setPositionState !== 'function') return;
const originalSet = navigator.mediaSession.setPositionState;
navigator.mediaSession.setPositionState = function(state) {
try {
window.postMessage({
__koalaMediaSessionCapture: 1,
state: {
duration: state?.duration,
playbackRate: state?.playbackRate,
position: state?.position
}
}, '*');
} catch (_e) {
// Suppress errors to not interfere with player
}
return originalSet.apply(navigator.mediaSession, arguments);
};
}
function shouldUsePageApiSeek(url) {
return typeof globalThis.koalaFindPageApiSeekProvider === 'function' &&
!!globalThis.koalaFindPageApiSeekProvider(url);
@@ -1733,12 +1697,10 @@ function setPageApiSeekEnabled(enabled) {
async function injectContentScript(tabId) {
let needsPageApiSeek = false;
let pageApiSeekReady = false;
let isMediaSessionCapable = false;
try {
const tab = await chrome.tabs.get(tabId);
const url = tab?.url || '';
needsPageApiSeek = shouldUsePageApiSeek(url);
isMediaSessionCapable = shouldInstallMediaSessionInterceptor(url);
} catch (_e) {
// Fall through to the generic content script injection.
}
@@ -1761,18 +1723,6 @@ async function injectContentScript(tabId) {
}
}
if (isMediaSessionCapable) {
try {
await chrome.scripting.executeScript({
target: { tabId },
world: 'MAIN',
func: installMediaSessionInterceptor
});
} catch (err) {
addLog(`Media Session interceptor injection failed: ${err.message}`, 'warn');
}
}
await chrome.scripting.executeScript({
target: { tabId },
files: ['page-api-seek-overrides.js']