Greetings. I'm building a video player in ActionScript 3, that's supposed to be targeted on performance. It has to play large h264 videos via RTMP, with the least possible processor load.
There's not much control on the actual video playback part, but my approach is to try and not kill the processor with the chrome and other additional parts of the player. I've ditched the FLVPlayback and all components and build my own player from scratch, using Video, NetConnection and NetStream, but the NetStream class does not have an update event.
Therefor, in order to update the progress bar and elapsed time textfield, I must create a regular event of my own, that reads from the NetStream.time property and calculates the progress of the video.
As far as I've figured out, I have two ways I can do that: by creating a Timer class instance or by adding a listener for the EnterFrame event. I'm looking for the best way to update regularly (each couple hundreds ms), with the least impact on the processor load. Which of the two is likely to be a better option?
There's also a third solution, but it seems like a long shot to me: create a separate animation, a basic tween, that plays independent of the video and only syncs on various video events. That would remove the regular update altogether, but only as far as I can see in the code. The animation still updates itself while playing, obviously, but I'm guessing that would be handled on a lower level than a timer. Sure, there will be extra code in order to keep the animation of the progress bar and the actual video playback in sync, but at least I won't have a timer going off 30 times per second.
Which is the best way to eat up the least processor resources?