Search code examples
c#mp3

how to play a mp3 file from the middle


mciSendStringi("","","","");

I used the above function to play a mp3 file. Now I want to play the mp3 file from the middle (i.e) if the file is 5:32 minutes long I want to play it from 2:00 minutes. Can any help me how to do it?


Solution

  • Something like this perhaps:

    long millisecs = 120000;
    long status = mciSendString(String.Format("seek MediaFile to {0}", millisecs), null, 0, IntPtr.Zero);
    

    To determine the length of the file, see this post