1.檔案一定是要mp3格式(wav檔不行)
2.檔案請放在「Resources」之下,本例為了跟其他資源區分,放在Resources/raw之下,
(有a1.mp3,a2.mp3....)
3.play sound的語法
A.用MediaPlayer:
var player =MediaPlayer.Create(ApplicationContext,Resource.Raw.a1);
player.Start();
B.用RingToneManager:
var uriString="android.resource://" + your_package_name + "/" +Resource.Raw.a1;
var uri=Android.Net.Uri.Parse(uriString);
Ringtone r = RingtoneManager.GetRingtone(ApplicationContext, uri);
r.Play();
----------------------------------------------------
以上,大家加油了!!
沒有留言:
張貼留言