mediaplayer控件问题目
问题,如果我用它来做收音机,加入地址后点播放它会加载数据,我要在它未播放的时候在一个文本框显示"正在加载字样",如果开始播放后就出现计时部分,计时部分就不用你们帮忙了,就是不知那个属性判断它是否已经加载到外部收音机地址方文是否已经开始播放.
[解决办法]
用Wmp.dll控件:
WindowsMediaPlayer1.playState :
integer类型数据; 播放状态,1=停止,2=暂停,3=播放,6=正在缓冲,9=正在连接,10=准备就绪
[解决办法]
正好我也做个这样的东西,下面的代码参考一下,我的代码是在右下的托盘中显示的:
Private Sub WMPlayer_StatusChange()
DoEvents
SetTrayTip "网络电台:" & mudtCurStation.RadioName & " " & WMPlayer.Status
mintTimeout = 0
If WMPlayer.playState = wmppsPlaying Then
Timer1.Enabled = False
SetTrayIcon picTray(1).Picture
mnuSwitch.Caption = "停止"
ElseIf WMPlayer.playState = wmppsStopped Or WMPlayer.playState = wmppsPaused Or WMPlayer.playState = wmppsReady Then
SetTrayIcon picTray(2).Picture
mnuSwitch.Caption = "播放"
Timer1.Enabled = False
ElseIf WMPlayer.playState = wmppsBuffering Or _
WMPlayer.playState = wmppsReconnecting Or _
WMPlayer.playState = wmppsTransitioning Then
Timer1.Enabled = True '
End If
End Sub
[解决办法]
Private Sub WindowsMediaPlayer1_PlayStateChange(ByVal NewState As Long)
If NewState = 10 Then '缓冲完
MediaPlayer1.Controls.play '再播放
End If
End Sub