Vì vậy .. Tôi có một bộ đệm với dữ liệu MP3 (Nếu tôi lưu bộ đệm này và gọi nó là buffer.mp3 nó sẽ phát, nhưng trong trường hợp này tôi không nên lưu nó vào hệ thống tệp). Tôi phải chơi nó, nhưng tôi không thể, tôi phải làm gì?Làm thế nào để phát âm thanh MP3 từ bộ đệm (ByteArray/Stream) trong ActionScript 3?
Tôi đã thử đoạn code sau để chơi mà buffrer (ByteArray \ Stream) (tôi nhận được dữ liệu MP3 từ máy chủ các phương pháp lấy dữ liệu hoạt động tốt (thử nghiệm trên văn bản int của vv) tôi gọi là trở ByteArray readResponse vì Tôi có một số phương pháp seading và nó là phản ứng của nó).
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);
}
Chuỗi này có thể hữu ích http://stackoverflow.com/questions/1553563/play-flv-from-bytearray-in-flash-player – Amarghosh