有個currentplayerlist屬性呀,但是好像沒有什么用... 還有一個方法,就是通過PlayStateChange事件來處理 首先要有三個窗體級變量: urls() As String nowplayindex As Integer forend As Boolean 然后在urls中存一個歌曲的路徑,在AxWindowsMediaPlayer1_PlayStateChange中拿灶顫加入以下內(nèi)容: If e.newstate = 1 Then If forend = False Then If nowplayindex + 1 = urls.Count Then nowplayindex = 0 AxWindowsMediaPlayer1.URL = urls(0) AxWindowsMediaPlayer1.Ctlcontrols.currentPosition = 0 AxWindowsMediaPlayer1.Ctlcontrols.play() forend = True Else AxWindowsMediaPlayer1.URL = urlss(nowplayindex + 1) AxWindowsMediaPlayer1.Ctlcontrols.currentPosition = 0 AxWindowsMediaPlayer1.Ctlcontrols.play() nowplayindex += 1 forend = True End If End If End If 上面的代碼實現(xiàn)了順序播放和循環(huán)播放辯余 教你一個方法,可以獲取到mp3、wma的歌曲屬性 Object.Text = AxWindowsMediaPlayer1.currentMedia.getItemInfo(InfoName) InfoName可以填下面的字符串,如TextBox1.Text = AxWindowsMediaPlayer1.currentMedia.getItemInfo("Title") '獲取MP3的消敗唱片標題 Abstract、Description = 備注 Author、Artist = 藝術家 AverageLevel = 平均等級? Bitrate = 比特率 Copyright = 版權 CurrentBitrate = 現(xiàn)在的比特率? Duration = 總時間(秒) FileSize = 文件大小 FileType = 文件類型(其實就是擴展名) Is_Protected = 是否受保護 Is_Trusted = 是否受托管? IsVBR = 應該是是否存在可變比特率 MediaType = 媒體類型 SourceURL = 原文件路徑 Streams = 文件流? Title = 唱片標題 Type = 類型 WM/AlbumArtist = 專輯藝術家 WM/AlbumTitle、Album = 專輯 WM/Genre、Genre = 流派 WM/GenreID = 流派編號? WM/Lyrics = 歌詞 WM/PromotionURL = 升級地址? WM/Track = 音軌 WM/TrackNumber = 曲目編號 WMFSDKNeeded = 必須的軟件版本版本 WMFSDKVersion = 軟件版本 WM/Year = 年代 WMServerVersion = 服務器版本? 多教樓主一個信息,是不是要多給點分? 還有,我想問一下,怎么播放avi文件呀? QQ 626808803
站在用戶的角度思考問題,與客戶深入溝通,找到湘橋網(wǎng)站設計與湘橋網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設計與互聯(lián)網(wǎng)技術結合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:網(wǎng)站制作、網(wǎng)站設計、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、國際域名空間、網(wǎng)頁空間、企業(yè)郵箱。業(yè)務覆蓋湘橋地區(qū)。
方法只是添加一個播放器控件,再改它的屬性就可以了.
添加播放器控件的方法:在窗體設計模式中卜做李,右鍵單擊型遲胡帆”工具箱”->”WINDOWS 窗體”,選擇”添加/移除項”,再選擇”COM組件”標簽找到”WINDOWS MEDIA PLAYER”項,選上.最后把添加了控件放到窗體中就行了.
我沒有ATI格式的文件也不知道MEDIA PLAYER能放不,不行的話用別的控件試試,比如REALPLAYER.
郵件我已經(jīng)發(fā)過去了.
我這枯燃搏里有一段前段時間寫的測試代碼,使用WMPLib類,中間有你需要的功能,你可以參考下:
使用wmp.currentMedia.duration和wmp.currentMedia.durationString分別以double和string獲得當前媒體的播放時間,使用wmp.settings.volume設置音量大小,使用wmp.controls.currentPosition設置段遲當前播放時間點
Imports WMPLib
Public Class FrmMain
Dim WithEvents wmp As WMPLib.WindowsMediaPlayer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wmp = New WMPLib.WindowsMediaPlayer()
TextBox1.Text = TextBox1.Text vbCrLf "沒祥當前播放狀態(tài):" wmp.status
wmp.uiMode = "Mini"
wmp.settings.balance = 1
wmp.enableContextMenu = True
wmp.fullScreen = False
wmp.windowlessVideo = True
wmp.enabled = True
Dim wmpMediaList As IWMPPlaylist = wmp.newPlaylist("默認播放列表", "")
Dim wmpMedia As IWMPMedia = wmp.newMedia(My.Computer.FileSystem.CurrentDirectory "\Human.mp3")
With wmpMediaList
.appendItem(wmpMedia)
End With
'wmp.URL = "\\192.168.1.247\sharoncn\music\Human.mp3"
wmp.currentMedia = wmpMedia
wmp.settings.autoStart = True
tBarPlay.Value = 0
ListBox1.Items.Add(wmpMediaList.name)
ListBox1.SelectedIndex = 0
ListBox2.Items.Add(wmpMediaList.Item(0).name)
ListBox2.SelectedIndex = 0
tbar.Maximum = 100
tbar.Value = 50
Timer1.Enabled = True
Timer1.Interval = 100
End Sub
Private Sub wmp_PlayStateChange(ByVal NewState As Integer) Handles wmp.PlayStateChange
tBarPlay.Maximum = wmp.currentMedia.duration * 10
Label1.Text = "總時間:" wmp.currentMedia.durationString
TextBox1.Text = TextBox1.Text vbCrLf "當前播放狀態(tài):" NewState
If NewState = 1 Then
wmp.controls.play()
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.SelectionStart = Len(TextBox1.Text)
TextBox1.ScrollToCaret()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label2.Text = "當前播放進度:" wmp.controls.currentPositionString
tBarPlay.Value = CInt(wmp.controls.currentPosition * 10)
End Sub
Private Sub tbar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbar.Scroll
wmp.settings.volume = tbar.Value
End Sub
Private Sub tBarPlay_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tBarPlay.Scroll
wmp.controls.currentPosition = tBarPlay.Value / 10
End Sub
End Class
My.Computer.Audio.Play("SoundFile.wav")
SoundFile.wav是你仿孫要備散鏈播放的聲音掘碧文件的路徑