在SWF文件中嵌入二进制图像数据 [英] Embedding binary video data in a swf file
问题描述
是否有可能从已嵌入到SWF在编译时数据播放视频(用 [嵌入]
元标记)?
Is it possible to play video from data that has been embedded in a swf at compile time (with the [Embed]
metatag)?
导入Video->嵌入由Flash CS3等提供的功能是不能接受的,因为它有许多严重的限制(包括声音同步问题,帧的最大数量,和其他告诫)
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)
我感兴趣的是能够捆绑FLV视频数据的SWF(以及其他资产),这将是由AIR应用程序进行播放。
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?
推荐答案
只要你的视频是FLV,那么答案是肯定的 - 你可以用 NetStream.appendBytes()
播放嵌入的ByteArray
:
As long as your video is an FLV, then the answer is yes - you can use NetStream.appendBytes()
to play the embedded ByteArray
:
public class Main extends MovieClip
{
[Embed(source="sample.flv", mimeType="application/octet-stream")]
private var SampleVideo:Class;
public function Main():void
{
var video:Video = new Video(320, 240);
addChild(video);
var netConnection:NetConnection = new NetConnection();
netConnection.connect(null);
var netStream:NetStream = new NetStream(netConnection);
netStream.client = {};
video.attachNetStream(netStream);
var byteArray:ByteArray = new SampleVideo();
netStream.play(null);
netStream.appendBytes(byteArray);
}
}
这篇关于在SWF文件中嵌入二进制图像数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!