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

jridgewell has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-contain-2]: Pause media playback in iframes hidden by content-visibility:hidden ==

We have a use case where we would like the ability to pause playback of video when we mark a cross-origin `<iframe>` as being `content-visibility: hidden`.

Eg, we include an iframe to youtube video, which the user then plays. After playing, the user becomes disinterested and scrolls on to the rest of the document. After the users is far enough away, we manually mark youtube iframe with `content-visibility: hidden`. Ideally, this would pause the playback so it's no longer taking resources, audio would stop playing, and the state would be paused. If the user were to scroll back to the youtube iframe, they'd find it in the paused state at the exact point they scrolled away.

In order to achieve this currently, we actually remove the entire iframe from the document. This guarantees the media will stop playback, but it also loses the current track position. If the user scrolls back to the the youtube iframe, they'll find it reset to the 0s mark, which isn't a great experience for them.

/cc @chrishtr

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6468 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 01:00:45 UTC