Power Saver Plugin Throttle Event Timing

81 views
Skip to first unread message

Nate Lypnsky

unread,
Nov 12, 2015, 11:57:32 AM11/12/15
to Chromium-dev
Hi all

- not sure if this is the right forum or not - 

I'm trying to detect when Chrome will make flash content click-to-play in the browser when the power saver plugin is enabled. 
There has been a similar discussion on Stack here:

I've built a test harness is JS and AS3, and I can reliably detect throttle events from the browser. I am observing that the flash content can be throttled and made click-to-play anywhere between 0 and 6 seconds after it is loaded into the page.

How is this time decided by Chrome? Is it possible to know when Chrome will start making flash content on a page click to play?

Thanks!

Ryan Schoen

unread,
Nov 12, 2015, 12:20:30 PM11/12/15
to n4t...@gmail.com, chromium-dev, Rachel Blum, Tommy Li
Hey Nate,

Thanks for reaching out about this. You're right that the throttle event is not always timed the same. We use a heuristic to detect the first "interesting" frame, essentially the first non-solid-color frame. We do this to hopefully pause on something meaningful, as opposed to a blank loading screen.

To fully control the frame that's shown, we recommend using the poster parameter. In this case, the plugin will not be automatically loaded and instead the poster image will be displayed until the user clicks.

Hope that helps!
Ryan

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Nate Lypnsky

unread,
Nov 12, 2015, 12:49:40 PM11/12/15
to Chromium-dev, n4t...@gmail.com, gr...@chromium.org, tomm...@chromium.org
Hi Ryan, that's very helpful info. Thanks!
-Nate

Nate Lypnsky

unread,
Nov 13, 2015, 3:37:45 PM11/13/15
to Chromium-dev, n4t...@gmail.com, gr...@chromium.org, tomm...@chromium.org
Just a quick follow-up - and I know this is a bit off topic for this forum so I apologize - but would you or anyone else here happen to know if Safari and Firefox use a similar heuristic approach to pausing flash content?
I've read over some articles of how Safari pauses its flash content, but I can't seem to reliably predict when it will pause content in my test harness.

Thanks again, the poster parameter was super helpful btw!
-Nate

Rachel Blum

unread,
Nov 16, 2015, 5:04:15 PM11/16/15
to Nate Lypnsky, Chromium-dev, Tommy Li
Both share their source, so it's probably possible to find out - unfortunately, I don't have direct links. 

Saurabh Guru

unread,
Nov 20, 2015, 5:43:18 AM11/20/15
to Chromium-dev, n4t...@gmail.com, gr...@chromium.org, tomm...@chromium.org
Hi Ryan,

I see an instance where even though user has not clicked on the play button after the video being paused, I get a ThrottleEvent with state resume, after another JS attempts to start the video.
Is this a bug you know about? 

When the throttle happens, would it stop from any code being executed in the SWF? I guess not, from my experience.

Thanks,
Saurabh

Ryan Schoen

unread,
Nov 23, 2015, 1:36:00 PM11/23/15
to sg...@zedo.com, Chromium-dev, n4t...@gmail.com, gr...@chromium.org, tomm...@chromium.org
Hi Saurabh,

I'm not aware of this issue. Please file a bug at crbug.com/new, and you can send it to me for triage.

The code is not stopped on throttle, just run at a slower rate.

Ryan

Saurabh Guru

unread,
Nov 23, 2015, 2:30:13 PM11/23/15
to Chromium-dev, n4t...@gmail.com
Hi Nate,

I am working on something similar, trying to detect when a Flash SWF is waiting in a Click-to-Play state. I haven't been able to totally rely on the Throttle Events although. I have seen the throttle event firing even when Flash meets the "Essential" rules and is not going to get blocked. Also, the throttle events would keep on firing as and when the Flash Object goes on and off the view.

Any leads on how did you get it working for yourself?

Thanks,
Saurabh

Nate Lypnsky

unread,
Nov 23, 2015, 3:52:26 PM11/23/15
to Chromium-dev, n4t...@gmail.com, saurab...@gmail.com
Hi Saurabh,

Yea I've seen this behavior as well. As far as throttle events firing when the flash object goes on and off the view, this is completely normal. Browsers will pretty much always throttle the swf when it isn't in view, so you should see pairs of pause/resume throttle events when you scroll away/back over a swf.

As far as the throttle event firing when the swf shouldn't be blocked, that's a little harder to diagnose, but I couldn't really find any "essential" rules governing when flash content will be blocked. Sure, it has to do with the size of the flash object, etc, but I think it's ultimately up to the browser. Plus these rules are probably going to change in future versions anyway.

I built a simple test page to test all of this stuff, and honestly, my results are somewhat inconclusive. Chrome I can detect reliably with the "poster" tag that Ryan suggested a few posts earlier in this thread, but Safari and other browsers are less reliable. Basically, the solution that I've ended up going with for the time being is to detect if flash is blocked, if it isn't, inject a swf and wait a short period to see if it's throttled. If yes, serve up non-flash content, otherwise, serve up the flash.

Hope this helps!

Nate Lypnsky

unread,
Nov 24, 2015, 12:11:40 PM11/24/15
to saurabh guru, Chromium-dev
Yea the poster tag approach is kinda indirect, unfortunately. My understanding is that if you supply a flash object with a poster tag and hand it to Chrome, Chrome will immediately display the supplied poster if it was planning to throttle the content (as opposed to waiting until it's heuristic finds an 'interesting' frame to pause on). However, in my testing I couldn't really capture a throttle event at this phase, and honestly, this is still a bit of an open problem for me. For some reason, I am unable to query the external interface of the swf when the poster is displayed, so I use that factor to determine if flash is throttled or not. But there is probably a better way.

For the second part, yes you could see throttles for what I can only assume are any number of reasons. But you can inspect the type of the throttle event and try to make some decision based off that (e.g. if I see pause/resume, I can infer that the user probably just scrolled away from my content, which is ok).

On Mon, Nov 23, 2015 at 10:53 PM, saurabh guru <saurab...@gmail.com> wrote:
Thanks Nate.  This helped.

How are you detecting, Flash is in Click-to-Play state/Blocked with the poster tag in Chrome? I am looking to do this only for Chrome right now. 

Even if you inject an SWF, couldn't you run into the same situation where you see a throttle, but the SWF is actually not getting paused.blocked?
--
Thanks,
Saurabh

:)



--

Nate Lapinski

Co-Founder & CTO | SocialQs

www.socialQs.co | @socialQsApp

na...@socialQs.co | 720-237-4422

Reply all
Reply to author
Forward
0 new messages