swf_file

A Ruby Gem based on swfutil lib, by Dennis Zhuang. SWF File is lightweight gem to read swf file headers from within a Ruby application.

Ruby compatibility

Target version: 1.9.2dev Also compatible with: 1.9.1 and 1.8.7

Not tested with versions under 1.8.7. Should you use this lib with other ruby versions, please provide feedback.

Install

gem install swf_file

LICENSE

Please refer to the LICENSE file.

Example

header = SwfFile::FlashFile.header 'clicktag.swf' # load the file
# Access the various header options. Please check the unit tests for more usage examples.
puts header.size
puts header.compressed?
puts header.version
puts header.bit_count
puts header.xmax
puts header.ymax
puts header.width # In pixels
puts header.height # In pixels
puts header.frame_rate
puts header.frame_count
puts header.duration # In milliseconds
puts header.avm_version
puts header.signature
# You can also pass a block to SwfFile::FlashFile.header
puts SwfFile::FlashFile.header 'clicktag.swf' { |h| puts h.duration }
# It's also possible to create instances of SwfFile::FlashFile
swf = SwfFile::FlashFile.new 'clicktag.swf'
swf.header # => SwfHeader class instance equivalent to the return of SwfFile::FlashFile.header(<file>)
swf.header.duration
# Instances of SwfFile::FlashFile also receive blocks
swf.header { |h| h.duration }
# SwfFile::FlashFile instance helper method
swf.compressed? # => Helper method. Effectively it's an alias to same as SwfHeader#compressed?

Issues, improvements, feedback an suggestions

To report issues, please use GitHub’s issue manager (github.com/DBA/swf_file/issues). Meanwhile, feel free to fork the project and submit your modifications.

Should you wish to contact me directly, please use GitHub’s message box or the email available at the Rakefile.

Pending

  • Docs