On a recent project my team encountered a very annoying bug in ActionScript 3.0 when reversing the playback of an Embedded Video on the timeline.
When playing the video forwards everything ran smooth, the processor usage remained low and the memory consumption remained low as well. When playing the video backwards, using mc.gotoAndStop(frame), the processor usage shot way up and the memory consumption went over a GB and in some cases over 2 GB.
At first we figured it was due the the extra computing Flash Player needed to do in order to calculate the difference between keyframes in the video when playing it in reverse. FLVs are encoded to play forwards with a keyframe containing all the pixel data, then subsequent frames containing only the data of the pixels that have changed since the last keyframe. When playing in reverse Flash Player would need to read from multiple frames to determine how the current frame should be rendered. This takes additional processing power. The thing is, we had a keyframe on every single frame, so this could not be the issue.
Next we figured it might be due to smoothing the video. We needed to scale the video up and down so this was not something we could do without, but it was worth looking into anyways. We applied smoothing to the video, after loading it from an external SWF at runtime, by getting a reference to the Video object using this code:
var videoFLV:Video = _video.getChildByName('flv') as Video;
videoFLV.smoothing = true;
We removed the smoothing and still no luck.
Finally we stumbled onto the issue by accident. When replacing the video on the timeline I forgot to give the Embedded Video object an instance name. All of the sudden the video was playing great in both directions but it did not have smoothing on because our code had no reference to the video object. When I added the instance name back, it ran slow again. After hours of tests and searching the internet for information, we figured it out. Adding an instance name to your video object will wreak havoc on your processor and memory usage when playing in reverse.
Our solution to re-add smoothing was to get a reference to the Embedded Video object using the following code:
var videoFLV:Video = _video.getChildAt(0) as Video;
videoFLV.smoothing = true;
I hope you find this article helpful and if you have any insight about this bug please comment.
Fraser
P.S. I am not sure if it makes a difference, but we were using an ActionScript Project in Flash Builder 4 compiled for Flash Player 9.0.124.
I am having the same problem. Although I have not given instance name for my embedded video, it still kindof freezes when rewinding. I thought maybe it is the matter of video size (1200×700 in my case). Could you share the code?
I have an embedded FLV with some timeline tweens (like subtitles) over the FLV layer. The movie itself is about 3 minutes long.