Introduction
Many time We Want to Start Some Audio File Not from Starting but Want to Start playing from Specific TimeSpan
Here i gona show you how to do that thing easily
Technologies:
.net 2.0/3.5
Language:
C#
Prerequisite
1. .NET Framework 3.5/2.0
2. Visual Studio 2008/2005
Implementation
assumes that you have all prerequestites .
Just Take a Label to Show Current Position of Media on Form and Dragdrop One timer Say "timer1" Follow the Steps

Step 2

Step 3

using System.Windows.Media; namespace WindowsFormsApplication32 { public partial class Form1 : Form { MediaPlayer m; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // Create Instance m = new MediaPlayer(); m.Open(new Uri(@"D:\Songs\Angel.mp3")); m.Play(); //Set Position Where you want to Start Here we starting from 0:1:50
m.Position = new TimeSpan(0, 1, 50); timer1.Enabled = true; } private void timer1_Tick(object sender, EventArgs e) { // Current Position of MediaFile label1.Text = m.Position.ToString(); } }
You are done How Simple it was !! Conclusion
Article Explaines how to play audio files from specific time span
Thanks . |