Unable to call WMP's controls.play() function in VisualBasic

Posted by A.J. on Stack Overflow See other posts from Stack Overflow or by A.J.
Published on 2012-12-07T20:53:23Z Indexed on 2012/12/09 23:04 UTC
Read the original article Hit count: 296

Filed under:
|
|

I have the following code: http://pastebin.com/EgjbzqA2 which is basically just a stripped down version of http://www.dreamincode.net/forums/topic/57357-mymusic-player/. I want the program to play one file repeatedly, however, this function doesn't work for some reason. The program plays each file once and then stops.

Private Sub Player3_PlayStateChange(ByVal NewState As Integer) Handles Player3.PlayStateChange
    Static Dim PlayAllowed As Boolean = True
    Select Case CType(NewState, WMPLib.WMPPlayState)
        Case WMPLib.WMPPlayState.wmppsReady
            If PlayAllowed Then
                Player3.controls.play()
            End If
        Case WMPLib.WMPPlayState.wmppsMediaEnded
            ' Start protection (without it next wouldn't play
           PlayAllowed = False
            ' Play track
           Player3.controls.play()
            ' End Protection
           PlayAllowed = True
            updatePlayer()
    End Select
End Sub

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about windows-media-player