flash - What's more efficient: a Timer, an EnterFrame event or a basic tween with extra code? -
Greetings I am creating a video player in Action Script 3, which is supposed to be targeted at the display Large H.264 videos will be run through RTMP with less possible processor load.
There is not much control over the actual video playback part, but my view is that do not try to kill the processor with Chrome. Other spare parts of the player I have cheated the FLVPlayback and all the components, Using your Netconnection and Netstream, your own player is made from scratch, but there is no update event in the netstream class.
For this, to update the progress bar and the time passed text area, I have to create a regular event of my own, which is Netstream. Reads from Time Property and computes the progress of the video.
As far as I know, I have two ways I can do this: by adding the listener to creating a timer class insent or for an interframe event. I'm looking at the best ways to update regularly (hundreds of pairs of pairs), with minimal impact on processor loads. Which of the two could be a better option?
There is also a third solution, but it looks like a long shot for me: Create a separate animation, a basic twill that is independent of the video and only sinks on different video events. Will remove regular updates from, but only as far as I can see in the code. Apparently the animation still updates itself while playing, but I think the timer will be handled at the lower level. Of course, there will be additional code for the animation of the progress bar and the actual video playback in sync, but at least I will not have a timer with less than 30 times per second.
Which is the best way to eat at least the processor resources?
Asking which approach is the most efficient way to start the wrong way, instead of Ask for what you want to do, the approach is reasonable.
Since you are updating the share of your app's scenes, it may be wise to start with the fact that Flash updates the screen at certain times - after each frame - and before that And later events are exposed if the performance has not changed, then the most correct way to update the visuals in the ENTER_FRAME handler - is to make sure that you update your update code every time Start with it if you do not run more than the bar (you are wasting a cycle on the update which will not be drawn on the screen) or less (possibly humiliating the visual results).
Performance does not matter if using a frame handler is the right approach, then the next question is that does the frame affect performance on the handler? The best way to answer this is to have your app profile, but I can bet my home that it will not answer. Flash is rediscovering your video in any way, and until fifteen filters are not available on your progress bar, it is difficult to think that it can have any effect. In addition, even if you have decided to call your every nest frame instead of every frame, unless you make any updates, it is out of the dirty rectangle, even though every frame will be redone again, even if Whether you've moved it or not. The "saving" function in the display will be slightly higher than the call and each frame will be assigned one. Such savings will become invisible compared to simplifying the graphics in the progress bar (and thus reducing the cost of reducing it), if more performance is needed to squeeze.
Use the frame handler, say, all this is a long-staggered path, unless you can not find measurable reasons (you will not do it). If in doubt, after you finish, Try to remove the event listener and see if it makes a difference in the performance, and if this happens, deal with the problem.
Comments
Post a Comment