html icon indicating copy to clipboard operation
html copied to clipboard

Need for programmatic detection of flashing content in <video> elements (accessibility safety concern)

Open yashrajbharti opened this issue 7 months ago • 2 comments

What problem are you trying to solve?

Problem

There is currently no way to programmatically detect if a <video> element is rendering flashing content, specifically, visuals that flash more than three times per second.

This type of content is known to trigger seizures in individuals with photosensitive epilepsy, and cause issues for people with vestibular or motion sensitivity disorders.

Use Cases

On dynamic platforms (e.g., Instagram, TikTok, YouTube), developers embedding videos or building moderation/review tools have no way to detect such flashing content, because:

  • The videos are user-uploaded and unpredictable.
  • There is no DOM or JavaScript-level method to analyze rendered visual frames for flashes.

Apple provides a native detection implementation in their system-level accessibility APIs:

  • https://developer.apple.com/documentation/mediaaccessibility/flashing-lights
  • https://github.com/apple/VideoFlashingReduction

But no web-standard method exists.

Requested Capability

A standardized way (e.g., an observer or flag) to programmatically:

  • Detect whether a <video> contains flashing content that exceeds known safety thresholds.
  • Optionally inspect this in real time or at load time, to give developers a chance to warn users or take action.

Why It Matters

This is important for accessibility and WCAG compliance, particularly WCAG Guideline 2.3.2 (Three Flashes) at AAA level.

I am not proposing a specific implementation, just surfacing the gap and encouraging discussion about what kind of API or exposure model would make this feasible on the web platform.

What solutions exist today?

No response

How would you solve it?

No response

Anything else?

No response

yashrajbharti avatar May 25 '25 22:05 yashrajbharti

This seems desirable as a goal, but I see a potential difficulty with getting it implemented in a way people will use.

Video decoding isn't bit for bit exact, so even with an exact definition of flashing, different implementations might give different answers for the same video file. A user agent might decide that a video's safe, then send it to a server, then the server's validation might decide that it isn't safe, even when everyone's following the letter of the spec.

Without a way to be sure the server and client algorithms will agree for any given input, I think many Web authors might end up deciding not to use this feature on the client side at all.

pshaughn avatar May 29 '25 12:05 pshaughn

I built a simple browser-based flash detection tool using JavaScript and canvas. It analyzes real-time brightness fluctuations in video and raises an alert when rapid flashing occurs.

You can run it entirely client-side, as long as CORS issues are handled (e.g. via localhost).

This could serve as a baseline for accessibility testing (e.g., for epilepsy-triggering flashes), or be adapted into a user-uploaded video safety checker.

Here's the script: `

Flash Detection Debug

Flashing Video Detector (Debug Mode)

Waiting for video...
` below the tested video https://www.youtube.com/watch?v=B4wSFjR9TMQ

Image

amrouchk avatar Jun 19 '25 02:06 amrouchk

There’s a privacy preserving proposal for this in WebVTT:

  • https://github.com/w3c/webvtt/issues/512

Which is blocked by:

  • https://github.com/w3c/webvtt/issues/511

Which is waiting on this PR review:

  • https://github.com/w3c/webvtt/pull/523

cookiecrook avatar Jul 08 '25 08:07 cookiecrook

I propose this be closed as a duplicate of:

  • https://github.com/w3c/webvtt/issues/512

cookiecrook avatar Jul 23 '25 23:07 cookiecrook

That sounds reasonable to me, as that proposal is quite fleshed out and seems to have momentum behind it. If people disagree and think there's something more suitable for HTML than VTT, let us know in this closed thread.

domenic avatar Jul 24 '25 00:07 domenic

I believe a major part of this thread's suggestion isn't covered by the VTT proposal, although I don't have much opinion about whether that part belongs in HTML. Specifically, this thread brings up the idea of an API that can take an unannotated video and detect, from the video frames themselves, whether it has flashing in it. The VTT type proposal describes cases where some process has already done that detection and now wants to annotate the video with the result.

pshaughn avatar Jul 24 '25 12:07 pshaughn