Hello Ayush,
Check
this thread out, this might help you.
Regards..
Edited => => => (Another Way)
Following works, check it out
(you'll need to add references to PresentationCore and WindowsBase, you can find them in .NET tab)
MediaPlayer mplayer = new MediaPlayer();
public MainWindow()
{
InitializeComponent();
}
private void btnPlay_Click(object sender, RoutedEventArgs e)
{
Uri path = new Uri(@"BigBounce.wav");
mplayer.Open(path);
mplayer.Play();
Thread.Sleep(1000);
if (mplayer.NaturalDuration.HasTimeSpan)
{
lblLength.Text = mplayer.NaturalDuration.TimeSpan.ToString();
}
}
private void btnStop_Click(object sender, RoutedEventArgs e)
{
mplayer.Stop();
mplayer.Close();
}