I'm writing an app that plays a video (embedded WMP) when a form loads. Works fine.
But I can't detect when the video has ended. I've tried everything I can find online. Even asked GitHubAI. Nothing works.
The moment the form loads, my "PlayState" check comes back "True" and my MsgBox test appears regardless of what I check for (see Comment at bottom of code.)Code:Public Class frmSelect Dim bolPlaying As Boolean = False Private Sub frmSelect_Load(sender As Object, e As EventArgs) Handles MyBase.Load wmpVideo.URL = "O:\Video\video.mp4" wmpVideo.settings.setMode("loop", False) bolPlaying = True ' ("bolPlaying" flag optional. Added to make sure "PlayStateChange" Event is ignored ' when video starts.) End Sub ... Private Sub wmpVideo_PlayStateChange(sender As Object, e As _WMPOCXEvents_PlayStateChangeEvent) Handles wmpVideo.PlayStateChange If bolPlaying and wmpVideo.playState.wmppsStopped Then MsgBox("Video has ended.") ' Tried: playState.wmppsMediaEnded, playState.wmppsWaiting, playState.wmppsPaused ' Also tried checking the "_EndOfStream" Event. End Sub
How do I detect the end of a video? TIA




Reply With Quote
