我无法在应用程序未激活时在后台播放声音。每当我按下home键的声音很快消失了,当我回到该应用程序是淡出早在Air for iOS声音消失主页按钮被按下时
我已经更新了我的索引-app.xml文件,以便背景音频模式:
<iPhone>
<requestedDisplayResolution>standard</requestedDisplayResolution>
<InfoAdditions><![CDATA[<key>UIDeviceFamily</key><array><string>2</string></array> <key>UIBackgroundModes</key><array><string>audio</string></array>]]></InfoAdditions>
</iPhone>
我还设置:
NativeApplication.nativeApplication.executeInBackground = true;
然后我的声音代码非常简单:
sound = new Sound();
sound.load(new URLRequest("media/default/song.mp3"));
channel = sound.play(0);
我已经通过上下文档,似乎无法弄清楚为什么歌曲拒绝在后台播放时,该应用程序不活跃。任何帮助将膨胀!谢谢!!
试试这个:https://github.com/freshplanet/ANE-Background-Music – Eran