PDA

View Full Version : How to embed flv in a Flex/As3 project


firdosh
12-12-2006, 10:08 PM
I know you can use the embed tag for swf and images but how do you embed an flv file ???


thanks
cheers :)
firdosh

flexmaster45
01-09-2007, 12:54 PM
Did you find out how? Or does anybody else know how to embed .flv in Flex?

Tink
01-09-2007, 01:03 PM
i think you'd have to embed it in Flash

shadowmint
09-27-2008, 07:00 AM
I've posted about this here: http://www.bit-101.com/blog/?p=853#comment-253072

Here's a copy of the solution:

You can embed and use an FLV file as follows:

package
{

import flash.display.Sprite;
import flash.display.MovieClip;

public class Test extends MovieClip
{

[Embed(source="bin/test.swf")]
private var myVideo:Class;

public function Test ()
{
var k:Object = new this.myVideo();
var v:MovieClip = k as MovieClip;
addChild(v);
v.play();
}

}

}

To generate a SWF from an FLV you need to transcode the file. I recommend using one of the (many) FLV to SWF encoders out there. Typically you can use ffmpeg directly if you already have the flv:

ffmpeg -i myflv.flv -acodec copy -vcodec copy myswf.swf

All the methods mentioned previously can then be used to load the swf as normal. Remember external swfs extend MovieClip, not Sprite. :)