1
我下載的音頻文件下載和它的byte []存儲IIN一個C#WPF項目從URL
byte[] audio = client.DownloadData(new Uri("http://static.sfdict.com/dictstatic/dictionary/audio/luna/E03/E0397400.mp3"))
我如何玩這個聲音文件後播放音效檔。
我下載的音頻文件下載和它的byte []存儲IIN一個C#WPF項目從URL
byte[] audio = client.DownloadData(new Uri("http://static.sfdict.com/dictstatic/dictionary/audio/luna/E03/E0397400.mp3"))
我如何玩這個聲音文件後播放音效檔。
你可以這樣說:
byte[] audio = client.DownloadData(new Uri("http://static.sfdict.com/dictstatic/dictionary/audio/luna/E03/E0397400.mp3"))
System.IO.Stream s = new MemoryStream(audio);
SoundPlayer player = new SoundPlayer(s);
player.Play();
不幸的是,似乎只支持'wav'文件。 – Clemens
Nopz這一個不工作,它說heade不正確。該文件是MP3格式 –
爲什麼下載第一? MediaPlayer.Open採用Uri參數。 – Clemens
Thanx的幫助。讓我試試這個,回覆你 –