melika melika - 1 year ago 88
C# Question

Windows Media Player - Hide player after it is done playing

I am creating a game, I want to display a short tutorial video to the player after they have registered. I am using a windows media player control. I don't know how to hide the video after it has finished playing ?
I tried using the following:;

I am using the disposing as a way to close down the video. I tried hide and close as well but they close the video before it's finished playing, after 3 seconds.

Answer Source

You can handle PlayStateChange event of control and check if e.newState==1, it means the playing has been stopped. Then you can hide the control.

void axWindowsMediaPlayer1_PlayStateChange(object sender, 
    AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
    if(e.newState== 1) // Stopped
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download