1
votes

I faced this problem with Android but I solved! But in IOS it's not working and I spent more than 1 day tried to solve it. I traced everything in folder and its give me the path correctly but when I call the sound path to load it, it's keep give me this message.

this is the result of trace

/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()

and this is the code

    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();
    }

I tried to but static path like this file:///C:/Users/MASTER/Documents/story1/zipFolder/mp3/1.mp3 and its not working Please There is anyone can help me with this.

1
In your for loop you load files.length times file at index 0. ....URLRequest(files[0].nativePath));... can this be your problem? - Azzy Elvul
even in this case it's don't give me the sound at position 0 thanks - Ali Abu Ras
the error is thrown when the IOErrorEvent is nopt handled, then add mySound.addEventListener(IOErrorEvent.IO_ERROR, handler); this will sort the error thrown, but I think you have to find why it doesn't access it - path incorrect, insufficient access rights? - Lukasz 'Severiaan' Grela
Thank you all, I solve it by change the native path to url and its working now :) - Ali Abu Ras

1 Answers

1
votes

I also wanted to add a huge thanks.

I was using .nativePath to give to URLRequest, instead of .url. On the simulator (Windows), it worked great either way, but I was getting this stream error on iOS. Considering it takes me about 15 minutes to compile for the remote debugging, I was greatly relieved the answer was so simple.