十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
有个currentplayerlist属性呀,但是好像没有什么用... 还有一个方法,就是通过PlayStateChange事件来处理 首先要有三个窗体级变量: urls() As String nowplayindex As Integer forend As Boolean 然后在urls中存一个歌曲的路径,在AxWindowsMediaPlayer1_PlayStateChange中拿灶颤加入以下内容: 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 上面的代码实现了顺序播放和循环播放辩余 教你一个方法,可以获取到mp3、wma的歌曲属性 Object.Text = AxWindowsMediaPlayer1.currentMedia.getItemInfo(InfoName) InfoName可以填下面的字符串,如TextBox1.Text = AxWindowsMediaPlayer1.currentMedia.getItemInfo("Title") '获取MP3的消败唱片标题 Abstract、Description = 备注 Author、Artist = 艺术家 AverageLevel = 平均等级? Bitrate = 比特率 Copyright = 版权 CurrentBitrate = 现在的比特率? 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
站在用户的角度思考问题,与客户深入沟通,找到湘桥网站设计与湘桥网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:网站制作、网站设计、企业官网、英文网站、手机端网站、网站推广、国际域名空间、网页空间、企业邮箱。业务覆盖湘桥地区。
方法只是添加一个播放器控件,再改它的属性就可以了.
添加播放器控件的方法:在窗体设计模式中卜做李,右键单击型迟胡帆”工具箱”->”WINDOWS 窗体”,选择”添加/移除项”,再选择”COM组件”标签找到”WINDOWS MEDIA PLAYER”项,选上.最后把添加了控件放到窗体中就行了.
我没有ATI格式的文件也不知道MEDIA PLAYER能放不,不行的话用别的控件试试,比如REALPLAYER.
邮件我已经发过去了.
我这枯燃搏里有一段前段时间写的测试代码,使用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 "没祥当前播放状态:" 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 "当前播放状态:" 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是你仿孙要备散链播放的声音掘碧文件的路径