Canvas video pen sampler: shrink CodePen result iframe

#458278555 P3 / S3 Status: New

Reproduction

Standalone same-origin pages do not reproduce this bug because the trigger depends on CodePen's actual cross-origin result iframe and its permission policy. This sampler embeds the real CodePen pen and lets you shrink that iframe with a slider.

  1. Open this page in Chrome Release or Canary.
  2. Slide the width slider down. Around 840px, the demo inside the iframe stops animating. Sliding back above the threshold resumes it.
  3. If sliding does not reproduce, try docking DevTools at the bottom and resizing it so it covers more than 50% of the iframe.
Open pen on CodePen
What to look for The pixelated canvas freezes once the iframe drops below the threshold; it resumes when you widen it again.
Local fallback If CodePen is blocked, see demo.html for a same-origin copy of the original code. Same-origin will not show the bug.

Notes

Likely cause: when the iframe viewport shrinks enough, the 1280px absolute child layout pushes the hidden <video> element mostly outside the iframe viewport. Combined with the cross-origin embed and its permission policy, the media element gets treated as frame-hidden and playback is paused. The canvas drawImage(video) loop keeps running but the underlying frames stop updating.

The Chromium-side fix being explored: in WebMediaPlayerImpl::ShouldPausePlaybackWhenHidden(), exempt videos that are actively being consumed (IsVideoBeingCaptured()) from the frame-hidden pause path. That includes canvas drawImage readback within the last 5 seconds.

Links

Chromium issue

Original CodePen demo

Same-origin reduction (does not repro the bug, kept for code reference)