After playing with the Ruby Ming extension a little more I found that they don't have support for SWFVideoStreams so I made a patch to add it. The patch also fixes the beta issues I described in building the ming ruby extension.
Here are the steps you need to follow to patch and install the latest Ming Ruby extension:
- Download the 0.1.7 version from: wget http://rubyforge.org/frs/download.php/1841/ming-ruby-0.1.7.tar.gz
- Uncompress the archive file: tar xvzf ming-ruby-0.1.7.tar.gz
- Change into the source directory: cd ming-ruby-0.1.7
- Download the new SWFVideoStream file and stick it into the ext/ming/mingc directory: wget -O ext/ming/mingc/swfvideostream.c http://d28nuaxr58rcpu.cloudfront.net/mingruby/swfvideostream.c
- Download the patch: wget http://d28nuaxr58rcpu.cloudfront.net/mingruby/patch
- Apply the patch: patch -p0 -u < patch
- Run the setup script: ruby setup.rb
And here is an example of using the SWFVideoStream to embed a Flash video into your Flash movie:
m = SWFMovie.new(7)
m.set_background(0xff, 0xff, 0xff)
vstream = SWFVideoStream.new('test.flv')
The above example assumes you have a Flash video file available named test.flv. If you don't have one you can make one by reading about creating flash videos with FFMpeg.