mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-04 00:17:42 +00:00
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:
+21
-1
@@ -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) ? {
|
||||
|
||||
@@ -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 ──
|
||||
|
||||
Reference in New Issue
Block a user