tags:

views:

326

answers:

1

Hi all,

I'm building a flash site that uses video transitions to go from section to section. Each section's background is a still-frame photo at higher res than the transition videos themselves, which are scaled up during transition. The first frame of each video transition is the current background image, and the last frame of each video transition is the destination's background image. Roughly speaking, this is the intended flow of navigation on the site:

Resting state:
hi-res image in foreground, no video elements

User clicks item on navigation:
Flash prepares an FLV via a netstream object and buffers it, which is accomplished through the netstream.play() function. Upon receipt of the "Netstatus.Buffer.Full" event, the netstream object is paused and attached to a video object, which is then added to the display list behind the hi-res image in the foreground. As soon as the video object has been added to the stage, the hi-res image in the foreground alphas out (via tween), leaving only the background video. When the foreground is finished tweening, the video in the background plays. As soon as "NetStream.Play.Stop" is received, the process happens in reverse; that is, a new hi-res foreground image tweens in over the video layer, and the video is removed from the stage as soon as that's done.

I don't think there's anything wrong (at least in principle) with the flow I've outlined above, and it doesn't sound like it should be that tricky to do. However, I've had no end of problems with the initial setting up of the FLV/video object. At first, it seemed that the FLV wasn't queuing up properly, by which I mean that the hi-res foreground image tweened out to reveal a white screen, and the video popped in and only began playing after a second or two. (The first frame of the FLV is definitely not white).

I had no idea what might have been causing this behavior, but hackishly threw in a timer that plays the netstream for about 100 ms after "Buffer.Full" is received, thereby advancing the video past whatever might have been causing the white screen. This worked well locally but as soon as I put the site on a dev host, it was back to the white screen during transitions. The annoying thing is that bumping the hackish delay up to about 2 s got rid of the white screen problem on remote servers, but results were unpredictable; depending on connection speed, you might see everything work perfectly, or you might get thrown into a video that had already been playing for a second or two.

I've also tried similar approaches using bytesLoaded/bytesTotal instead of netStatus events, to no avail. My last experiment was using cuepoints; during FLV encoding, I threw in a cuepoint 0.2 seconds into the FLV and waited for THAT before tweening out the foreground; once again, it worked locally, but I was treated to a tween-to-white before the video kicked in when testing on a remote server.

I'm really running out of ideas here and would very much appreciate any advice you guys can offer. Thanks very much for your time and consideration!

Justin

+1  A: 

FLVs are tricksy beasts at times.

I'm going to see if I can dig up some code I wrote a while back to handle all of this. In the meantime I like your idea about cuepoints, and I know why you're running into trouble with them. Cuepoints are actually tied to keyframes - so you need to make sure your cuepoint is placed AFTER your second keyframe - that will ensure that at least the first keyframe of video has been displayed.

Branden Hall
Thanks for getting back to me, Branden...I'm looking forward to seeing your code! In the meantime I'll check into cuepoints; I used On2 Flix Pro's default setting of maximum 150 frames between keyframes, but there's a lot of motion in this video so I wouldn't be surprised if keyframes are significantly more frequent. At any rate, it's probably worth re-encoding with very frequent keyframes at least for the sake of argument.
justinbach
I tried setting a cuepoint at a quarter of a second into the movie with keyframes set to be every 5 frames. The movie's at 24 frames/second so you'd expect there to have been at least 2 keyframes by the time the time the cuepoint was triggered, but no dice--still getting the white background. Any luck with the old code?Thanks!
justinbach
I was abble to track down some code and interestingly, in the best stuff I found I'm using the FLVPlayback component with no skin. I then use the VideoEvent.READY event to check to see if the video is ready and off I go. Overall FLVPlayback seems to do a decent job making the kind of problems you are dealing with go away, though it does require about 60k.
Branden Hall
Wow! I can't believe it, but FLVPlayback definitely came to the rescue on this one. Ordinarily I steer clear of that thing like it's week-old dirty laundry, but today it helped me out. Your suggested workflow was perfect and resolved all the glitching...thanks so much!
justinbach