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?
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.
Oh yeah, so apparently you can embed binary data in a swf using the
Embed
meta tag.Whether you can playback embedded video from a ByteArray or not is not something I cannot answer one way or another at this stage ...
just had the same problem and searched for a more "flex"ible solution. seems these Days dynamic embedding works perfectly simple:
Note: Check the screen offsets within the
library.swf
. In my case they were messed up, so it simply displayed offscreen. (ThankGodForCoffee) Have a nice Day!It's possible to embed video into SWFs with the Flash IDE but it's not a very good option:
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.
As long as your video is an FLV, then the answer is yes - you can use
NetStream.appendBytes()
to play the embeddedByteArray
: