feat: multi-video overview in debug report

- GET_VIDEO_STATE now returns allVideos[] with summary per video element
- Copy report shows markdown table when multiple videos on page
- Table includes: resolution, muted, paused, readyState, duration, and marks selected target
- Helps diagnose Prime Video scenarios where preview vs main video both exist
This commit is contained in:
Timo
2026-06-01 15:58:31 +02:00
parent ba96cf2765
commit 21a2bfbf05
2 changed files with 39 additions and 1 deletions
+21 -1
View File
@@ -488,6 +488,24 @@
return false;
})();
// Build multi-video summary for debug reports
const allVideos = [];
const allVideoEls = document.querySelectorAll('video');
for (let i = 0; i < allVideoEls.length; i++) {
const v = allVideoEls[i];
allVideos.push({
index: i,
width: v.videoWidth || v.offsetWidth || 0,
height: v.videoHeight || v.offsetHeight || 0,
muted: v.muted,
paused: v.paused,
duration: (v.duration && isFinite(v.duration)) ? Math.round(v.duration) : 0,
readyState: v.readyState,
src: (v.currentSrc || v.src || '').substring(0, 80),
selected: v === video
});
}
if (video) {
const dataAttributes = {};
if (video.attributes) {
@@ -542,7 +560,8 @@
metadata,
videoCount,
inShadowDom,
platform
platform,
allVideos
});
} else {
sendResponse({
@@ -550,6 +569,7 @@
videoCount,
inShadowDom,
platform,
allVideos,
url: window.location.href,
pageTitle: document.title,
metadata: (navigator.mediaSession && navigator.mediaSession.metadata) ? {
+18
View File
@@ -1462,6 +1462,24 @@ elements.copyLogs.addEventListener('click', () => {
if (vs.platform) lines.push(`- **Platform:** ${safe(vs.platform, '?')}`);
lines.push(`- **Video Count:** ${safe(vs.videoCount, 0)} | **Shadow DOM:** ${vs.inShadowDom ? 'YES' : 'NO'}`);
lines.push('');
// Multi-video overview
const videos = Array.isArray(vs.allVideos) ? vs.allVideos : [];
if (videos.length > 1) {
lines.push('### All Videos on Page');
lines.push('');
lines.push('| # | Resolution | Muted | Paused | Ready | Duration | Selected |');
lines.push('|---|------------|-------|--------|-------|----------|----------|');
const rl = ['HAVE_NOTHING', 'HAVE_METADATA', 'HAVE_CURRENT_DATA', 'HAVE_FUTURE_DATA', 'HAVE_ENOUGH_DATA'];
for (const v of videos) {
if (!v) continue;
const sel = v.selected ? ' **\u2190 TARGET**' : '';
const dim = `${safe(v.width, '?')}x${safe(v.height, '?')}`;
const rs = (v.readyState != null && v.readyState >= 0 && v.readyState <= 4) ? rl[v.readyState] : '?';
lines.push(`| ${safe(v.index, '?')} | ${dim} | ${safe(v.muted, '?')} | ${safe(v.paused, '?')} | ${rs} | ${safe(v.duration, 0)}s |${sel} |`);
}
lines.push('');
}
}
// ── Connection ──