Results 1 to 2 of 2

Thread: [RESOLVED] Displaying a different form after my video playlist runs its course

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2017
    Posts
    2

    Resolved [RESOLVED] Displaying a different form after my video playlist runs its course

    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

  2. #2

    Thread Starter
    New Member
    Join Date
    May 2017
    Posts
    2

    Re: Displaying a different form after my video playlist runs its course

    I solved the problem through taking some time away and re-addressing my issue.
    I'm going to explain what I did in-case anyone runs into an issue similar to mine.

    First things first. I ended up needing to create a separate form to house all the code above. I was trying to write all of this code directly into a form I wanted this to play before. What this was doing was binding the media player to the form and tripping it up some how.

    After creating a separate form to carry out the task I needed done. I then went into the form I wanted this to play before and simply ran " newFormName.Show() " in the "On_Load" procedure.

    I then also removed the "frmStormMain.Show" from the code above when I placed it into its own form. This way after the playlist ran its course it would then Close() the media player and leave me with the form that I want to see

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width