views:

23

answers:

1

I am trying to dynamically resize an flv playing back in a flash player. To do this, I need to get the flv's width/height so I can maintain the original aspect ratio.

I have noticed that in Firefox the onMetaData event will be hit right away, and the video will resize properly. In IE however, onMetaData is not hit until the buffer is full and video starts playing.

One solution I have thought of is to set the initial buffer to something close to 0 (e.g. 0.01). Then the buffer will instantly hit full, and the video will be resized.

The issue I have with this is low bandwidth users will have a a short 'sputter' of video (0.5 seconds say) at the beginning before it goes to the next, larger, buffer.

Is there any better way to deal with this behavior in IE? Can you manually "get" the metaData from an FLV file before it even plays?

A: 

It is possible to load the FLV and read the bytes as a ByteArray and get the metadata from this. The metadata info should be in the file header. I'm not sure if this is the best approach though. You could probably just load in the first X amount of bytes to get the FLV file header, so that you don't need to load the whole FLV twice.

Here is this in action: an FLV tool I built a while ago that does this (with a local FLV). This loads the complete file, but you obviously would only want to load the header.

danjp
That looks like it could be useful. I did not see the source though?
David