如何在silverlight wp7应用程序中播放歌曲?
我知道如何在xna框架中使用MEdiaPlayer进行此操作,但我不知道如何在Silverlight中实现它。它开始出现问题,我不知道如何将歌曲作为内容加载。
谁可以给我看一个代码示例?
在xna中看起来像:
private void PlayMusic(Song song)
{
// Due to the way the MediaPlayer plays music,
// we have to catch the exception. Music will play when the game is not tethered
try
{
// Play the music
MediaPlayer.Play(song);
// Loop the currently playing song
MediaPlayer.IsRepeating = true;
}
catch { }
}