VB播放器如何自动播放下一曲
代码:PrivateSubPlayer1_PlayStateChange(ByValNewStateAsLong)SelectCaseNewStateCaseIs=wmp...
代码:
Private Sub Player1_PlayStateChange(ByVal NewState As Long)
Select Case NewState
Case Is = wmppsPlaying
Me.Caption = Player1.currentMedia.Name
Me.Caption = Me.Caption & Space(1) & Player1.currentMedia.durationString
Case Is = wmppsMediaEnded
If File1.ListIndex < File1.ListCount - 1 Then
File1.ListIndex = File1.ListIndex + 1
Else
File1.ListIndex = 0
End If
Player1.URL = Dir1.Path & "\" & File1.FileName
Player1.Controls.play
End Select
End Sub
我想实现当windowsmediaplayer播放完这首歌时,自动播放文件列表框的下一首歌,为什么不自动能播放呢?必须按一下“播放”才能播放,(我已经将播放器的自动播放设置为True 了) 展开
Private Sub Player1_PlayStateChange(ByVal NewState As Long)
Select Case NewState
Case Is = wmppsPlaying
Me.Caption = Player1.currentMedia.Name
Me.Caption = Me.Caption & Space(1) & Player1.currentMedia.durationString
Case Is = wmppsMediaEnded
If File1.ListIndex < File1.ListCount - 1 Then
File1.ListIndex = File1.ListIndex + 1
Else
File1.ListIndex = 0
End If
Player1.URL = Dir1.Path & "\" & File1.FileName
Player1.Controls.play
End Select
End Sub
我想实现当windowsmediaplayer播放完这首歌时,自动播放文件列表框的下一首歌,为什么不自动能播放呢?必须按一下“播放”才能播放,(我已经将播放器的自动播放设置为True 了) 展开
2个回答
展开全部
呵呵~,如此简单~。你在加入一个过程就可以了(媒体文件改变的一个过程MediaChange)
Private Sub Player1_MediaChange(ByVal Item As Object)
Player1.Controls.play
End Sub
为了更准确一些,在PlayStateChange过程里加入一个判断
Case Is = wmppsStopped '播放停止
Player1.URL = Dir1.Path & "\" & File1.FileName
Private Sub Player1_MediaChange(ByVal Item As Object)
Player1.Controls.play
End Sub
为了更准确一些,在PlayStateChange过程里加入一个判断
Case Is = wmppsStopped '播放停止
Player1.URL = Dir1.Path & "\" & File1.FileName
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我在做一个播放器 也遇到这样的问题 还没解决呢 能否详细解答一下啊 谢谢啦
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询