文件播放完成后,我需要获取事件完成通知,以了解如何在xamarin.forms
内实现
public void PlayAudioFile(String pathtowavfile)
{
try
{
var fileresouce = new Java.IO.File(pathtowavfile);
if (fileresouce.Exists())
{
player.Reset();
player.SetDataSource(pathtowavfile);
player.Prepare();
player.Completion += Player_Completion;
}
}
catch (Exception ex)
{
}
}
private void Player_Completion(object sender, EventArgs e)
{
throw new NotImplementedException();
}
public void Start()
{
player.SeekTo(length);
player.Start();
}
public void Pause()
{
if (player.IsPlaying)
{
player.Pause();
length = player.CurrentPosition;
}
}