注意:我在Error #2084-The AMF Encoding of the arguments cannot exceed 40K中看到了另一个问题,我的问题是不同的。我的数组不是40960,它小于0。
我的代码很简单。我从这个链接获得了这个mp3记录fla:http://www.jordansthings.com/blog/?p=5,它使用shinemp3编码器。
我只想播放录制的声音,而不是保存它。因此,我在保存录制文件的按钮中添加了以下内容:
private function onWavClick(e:MouseEvent)
{
// WRITE ID3 TAGS
var sba:ByteArray = mp3Encoder.mp3Data;
sba.position = sba.length - 128
sba.writeMultiByte("TAG", "iso-8859-1");
sba.writeMultiByte("Microphone Test 1-2, 1-2 "+String.fromCharCode(0), "iso-8859-1"); // Title
sba.writeMultiByte("jordansthings "+String.fromCharCode(0), "iso-8859-1"); // Artist
sba.writeMultiByte("Jordan's Thingz Bop Volume 1 "+String.fromCharCode(0), "iso-8859-1"); // Album
sba.writeMultiByte("2010" + String.fromCharCode(0), "iso-8859-1"); // Year
sba.writeMultiByte("www.jordansthings.com " + String.fromCharCode(0), "iso-8859-1");// comments
sba.writeByte(57);
//new FileReference().save(sba, "FlashMicrophoneTest.mp3") // this saves the file. I don't need it.
// my addition
var snd:Sound = new Sound();
var channel:SoundChannel = new SoundChannel();
trace(sba.length);
snd.loadCompressedDataFromByteArray(sba,sba.length);
channel = snd.play();
}此外:即使这是可行的.我无法加载大于40K的数组?
发布于 2013-10-02 02:08:00
在调用loadCompressedDataFromByteArray之前,您应该将ByteArray的位置设置为0。例如:
sba.position = 0;
snd.loadCompressedDataFromByteArray(sba,sba.length);我注意到在我的应用程序中,ByteArray上的bytesAvailable是0。这是因为ByteArray上的位置在ByteArray的末尾。该错误消息令人困惑,因为它说您正在超过40K,而您并没有。应该说没有什么可以从ByteArray加载的。
另外,我可以确认我可以加载大于40K的ByteArrays。我用126KB的mp3 ByteArray进行了测试。
发布于 2015-03-12 00:29:51
在我的例子中,问题不在于我想要读取的ByteArray的大小。我正在阅读和播放30Mb的mp3文件,没有任何问题(这是很多,我知道!)问题是我多次读取该文件,第一次读取后,ByteArray的位置在末尾。所以当你想要读取byteArray的时候,你必须重新回到0的位置。为了安全起见,我认为这是一个很好的实践。
https://stackoverflow.com/questions/17770533
复制相似问题