0
我有這個小片的C#代碼C#MediaPlayer.MediaEnded事件不觸發
//Creates a MediaPlayer with the sound you want to play
public static void PlaySound (Stream wavStream, string wavName, bool loop)
{
//Get the path for the file to play
var path = GetFilePath(wavStream, wavName);
var player = new MediaPlayer();
player.Open(new Uri(path));
player.MediaEnded += loop ? new EventHandler(MediaEndedLoop) : new EventHandler(MediaEndedDestroy);
player.Play();
players.Add(player);
names.Add(wavName);
}
我不知道爲什麼,但MediaEndedLoop和MediaEndedDestroy從來不被稱爲
任何想法?