-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the expected behavior for backgrounded tabs? #92
Comments
As a webdeveloper that utilizes the rFVC's I would like to additionally ask if it is possible to take into account what influence such an offscreen video's rFVC has on the values in the VideoPlaybackQuality interface. Because currently in Chromium an offscreen video does still fire rVFC's, but this currently also has the side effect that it increases the So, this behavior in Chromium currently requires me, as a webdeveloper, to write a workaround to prevent the video resolution from dropping (and false-positive reports of playback problems in analytics tools). A real-world example is YouTube, which drops the video resolution for a long time when this happens. I have reported this issue to Chromium developers, which are currently wondering if this is the expected behavior: https://issues.chromium.org/issues/40727525#comment29 |
…videos. r=media-playback-reviewers,padenot When a tab is backgrounded, or on some platforms, when the window is fully covered, full decoding of a video for playback is disabled. The video timeline still advances, but there are no valid frames for presentation. Similarly, if an HTMLVideoElement is in the DOM tree but marked as invisible (e.g. 'display: none;' is set), we also cease full decoding of a video. This is the VideoDecodeMode::Suspend mode. Chrome and Safari both continue to honour requestVideoFrameCallback when the video element is invisible in a foreground tab. Conversely, when we are in a backgrounded tab, Chrome suspends rVFC callbacks, while Safari continues. Given that we suspend requestAnimationFrame callbacks similar to Chrome for backgrounded tabs, this patch matches our behaviour with Chrome. The standard does not discuss the implications of visibility and background/foreground on rVFC. We have filed an issue requesting for clarification, and that can tracked at: WICG/video-rvfc#92 Differential Revision: https://phabricator.services.mozilla.com/D220274
We may want to address the integration with VideoPlaybackQuality in https://w3c.github.io/media-playback-quality/ (along with other integration points such as w3c/media-playback-quality#19). |
…videos. r=media-playback-reviewers,padenot When a tab is backgrounded, or on some platforms, when the window is fully covered, full decoding of a video for playback is disabled. The video timeline still advances, but there are no valid frames for presentation. Similarly, if an HTMLVideoElement is in the DOM tree but marked as invisible (e.g. 'display: none;' is set), we also cease full decoding of a video. This is the VideoDecodeMode::Suspend mode. Chrome and Safari both continue to honour requestVideoFrameCallback when the video element is invisible in a foreground tab. Conversely, when we are in a backgrounded tab, Chrome suspends rVFC callbacks, while Safari continues. Given that we suspend requestAnimationFrame callbacks similar to Chrome for backgrounded tabs, this patch matches our behaviour with Chrome. The standard does not discuss the implications of visibility and background/foreground on rVFC. We have filed an issue requesting for clarification, and that can tracked at: WICG/video-rvfc#92 Differential Revision: https://phabricator.services.mozilla.com/D220274
…videos. r=media-playback-reviewers,padenot When a tab is backgrounded, or on some platforms, when the window is fully covered, full decoding of a video for playback is disabled. The video timeline still advances, but there are no valid frames for presentation. Similarly, if an HTMLVideoElement is in the DOM tree but marked as invisible (e.g. 'display: none;' is set), we also cease full decoding of a video. This is the VideoDecodeMode::Suspend mode. Chrome and Safari both continue to honour requestVideoFrameCallback when the video element is invisible in a foreground tab. Conversely, when we are in a backgrounded tab, Chrome suspends rVFC callbacks, while Safari continues. Given that we suspend requestAnimationFrame callbacks similar to Chrome for backgrounded tabs, this patch matches our behaviour with Chrome. The standard does not discuss the implications of visibility and background/foreground on rVFC. We have filed an issue requesting for clarification, and that can tracked at: WICG/video-rvfc#92 Differential Revision: https://phabricator.services.mozilla.com/D220274
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?
The text was updated successfully, but these errors were encountered: