'sourceopen' event not fired when chrome tab is in background
Reported by
bryanshe...@gmail.com,
Feb 23 2017
|
|||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 Steps to reproduce the problem: 1. Open this fiddle in chrome (https://jsfiddle.net/6f6L1ke4/2/), and use middle-button to click on the link "middle-button click me"; 2. Wait for a few seconds and then navigate to the new tab; 3. Verified that the time it takes to emit the 'sourceopen' event was similar to the waited duration. What is the expected behavior? We expected to see the 'sourceopen' event fired immediately after .src is set. What went wrong? 'sourceopen' is not fired for a tab in background Did this work before? N/A Does this work in other browsers? Yes Chrome version: 56.0.2924.87 Channel: stable OS Version: OS X 10.12.1 Flash Version:
,
Feb 23 2017
,
Feb 24 2017
IIRC we only start the video when the tab is visible. I'm not sure when the source selection algorithm will run. CC sandersd and avayvod to confirm.
,
Feb 24 2017
,
Feb 25 2017
Is this the intended behavior? On firefox, "sourceopen" is called immediately regardless whether the tab is background or not
,
Feb 25 2017
This is the intended behavior. Chromium defers loading of background video on all platforms. As I understand it, this is partly a resource optimization, but mostly a correctness issue related to prerendering. When prerendering is fully removed (issue 678332), we may change this strategy. (That is, rely more heavily on background pause, background video track removal, and background suspend.)
,
Feb 25 2017
FYI, the relevant code path is ChromeContentRendererClient::DeferMediaLoad(), see https://cs.chromium.org/chromium/src/chrome/renderer/chrome_content_renderer_client.cc?l=627.
,
Feb 28 2017
And I've just realized that I linked to a restricted issue. The prerendering design is http://goo.gl/EJjTCM and there is an Intent to Implement on the blink-dev mailing list.
,
Mar 1 2017
Thanks. Is there an API for the page to know that 'sourceopen' is blocked because of this restriction?
,
Mar 1 2017
The Page Visibility API can be used to determine both whether the page is hidden and whether it is prerendering. There is no API to directly test whether loading is deferred (the spec does not require the browser to complete the load steps quickly). Note that autoplay restrictions (which apply to play() rather than load()) are different; play() returns a Promise which will be rejected when autoplay is prevented. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by bryanshe...@gmail.com
, Feb 23 2017