如何在silverlight wp7應用程序中播放歌曲?熱點在WP7 silverlight應用程序中播放歌曲/聲音?
我知道如何用MEdiaPlayer在xna框架中做到這一點,但我不知道如何在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 { }
}