玩的MediaElement后,我怎么能再次发挥它? [英] After playing a MediaElement, how can I play it again?
本文介绍了玩的MediaElement后,我怎么能再次发挥它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个变量的的MediaElement 变量名为 TestAudio 在我的Silverlight应用程序。
当我点击按钮,它播放音频的正确
但是,当我点击按钮的再次,它不播放音频。
我怎样才能让MediaElement的发挥,第二次?
下面的尝试都没有把位置返回到0的工作:
私人无效Button_Click_PlayTest(对象发件人,RoutedEventArgs E)
{
//TestAudio.Position =新时间跨度(0,0,0);
//TestAudio.Position = TestAudio.Position.Add(新时间跨度(0,0,0));
//TestAudio.Position =新时间跨度(0,0,0,0,0);
//TestAudio.Position = TimeSpan.Zero; TestAudio.Play();
}
解决方案
我发现它,你就必须为停止音频,然后再设定位置:
TestAudio.Stop();
TestAudio.Position = TimeSpan.Zero;
I have a variable MediaElement variable named TestAudio in my Silverlight app.
When I click the button, it plays the audio correctly.
But when I click the button again, it does not play the audio.
How can I make the MediaElement play a second time?
None of the tries below to put position back to 0 worked:
private void Button_Click_PlayTest(object sender, RoutedEventArgs e)
{
//TestAudio.Position = new TimeSpan(0, 0, 0);
//TestAudio.Position = TestAudio.Position.Add(new TimeSpan(0, 0, 0));
//TestAudio.Position = new TimeSpan(0, 0, 0, 0, 0);
//TestAudio.Position = TimeSpan.Zero;
TestAudio.Play();
}
解决方案
I found it, you just have to stop the audio first, then set the position:
TestAudio.Stop();
TestAudio.Position = TimeSpan.Zero;
这篇关于玩的MediaElement后,我怎么能再次发挥它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文