【问题标题】:Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error错误 #2044:未处理的 IOErrorEvent:。文本=错误 #2032:流错误
【发布时间】:2013-03-04 10:01:32
【问题描述】:

我在使用 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();
    }

我尝试了像这个 file:///C:/Users/MASTER/Documents/story1/zipFolder/mp3/1.mp3 这样的静态路径,但它不起作用 请问有谁可以帮我解决这个问题。

【问题讨论】:

  • 在您的 for 循环中,您在索引 0 处加载 files.length 次文件。 ....URLRequest(files[0].nativePath));... 这可能是您的问题吗?
  • 即使在这种情况下,它也不会给我位置 0 的声音,谢谢
  • 在不处理IOErrorEvent时抛出错误,然后添加mySound.addEventListener(IOErrorEvent.IO_ERROR, handler);这将对抛出的错误进行排序,但我认为您必须找到它无法访问它的原因 - 路径不正确,不足访问权限?
  • 谢谢大家,我通过将本机路径更改为 url 来解决它,现在它可以工作了:)

标签: ios actionscript-3 audio


【解决方案1】:

我还想非常感谢。

我使用 .nativePath 来提供 URLRequest,而不是 .url。在模拟器(Windows)上,无论哪种方式都很好,但我在 iOS 上遇到了这个流错误。考虑到编译远程调试需要大约 15 分钟,答案如此简单,我松了一口气。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-28
    相关资源
    最近更新 更多