adsense

2010-12-30

[vb] windows media player 重複播放

Public Class a

    Private Sub a_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' 新增一個播放清單
        Dim list As WMPLib.IWMPPlaylist = AxWindowsMediaPlayer1.currentPlaylist

        '執行windows media player
        Dim media As WMPLib.IWMPMedia

        '這裡可以擺放數個要播放的檔案   雙引號別忘了
        Media = Me.AxWindowsMediaPlayer1.newMedia("C:\Beethoven's Symphony No. 9 (Scherzo).wma")
        list.appendItem(media)

        media = Me.AxWindowsMediaPlayer1.newMedia("C:\New Stories (Highway Blues).wma")
        list.appendItem(media)

    End Sub
  
    Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange
        AxWindowsMediaPlayer1.Ctlcontrols.play()
    End Sub
End Class

1 則留言:

  1. Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    'wma.URL = "music\背景音樂.mp3" '相對路徑示範
    wma.URL = "http://webhd.must.edu.tw/download/背景音樂.mp3?para=TLXjxW35WGp4VzM1cmovbjk3MTcwMDI4L61JtLqttbzWLm1wM3Q3VExYang=" '使用網路位址示範
    '此為學校的網路硬碟~如果沒有音樂那就是網址變更了!
    wma.Ctlcontrols.play()

    End Sub

    Private Sub wma_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles wma.PlayStateChange

    If wma.playState = WMPLib.WMPPlayState.wmppsStopped Then
    wma.Ctlcontrols.play()
    End If

    End Sub
    End Class

    回覆刪除