• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Flash object with 0x0 dimensions = performance hit

New Here ,
Oct 21, 2013 Oct 21, 2013

Copy link to clipboard

Copied

The basic scenario is that I'm doing RTMP playback in a Flash app that basically only deals with sound. There are no graphical elements, and it interacts with the page only using the ExternalInterface and method calls / callbacks, therefore we have set the height and width of the object in the HTML page to 0.

Unfortunately the result seems to be that at least 500ms latency is added to any RTMP playback - connecting the NetConnection to the FMS server, starting the NetStream and then seeking within that stream. Raise the dimensions of the Flash object in the page to at least 1x1 and the performance returns to normal acceptable levels.

I've experimented a bit with the Stage settings to see if it is some oddity relating to alignment, scaling etc but to no effect. Is this a bug?

TOPICS
ActionScript

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 21, 2013 Oct 21, 2013

Copy link to clipboard

Copied

I've not heard of this issue, does this happen in all browsers? I just looked and Pandora embeds its SWF at 0x0.

-Aaron

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 22, 2013 Oct 22, 2013

Copy link to clipboard

Copied

I've only tested on Mac so far, but can reproduce on Chrome, Safari, Firefox and Opera.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 26, 2013 Oct 26, 2013

Copy link to clipboard

Copied

If the issue exists when you set the dimensions to 0x0, don't set the dimensions to 0x0.  Unless you're just geeking out on weird rules or issues.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 26, 2013 Oct 26, 2013

Copy link to clipboard

Copied

I'd prefer to find an actual solution, not just cargo-cult my application.

If there is an actual bug it needs to be filed, and if there is a bug in my application I'm not aware of I need to know the actual reason of it rather than just stabbing in the dark randomly.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 28, 2013 Oct 28, 2013

Copy link to clipboard

Copied

It sounds like a bug to me, I can't think of any good reason a 0x0 SWF should affect NetConnections/Streams. Therefor any solution I would consider a hack. I would try the different wmodes -- I don't know what you're currently using, but wmode=transparent is known to be rather buggy.

I would also suspect framerate. What is your SWF framework? What is the measured framerate? Here's a theory: perhaps when you set the SWF to 0x0 the Flash Player throttles the framerate down to 2fps (500ms per frame) which could cause a delay in event processing for NetConnection (it seems like it shouldn't but maybe it does?)

Cheers.

-Aaron

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 29, 2013 Oct 29, 2013

Copy link to clipboard

Copied

Hi Aaron,

I tried all of the wmodes and there was no difference. I also tried the different values for the scale option (as documented here: http://helpx.adobe.com/flash/kb/flash-object-embed-tag-attributes.html) also without any change. I'm not sure what you mean by SWF framework - in terms of embedding our production code uses swfobject but my test code uses just plain html and javascript, and outside of the regular Flash API we use nothing else.

That's an interesting idea about the framerate throttling and timing the actual framerate - I'll give it a shot.

What's also interesting is that Adobe Flash plugin exhibits the behaviour when the object is less than 1x1 on the page, whereas Google Pepper plugin requires the object to be 1x7 at least.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 28, 2013 Oct 28, 2013

Copy link to clipboard

Copied

If you have the time and the desire to explore why it's happening, enjoy. 

Since the beggining of web browsers, placing anything on the page with 0x0 dimensions has been suspect.  Check into security.  Something embedded at 0x0 may not be allowed to work.  And like Aaron said, check into what the browser does to flash when the flash is not "visible" in the browser.

And get your code up.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 29, 2013 Oct 29, 2013

Copy link to clipboard

Copied

What you say is odd, since we only noticed this recently, and other Flash applications seemingly run fine embedded at 0x0 (someone pointed out to me that Pandora has a similar 0x0-embedded Flash app for playing music). There are no security errors being reported (and I'm capturing them in the trace file with the debug player) - and after all - everything is working, just slower than expected.

If you are really interested, here is the code I'm testing with currently:

https://gist.github.com/ohookins/7210883

https://gist.github.com/ohookins/7210927

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 29, 2013 Oct 29, 2013

Copy link to clipboard

Copied

"SWF framework" was a typo, I meant "SWF framerate"... I think you already got my idea, but basically what I was getting at is that you have the framerate you set the SWF to (aka stage.frameRate) and then you have the actual framerate the SWF is playing at, which Flash Player definitely throttles in some cases (such as when the SWF is hidden, etc), so maybe it throttles it when the size is 0, and if so I wonder if framerate affects network event processing. SWFs are deeply tied to their framerate, even the Timer object has dependencies on the actual framerate. If this theory is right, you could probably simulate the same latency issues by simply setting the stage.frameRate to 1 or less.

As for Pepper Flash, I'm not surprised -- Google seems to put a number of different requirements that result in subtle (or sometimes not so subtle) differences and bugs compared to the Adobe plugin.

-Aaron

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 30, 2013 Oct 30, 2013

Copy link to clipboard

Copied

LATEST

Measuring the framerate internally as you suggest does show numbers that agree with what I was seeing in Adobe Scout - with an object size on the page of 0x0 I get 2.9fps, 5.9fps and then it hovers around 9.5fps thereafter.

With dimensions of 1x1 the frame rate is 16.1fps, 21.3fps and then hovers around 25fps. Interestingly, if you move to another tab so that the content is not visible, it goes down again to around 9fps.

So it seems very likely to be "intelligent" throttling by the Flash plugin when the content is not visible, either by becoming obscured by other tabs or by not having non-zero dimensions.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines