views:

761

answers:

3

Is it possible to play video from data that has been embedded in a swf at compile time (with the [Embed] metatag)?

The "Import Video->Embed" feature provided by Flash CS3 etc. is not acceptable because it has many severe limitations (including sound synchronization issues, a maximum number of frames, and other caveats)

I'm interested in being able to bundle flv video data in a swf (along with other assets), which will be played by an AIR application.

I don't think it can be done. Anyone disagree?

+2  A: 

You can import a flv into a swf file using the Flash IDE - I've done that before. You can drop it onto the timeline of a MovieClip just like a sound and then drop that movieclip onto the stage for it to play. In Flash CS3 do File>Import>Import Video and select the flv. Choose the video and then on the next stop of the wizard choose "Embed ..... ", Here is a link to an Adobe Developer center article on embedding flvs into swfs.

I have not done so myself, but I can see no reason why you could access the flv from the library of a loaded swf.

FYI: It looks like this was a bug that was deferred. It doesn't look like Adobe currently allows embedding using the Embed meta tag. Here is a forum post on the issue and a link to the bug tracker.

James Fassett
Unfortunately that approach has a lot of caveats which I can't live with. The biggest one is the sound synchronization issue, but there are also framecount restrictions and other misc limitations. I've updated the question. Thanks for answering!
aaaidan
Thanks for those links James, especially the kirupa.com thread. Makes me feel less insane.
aaaidan
+1  A: 

It's possible to embed video into SWFs with the Flash IDE but it's not a very good option:

"Playback is limited to simple play and stop commands, and the video framerate must match that of the host movie, an important consideration that will require authoring for the lowest-common-denominator download speed."

"The biggest limitations to embedded video are movies having a maximum of 16,000 frames and audio sync cannot be maintained beyond about two minutes."

Those quotes are from this article. It's a bit old but as far as I know, what is said there about embedding video still holds true.

hasseg
That's a very good point. I know the "Import Video->Embed" feature of Flash CS3, but it's not an acceptable solution for those reasons.I'm looking out for _another_ way to embed video. I was imagining something like instantiating an `[Embed]`ed class and passing it to the video player.
aaaidan
A: 

Oh yeah, so apparently you can embed binary data in a swf using the Embed meta tag.

[Embed(
    source="local_data_file.flv",
    mimeType="application/octet-stream") ]
private static var __FlvClass123:Class;
protected static var flvData:ByteArray = new __FlvClass123();

Whether you can playback embedded video from a ByteArray or not is not something I cannot answer one way or another at this stage ...

aaaidan