YouTube Detection Events Test

This page mocks YouTube player DOM elements to trigger the YouTubeAdDetector. Use the buttons below to simulate detection conditions, then check native debug tooling for webEvent messages with youtube_ prefixed types.

Detector status: waiting for initialization...

Simulate Detections

Simulate Login State

Every youtube_ event carries a loginState payload. The detector reads it from the DOM, checking three selectors in priority order — premium logo, then avatar button, then sign-in button — and reports unknown when none is present.

The detector resolves login state once: it re-checks at 0, 500, 1500, 3000 and 5000ms after the player root is found, latching the first non-unknown result and keeping whatever the last attempt saw — later DOM changes are ignored. Changing the dropdown after it has resolved will not affect the events that follow, so use Reload with this state for a deterministic run. ?loginState=<state> sets it at load; ?loginStateDelayMs=<ms> inserts the indicator late, so the detector reports unknown first and the real value afterwards — one page, one event type, two payloads. For example ?loginState=premium&loginStateDelayMs=3000 holds the payload at unknown for three seconds and then flips it to premium on the next re-check: fire a detection before and after to capture both. Keep the delay under 5000ms — the last re-check latches whatever is on the page at that point, and an indicator arriving afterwards is never seen.

Mock YouTube Player

Event Log

Events fired by the detector (via webEvents.fireEvent):

Waiting for events...\n