Skip to content

What is the expected behavior for backgrounded tabs? #92

@aosmond

Description

@aosmond

I have a simple test case which just embeds a video, and repeatedly calls requestVideoFrameCallback on the element, which simply dumps the metadata to the console.

In Safari 17.6, when the tab is in the background, it continues to issue the callbacks. There does not appear to be any discontinuity when returning the tab to the foreground.

In Chrome 127, when the tab is in the background, it stops issuing the callbacks. The video timeline continues to advance, so that when one returns the tab to the foreground, the next callback jumps to the present timeline.

Both Safari and Chrome continue issuing callbacks regardless of whether the element is visible or not, as long as the tab is in the foreground.

In Firefox, we don't issue the callbacks if the element is invisible in a foreground tab, but I intend to correct this as that is a bug given both Safari and Chrome issue the callbacks in this scenario. We also don't issue the callbacks if the tab has been backgrounded, because 1) while we advance the video timeline, we do not produce the frames for consumption, and 2) we throttle the requestAnimationFrame callbacks as well, and there are specific expectations about requesting an rAF from an rVFC callback. That I intend to leave as is for now.

Could the specification provide some clarity regarding visibility and backgrounded tabs/windows?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions