mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-18 15:23:13 +00:00
36e1291d2c
The weighted score summed incomparable units, so size could outvote traits that disqualify an element outright. Measured on a real page: a display:none preload reports its full 1080p intrinsic size and scored 2073600, beating a visible unmuted player at 509920. Selection now compares an ordered list of signals, highest priority first: has a source, is rendered, is not a silent background loop, rendered size bucket, is playing, has controls, duration. Rendered size replaces intrinsic resolution, and mute state is gone from the ranking entirely: it is a viewer preference, not evidence about which element is the player. It stays a ranking rather than a filter, so a page of only bad candidates still yields one and findVideo never returns null where a video exists. The new tests/e2e suite runs the shipped finder against real fixture pages and drives the packed extension for injection, reinjection and remote play/pause/seek into a first-party frame. All five scoring scenarios fail against the previous implementation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
20 lines
696 B
HTML
20 lines
696 B
HTML
<!doctype html>
|
|
<meta charset="utf-8">
|
|
<title>Shadow DOM player</title>
|
|
<h1>Tiny light-DOM teaser, real player inside a shadow root</h1>
|
|
<video id="teaser" width="160" height="90" muted src="../media/ad-360p-5s.mp4"></video>
|
|
<div id="player-host"></div>
|
|
<script>
|
|
const host = document.getElementById('player-host');
|
|
const root = host.attachShadow({ mode: 'open' });
|
|
const video = document.createElement('video');
|
|
video.id = 'shadow-player';
|
|
video.setAttribute('data-expected', '');
|
|
video.width = 854;
|
|
video.height = 480;
|
|
video.controls = true;
|
|
video.src = '../media/player-480p-12s.mp4';
|
|
root.appendChild(video);
|
|
</script>
|
|
<script src="ready.js"></script>
|