-2
Possible en double:
adding media element in windows phone 7?l'élément multimédia ne lit pas l'audio dans Windows Phone 7?
élément multimédia ne joue pas correctement audio même en donnant les propriétés.
Possible en double:
adding media element in windows phone 7?l'élément multimédia ne lit pas l'audio dans Windows Phone 7?
élément multimédia ne joue pas correctement audio même en donnant les propriétés.
Cela fonctionne.
Dans le code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
var stream = TitleContainer.OpenStream("beep.wav");
var effect = SoundEffect.FromStream(stream);
effect.Play();
N.B. "beep.wav" doit être configuré en "Contenu".
dans le constructeur app ajouter:
this.ApplicationLifetimeObjects.Add(new XNAAsyncDispatcher(TimeSpan.FromMilliseconds(50)));
ajouter également la classe suivante:
public class XNAAsyncDispatcher : IApplicationService
{
private DispatcherTimer frameworkDispatcherTimer;
public XNAAsyncDispatcher(TimeSpan dispatchInterval)
{
this.frameworkDispatcherTimer = new DispatcherTimer();
this.frameworkDispatcherTimer.Tick += new EventHandler(frameworkDispatcherTimer_Tick);
this.frameworkDispatcherTimer.Interval = dispatchInterval;
}
void IApplicationService.StartService(ApplicationServiceContext context) { this.frameworkDispatcherTimer.Start(); }
void IApplicationService.StopService() { this.frameworkDispatcherTimer.Stop(); }
void frameworkDispatcherTimer_Tick(object sender, EventArgs e) { FrameworkDispatcher.Update(); }
}
Vous ne l'avez pas nous a dit quoi que ce soit à propos de ce que vous avez essayé ou nous montré tout code. Il sera très difficile pour quiconque de deviner ce que vous pourriez faire de mal. – ctacke