Windows Phone 离开背景音乐播放 [英] Windows Phone leave background music playing
问题描述
我的 Windows Phone 应用被拒绝,因为当我在应用的浏览器中播放声音时,它会停止播放现有的背景音乐(拒绝问题 6.5.1).
My Windows Phone app was rejected because when I play a sound in the browser in my app it stops existing background music from playing (rejection issue 6.5.1).
如何更新我的应用程序以不停止背景音乐?
How do I update my application to not stop background music?
我的 JavaScript 是这样的:
My JavaScript is something like this:
var mySound = new Audio(soundpath);
Sound.play(mySound);
我在 Microsoft.Xna.Framework.Media 中找不到任何处理应用如何处理浏览器声音的内容,但也许我错过了什么?
I could not find anything in Microsoft.Xna.Framework.Media that handles how the app handles browser sound, but maybe I missed something?
推荐答案
您要找的是来自 xna 音效
What you are looking for is from the xna soundeffect
这是我使用的,它非常适合我的所有音效.(您不能使用带有音效"对象的音乐,因为它不会通过 windows 商店的资格.您必须使用 MediaElement 来播放音乐)我不记得你需要哪个,但我有所有这些
Here is what I use and it works for me great for all my sound effects. (You cannot use music with a 'soundeffect' object, as it will not pass the windows store qualifications. You have to use the MediaElement for music) I can’t remember which you need but I have all these includes
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Media;
还有这个功能
private static void LoadSoundEffect(string fileName, SoundEffectInstance mySound)
{
var stream = TitleContainer.OpenStream("Sounds/" + fileName);
var effect = SoundEffect.FromStream(stream);
FrameworkDispatcher.Update();
mySound = effect.CreateInstance();
}
如果您使用 SoundEffectInstance,您可以启动、暂停、停止音效等,而不会出现所有问题.
If you use a SoundEffectInstance, you can start,pause,stop the soundeffect etc. without all the problems.
SoundEffect 也能工作,但我更喜欢 SoundEffectInstance.
SoundEffect works as well, but I prefer the SoundEffectInstance.
如果你使用音效,它不会影响正在播放的音乐.
If you use soundeffect, it will not effect the music being played.
这篇关于Windows Phone 离开背景音乐播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!