Re: [csswg-drafts] [css-contain-2]: Pause media playback in iframes hidden by content-visibility:hidden (#6468)

I agree that it makes sense to tie this to `content-visibility`, because `content-visibility` already pauses similar work such as [CSS animations](https://github.com/w3c/csswg-drafts/issues/5611) of content, as well as the update-the-rendering loop of embedded iframes (see step 7 [here](https://drafts.csswg.org/css-contain-2/#cv-notes)).

Therefore it also makes sense to pause videos, in order to improve performance in that area related to content the user can't see.

Automatically pausing the video and resuming it when it becomes visible again is another benefit of this change. Note also the parallel with pausing CSS animations mentioned above.

Finally, I'll note that, as I understand it, web compatibility requires hidden videos in other circumstances such as being detached from the DOM, or possibly under `visibility: hidden` or `display:none` ancestors, in particular ones that play audio, to continue playing. I don't think this compatibility problem will be an impediment to making the change for `content-visibility` because `content-visibility` is a relatively new CSS property.

@dalecurtis 

-- 
GitHub Notification of comment by chrishtr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6468#issuecomment-885084177 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 22 July 2021 17:25:17 UTC