简体   繁体   中英

How to know if audio is done playing c#?

Is there any function to know if the audio is done playing? I want to do a function after the audio played, I have 2 ideas. First if there is a function when audio is done, second is I will get the length of the audio and put it on the timer and set it on. Please help me to get either audio is done or audio"s time length thanks.

You have to use AxWindowsMediaPlayer.playState property to know the status of the player. Look at this:

if (player.playState == WMPLib.WMPPlayState.wmppsPlaying)
{
    Console.WriteLine("Is playing!");
}
else
{
    Console.WriteLine("Is NOT playing!");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM