Good Day
i have a Media Element in WPF and i am playing mp3's programatically on a click of a button. Now there are times where i want to Play two different mp3's in an order after another e.g
* *
Now i tried to put it a Thread Sleep between, it work once after that the Second mp3 plays after the first one. So i want to call the same function twice to play different mp3's but i want one to wait for another to finish playing before playing, i hoped for a "isPlaying" Property to determine if the element was playing. Does anyone have a solution.
Thanks
i have a Media Element in WPF and i am playing mp3's programatically on a click of a button. Now there are times where i want to Play two different mp3's in an order after another e.g
* *
Code:
*
PlayAudio("AccountOpen_Message1");
PlayAudio("AccountOpen_Message2");
Code:
//Function to Play a Video
private void PlayAudio(string Fruit)
{
VideoPlayer.Source = new Uri(@"D:\Articles\How to identify Players in Kinect\IdentifyPlayers\WpfApplication1\WpfApplication1\Voices\" + Fruit + ".mp3", UriKind.Absolute);
VideoPlayer.LoadedBehavior = MediaState.Manual;
VideoPlayer.Play();
}
Code:
<MediaElement x:Name="VideoPlayer" Volume="100" LoadedBehavior="Manual" MediaEnded="VideoPlayer_MediaEnded" UnloadedBehavior="Close" ></MediaElement>
Code:
private void VideoPlayer_MediaEnded(object sender, RoutedEventArgs e)
{
this.Close();
}
Thanks