我有一个连接到 Flash Media Server 的 netConnection。我正在尝试使用 Flash Player 10.1 中的新appendBytes 函数将本地FLV 文件流式传输到FMS。但是我遇到了问题...我在线获取的文档
function playFile(data:ByteArray):void
{
// data is bytearray data from an already loaded FileReference object
netStream.play(null);
netStream.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN);
netStream.appendBytes(data);
}
但是,我在使用appendBytesAction 和appendBytes 时遇到错误。错误是:错误#2004:参数之一无效....
TypeError: Error #2004: One of the parameters is invalid.
有什么想法吗? 谢谢
最佳答案
当流的 NetConnection
连接到除“null”之外的任何其他内容时,您无法成功使用 appendBytes
。来自 appendBytes
方法的文档 http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#appendBytes%28%29 :
Passes a
ByteArray
into aNetStream
for playout. Call this method on aNetStream
in "Data Generation Mode". To put aNetStream
into Data Generation Mode, callNetStream.play(null)
on aNetStream
created on aNetConnection
connected to null. CallingappendBytes()
on aNetStream
that isn't in Data Generation Mode is an error and raises an exception.
这几乎肯定意味着 Adobe 所谓的“数据生成模式”在连接到 Flash Media Server 实例的连接对象上不可用。
关于flash - NetStream.appendBytes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7947269/