C# - Get time from soundplayer

前端 未结 1 1233
广开言路
广开言路 2021-01-29 07:44

Is there any way to get the number of milliseconds that have passed since the soundplayer started playing?

So far I\'m using Environment\'s tick counter by

相关标签:
1条回答
  • 2021-01-29 08:13

    No, the SoundPlayer class has no way to read it's current position. It's a very simple "fire-and-forget" WAV player that's not meant for anything too complicated.

    If you need more control over your sound playback you should be using something like the Windows Media Player control, as described in this article. In particular, there is an IWMPControls::currentPosition property you can get from the media player to tell you where in the current media the player is.

    0 讨论(0)
提交回复
热议问题