【发布时间】:2010-12-09 20:07:30
【问题描述】:
所以.. 我有一个带有 MP3 数据的 缓冲区(如果我要保存这个缓冲区并将其命名为 buffer.mp3 它会播放,但在这种情况下我不应该将它保存到文件系统) . 我必须玩,但我不能,我该怎么办?
我尝试了下一个代码来播放该缓冲区(ByteArray\Stream)(我从服务器获取 MP3 数据,获取数据的方法工作正常(在 text int 等上测试)我调用返回的 ByteArray readResponse,因为我有一些固定方法这是它的回应)。
protected function Play(event:MouseEvent):void
{
var mySound:Sound = new Sound();
mySound.addEventListener(SampleDataEvent.SAMPLE_DATA, soundFill);
mySound.play();
}
public function soundFill(event:SampleDataEvent):void
{
event.data.writeBytes(readResponse.buffer, 0, readResponse.buffer.length);
}
【问题讨论】:
-
这个帖子可能会有所帮助stackoverflow.com/questions/1553563/…
标签: actionscript-3 mp3 stream bytearray buffer