Hieu Nguyen Trung
Hieu Nguyen Trung

Reputation: 1622

Read information from FLV file in AS3

im just new in AS3 so i have a question hope you guy can help!

I am now using FancyUpload to make an upload tool for my website, for the video module, so user can upload their video in FLV format with limited size and time

With the limited size i can handle it, but with the time ... :( I dont know how to know the total length of FLV file Hope you guys can help, and sry 4 my E lol

Upvotes: 0

Views: 1564

Answers (2)

catholicon
catholicon

Reputation: 1165

Although a correct 'flv' file 'should' contain correct length in the metadata tag. But, I have found that it's more error-resilient to get time-stamp from the flv file itself.

Check out the flv spec at http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. If it's just a the *.flv file that you are worried about that then Annex-E is all you need to look in this spec. Basically, the last 4 bytes would tell you the length of last tag in the flv file. So read the last tag in the file and then get the timestamp of that tag. This should be a tell you the length of the video.

Moreover, I assume you are trying to these check at client side itself. So, I'd say that put the check on size before loading the file to read/parse it.

Upvotes: 0

PatrickS
PatrickS

Reputation: 9572

The duration of the FLV is contained in the metadata property, check the docs for more info on how to retrieve this data.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/video/FLVPlayback.html#metadata

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#event:onMetaData

Upvotes: 1

Related Questions