我無法在應用程序未激活時在後臺播放聲音。每當我按下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