how to play a mp3 file from the middle

和自甴很熟 提交于 2019-12-12 19:08:20

问题


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?


回答1:


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




回答2:


WMPLib is great for it, just do a

Player.controls.currentPosition = (time in seconds);

Unfortunately, I'm not able to get the current position from the same property; so, for now, I'm not able to resume a playback from the time it was paused:

Pausing and resuming mp3 with WMPLib and C#



来源:https://stackoverflow.com/questions/1091570/how-to-play-a-mp3-file-from-the-middle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!