开发者

Read information from FLV file in AS3

开发者 https://www.devze.com 2023-01-23 02:08 出处:网络
im just new in AS3 so i have a question hope you guy c开发者_JAVA技巧an 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

im just new in AS3 so i have a question hope you guy c开发者_JAVA技巧an 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


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消