1

I have a video tag with the autoplay attribute on. It's "hidden" in that it's nested in a container with display: none applied.

However, CPU usage for this page's tab in Chrome seems idling high (around 20%). There is nothing else on the page.

Do video tags pause autoplaying when hidden? For reference, WebKit-based Safari in iOS 10 pauses autoplaying on the video tag when not visible on screen (https://webkit.org/blog/6784/new-video-policies-for-ios/). But I'm unconfirmed if Chrome does, since it uses the Blink fork of Webkit.

Chrome Mac 55.0.2883.75 (64-bit)

chimerical
  • 5,413
  • 7
  • 29
  • 35

1 Answers1

0

From the w3c docs:

autoplay = "autoplay" or "" (empty string) or empty

Instructs the UA to automatically begin playback of the video as soon as it can do so without stopping.

Property display: none will only prevent the element from being displayed, it will be loaded nevertheless. The display:none does not preventing video from loading. So as video available to play it will be played.

Here is the question about image loading with display:none.

Community
  • 1
  • 1
Farkhat Mikhalko
  • 3,347
  • 3
  • 21
  • 34
  • Thanks! That's a good reference about display: none and image loading behavior. I do wonder if this still applies to video in Chrome though, since it's still up the browser vendors. The closest hint I can find so far is this: "Muted autoplay will work for any visible video element in any visible document, iframe or otherwise." So could I assume that it wouldn't work if it weren't visible? https://developers.google.com/web/updates/2016/07/autoplay – chimerical Dec 10 '16 at 23:41