【问题标题】:Air iOS,Flash Pro, external mp3 won't be playedAir iOS、Flash Pro、外接mp3无法播放
【发布时间】:2013-01-28 00:10:02
【问题描述】:

我的 Flash 应用程序有以下代码。本地测试时播放声音,但在 iOS 上发布时不播放。

mp3 文件位于 components/sound 目录中,该目录通过 Adob​​e Flash cs6 专业版中的 Air iOS3.6 发布设置包含。

我做了一些测试,当 mp3 文件和目录在 iOS 中存在(使用 File.exists 测试)时,sound.bytesLoaded 显示 0 值。在本地测试时,它会显示实际文件大小。

谁能帮我解决这个问题?

var path= File.applicationDirectory.resolvePath("components/sound/click.mp3").nativePath;
var sound = new Sound(new URLRequest(path));
sound.play();

[编辑]

当我简单地将 new URLRequest(path) 替换为 new URLRequest("components/sound/click.mp3") 时,它起作用了。

但是,如果有人能解释为什么前一个(nativePath)不起作用,我仍然很感激。

【问题讨论】:

    标签: ios flash audio air mp3


    【解决方案1】:

    阅读this thread on Adobe Community forums关于在iOS上加载外部声音,您的代码似乎还可以,我看到的唯一可疑之处是您应该以“/”开头的文件路径,例如:

    var path= File.applicationDirectory.resolvePath("/components/sound/click.mp3").nativePath;
    

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多