mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 04:12:25 +00:00
feat(liveness): config-driven card visibility policy + probe prefetch (#5)
Makes the card liveness-visibility behavior switchable so it can be A/B feel-tested, and probes ahead of the scroll for a snappier result. - CARD_LIVENESS_POLICY (config/instance-config.js): "show-pending" (default, unchanged) | "hide-foreign" (foreign/ingested cards hidden until a source verifies; native cards stay show-pending) | "hide-all". Owner's own cards are always visible. Flip live for testing without a rebuild: window.__BITVID_CARD_LIVENESS_POLICY__ = "hide-foreign" then refresh/scroll. Implemented via a data-foreign provenance flag on the card + getCardLivenessPolicy() in cardSourceVisibility.js. - LIVENESS_PROBE_PREFETCH_MARGIN (default 600px): both liveness probes were already viewport-gated (IntersectionObserver, on-screen-first, WebTorrent priority-queued + concurrency-capped); this expands their rootMargin so cards just below the fold verify before the user reaches them. - Tests: three policy scenarios in tests/video-card-source-visibility.test.mjs; also un-broke 3 pre-existing VideoCard tests by adding the missing IntersectionObserver JSDOM stub. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
df99bdb65f
commit
ccbe8d9bb2
10 files changed
+236
-16
No files matched your search
@@ -57,11 +57,14 @@ but a WebTorrent source is live, keep the card.
|
||||
concurrency (it's cheap vs WebTorrent swarm joins).
|
||||
- WebTorrent `PROBE_TIMEOUT_MS` (20s): keep generous (swarm joins are slow) but
|
||||
ensure it runs in parallel and never blocks the CDN verdict.
|
||||
- DECISION NEEDED: **show-pending (current) vs hide-until-verified.** Showing
|
||||
pending means a brief flash of soon-to-be-hidden dead cards; hide-until-verified
|
||||
means good cards pop in after the probe. Recommend: keep show-pending for cards
|
||||
with a *bitvid-native/whitelisted* source (fast/trusted), but **hide-until-verified
|
||||
for foreign/ingested** videos (so unplayable strangers never flash in).
|
||||
- DECISION (2026-06-24): made **config-driven for live A/B testing** instead of
|
||||
hard-coding one policy. `CARD_LIVENESS_POLICY` =
|
||||
`show-pending` (default) | `hide-foreign` | `hide-all`, flippable live via
|
||||
`window.__BITVID_CARD_LIVENESS_POLICY__`. Recommendation stands: `hide-foreign`
|
||||
(native = show-pending, foreign/ingested = hidden-until-verified). Also added a
|
||||
configurable probe prefetch margin (`LIVENESS_PROBE_PREFETCH_MARGIN`, default
|
||||
600px) so cards verify before they scroll into view. Pick the final default
|
||||
after feel-testing.
|
||||
|
||||
## Reuse map
|
||||
- `js/ui/urlHealthController.js` (probeUrl / probeUrlWithVideoElement) — make
|
||||
|
||||
Reference in new issue
Block a user