如何在 Haxe 中播放 FLV 文件?
找到 Haxe 信息的优质资源非常困难,因此我希望有人可以帮助我。我在与生成的 SWF 相同的目录中有一个 FLV 影片。我无法播放 FLV。我可以让它在 AS 中工作,但我需要知道我在 Haxe 代码中做错了什么。
希望有人能帮忙。
var mc:MovieClip = Lib._root;
var connection:NetConnection = new NetConnection();
connection.connect(null);
var stream:NetStream = new NetStream(connection);
mc.attachVideo(stream);
trace(mc.flash.Video);
stream.play("default.flv");
It is very difficult to find good resources for Haxe information so I am hoping someone out there can help me. I have an FLV movie in the same directory as the SWF I am generating. I cannot get the FLV to play. I can get this working in AS but I need to know what I am doing wrong in my Haxe code.
Hope someone can help.
var mc:MovieClip = Lib._root;
var connection:NetConnection = new NetConnection();
connection.connect(null);
var stream:NetStream = new NetStream(connection);
mc.attachVideo(stream);
trace(mc.flash.Video);
stream.play("default.flv");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一个 Google 代码项目,演示了一个不错的 Flash 媒体服务器。它可以播放甚至录制视频。 http://code.google.com/p/haxevideo/
Here is a Google Code project that demos a nice flash media server. It plays and even records videos. http://code.google.com/p/haxevideo/
您的目标玩家版本是什么?对于 10,舞台是
flash.Lib.current
。haxe编译器会说一些关于错误的信息吗?
What player version do you target? For 10 the stage is
flash.Lib.current
.Do haxe compiler says something about errors?
在播放视频方面,Haxe 和 AS 没有本质上的不同,因为您将使用 AS 库。您要编译到哪个播放器?因为如果你编译为player >= 9,你会丢失一些位。
您可以查看我的 AS3 播放器示例 此处(向下滚动到
createVideo()
)以了解具体内容(创建 Video 对象、附加到显示列表等)。我还猜测您没有收到任何编译器错误,对吧?
胡安
There's nothing inherently different from Haxe and AS when it comes to play video as you would be using AS libraries. To which player are you compiling to? Because if you are compiling to player >= 9 you are missing a few bits.
You can check out my example of AS3 player here (scroll down to
createVideo()
) to find out exactly what (create the Video object, attach to the display list, etc).I'm also guessing that you are not getting any compiler errors, right?
Juan