【发布时间】:2014-07-01 16:13:39
【问题描述】:
所以我想在 C# 中播放一个文件一段时间,函数是
void playfile(int duration)
{
wmp.controls.play();
Console.WriteLine("control is here");
System.Threading.Thread.Sleep(duration);
Console.WriteLine("control is here");
wmp.controls.pause();
}
正在调用的播放器启动媒体播放器,但不会暂停。 “控制在这里”被打印两次,但播放器没有暂停。 但是当我在两个不同的按钮中显示它时它工作正常。 例如。
private void button2_Click(object sender, EventArgs e)
{
wmp.controls.play();
}
private void button3_Click(object sender, EventArgs e)
{
wmp.controls.pause();
}
我想开发一个功能来播放一个wav文件一段时间然后停止然后再播放一段时间然后再停止。
【问题讨论】: