currently after the playlist finishes and shifts to If playerWF.playState = WMPPlayState.wmppsMediaEnded my media player exits full screen but then the form playing the playlist stays open but in a black screen state. I can hit play again on the form and the playlist will run again but I want it to close the mediaplayer and open up the next form in sequence once it detects that both the videos played.
Code:
Option Explicit On
Option Strict On
Imports WorkforceTraining.My.Resources
Imports AxWMPLib
Imports WMPLib
Public Class FrmStormIntro
Dim _duration As TimeSpan
Dim _startTime, _endTime As DateTime
Private Sub stormIntro_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim playlist As WMPLib.IWMPPlaylist = playerWF.playlistCollection.newPlaylist("Playlist")
Try
playlist.appendItem(playerWF.newMedia(testVideo))
playlist.appendItem(playerWF.newMedia(testVideo))
playerWF.currentPlaylist = playlist
playerWF.Ctlcontrols.play()
_startTime = Now
' playerWF.uiMode = "none"
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub playerWF_PlayStateChange(ByVal sender As Object, ByVal e As _WMPOCXEvents_PlayStateChangeEvent) Handles playerWF.PlayStateChange
Try
If (playerWF.playState = WMPPlayState.wmppsPlaying) Then
playerWF.fullScreen = True
End If
If playerWF.playState = WMPPlayState.wmppsMediaEnded Then
_endTime = Now
_duration = _startTime - _endTime
If _duration.Minutes <= -4 Then
FrmStormMain.Show()
Close()
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
Close()
End Try
End Sub
End Class