when video ends, close the active form

Total Post:110

Points:776
C# 
C#
 1316  View(s)
Ratings:
Rate this:

I'm trying to close a form in which a video is playing. I want it to close said form when the video ends.

I'm using wmp embedded into my form, with ui mode hidden.

Thanks

  1. Post:145

    Points:1019
    Re: when video ends, close the active form

    Hi Jeet,

    You can subscribe to the PlayStateChange event of the player.

    wmp.PlayStateChange += new
    AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(wmp_PlayStateChange);
    private void wmp_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
    {
        if(e.newState == 8)
           this.Close();
    }

      Modified On Apr-03-2018 06:18:07 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!