UPDATE 8/16/2008
I have to digress from my former accusations of the FLVPlayback component. Bruce was able to figure out that his main problem was that he had encoded the flv using H.264.
We re-encoded the video with a fresh Vista-based mingw32 build of
ffmpeg including aac support and the memory problems were solved. It seems that FLVPlayback component in Flash9 doesn't release memory when loading subsequent H.264 encoded flv's? Can anyone confirm this?
We have recently had a demand for applications that play one or more FLV videos in succession,
and it turns out that this simple task gets a little convoluted in terms of memory management. There are three primary methods that I am aware of in order to play a FLV video in Flash. They are as follows:
1.Use the FLVPlayback component
2. Embed the video in the timeline
3. Use a Netconnection, and the methods of Netstream just like streaming from a media server, but use it on a local file.
Before I go into detail, I will just spill the beans that method #3 using Netstream is surprisingly the best option for memory management in my experience, even when playing local files.
The Netstream class gives you quite a bit of control over the video playback as well including fluid timeline scrubbing capability. There is an excellent flv player tutorial based on the Netstream implementation
over at the tech labs.
In the current project we are working on, users have to be able to play, rewind, and scrub the timeline of the video. External events also have to be called to change text and trigger external animations at certain timecodes in the video.
My initial thought on allowing this functionality was to embed the video in the timeline just like has been rumored that the amazingly awesome Halo3 website does. However, the flash project then takes on the entire size of the video. It also dumps it into memory when you play the swf.
The
Halo3 website uses something like 200mb of memory if you scroll through the entire scene and do all the 360 degree pans. It also never releases it. I don't think this is the software engineers fault. They have so many assets in that project I am sure its almost impossible to manage them. I am surprised they were able to keep it at 200mb.
In our testing we have seen similar behavior in the FLVPlayback component. Another project that my boss is working on requires a series of HD quality videos to be loaded in succession.
He built the application based on the FLVPlayback component. After a day of trying to force the FLVPlayback component to release memory instead of continual accumulation as each video was played, we decided to load a very small flv between the larger files, which will cause flash to release some of the memory.