Unable to call WMP's controls.play() function in VisualBasic
- by A.J.
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