首页 新闻 会员 周边 捐助

WPF定时播放铃声它不会整首歌放完就停止播放了,这是为什么啊?求高人指点

0
悬赏园豆:20 [已关闭问题] 关闭于 2012-06-04 18:36

private void playSound(string str)
{
MediaPlayer player = new MediaPlayer();
try
{
player.Open(new Uri(str, UriKind.Absolute));
player.Play();
}
catch (Exception)
{
player.Stop();
}
//BgMusic bm = new BgMusic();
//bm.BgMusicPath = AppDomain.CurrentDomain.BaseDirectory + "\\Justin Bieber - Up.mp3";
//"C:\\Users\\ZHANGYI\\Desktop\\Justin Bieber - Up.mp3";

//mySoundPlayer.DataContext = bm;
}
private void button2_Click(object sender, RoutedEventArgs e)
{
j = 0;
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "音乐文件(*.mp3)|*.mp3|所有文件(*.*)|*.*";
openFileDialog1.ShowDialog();

{

str = openFileDialog1.FileName;
// playSound(str);
//playSound();
// Audio.Play();
}
//OpenFileDialog dialog = new OpenFileDialog();
//if (dialog.ShowDialog() == true)
//{
// Audio.Play();
//}
}

用计时器调用Audio.Play();但是音乐播10几秒就停了

WPF
zy121的主页 zy121 | 初学一级 | 园豆:107
提问于:2012-05-25 21:42
< >
分享
所有回答(1)
0

我也遇到这个问题了,还在解决,而且我关闭程序后音乐还关闭不了

街舞攻城狮 | 园豆:202 (菜鸟二级) | 2014-09-03 14:26
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册