我在Android上遇到了这个问题,但我解决了!但是在 IOS 中它不起作用,我花了超过 1 天的时间试图解决它。我跟踪了文件夹中的所有内容,它给了我正确的路径但是当我调用声音路径来加载它时,它一直给我这个消息。
这是跟踪的结果
/var/mobile/Applications/A121170F-40A0-4FF8-B93B-238D2B09C797/Documents/story1/zipFolder/mp3/1.mp3
1.mp3
/var/mobile/Applications/A121170F-40A0-4FF8-B93B-238D2B09C797/Documents/story1/zipFolder/mp3/2.mp3
2.mp3
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at buildPageAnimation::LoadAndSetAnimation/loadComplete()[D:\TestUnZipFile\Ipad-new methods for animations - unzip\src\buildPageAnimation\LoadAndSetAnimation.as:95]
at buildPageAnimation::LoadAndSetAnimation/loadComplete()
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at buildPageAnimation::LoadAndSetAnimation/loadComplete()[D:\TestUnZipFile\Ipad-new methods for animations - unzip\src\buildPageAnimation\LoadAndSetAnimation.as:95]
at buildPageAnimation::LoadAndSetAnimation/loadComplete()
这是代码
var soundFile:File = File.documentsDirectory.resolvePath('story1/zipFolder/mp3/');
var files:Array = soundFile.getDirectoryListing();
for (var i:uint = 0; i < files.length; i++)
{
trace(files[i].nativePath);// gets the path of the files
trace(files[i].name);// gets the name
var mySound:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel();
var lastPosition:Number = 0;
mySound.load(new URLRequest(files[0].nativePath));
myChannel = mySound.play();
}
我试图但是像这个文件这样的静态路径:///C:/Users/MASTER/Documents/story1/zipFolder/mp3/1.mp3 并且它不起作用请有人可以帮助我。