AxWindowsMediaPlayer的详细用法Word格式.docx
《AxWindowsMediaPlayer的详细用法Word格式.docx》由会员分享,可在线阅读,更多相关《AxWindowsMediaPlayer的详细用法Word格式.docx(13页珍藏版)》请在冰豆网上搜索。
![AxWindowsMediaPlayer的详细用法Word格式.docx](https://file1.bdocx.com/fileroot1/2023-1/28/32e9c008-8e2c-4be3-9480-2bb0c709fae3/32e9c008-8e2c-4be3-9480-2bb0c709fae31.gif)
如“00:
23”
controls.fastForward;
快进
controls.fastReverse;
快退
controls.next;
下一曲
controls.previous;
上一曲
[settings]wmp.settings//播放器基本设置
settings.volume:
音量,0-100
settings.autoStart:
是否自动播放
settings.mute:
是否静音
settings.playCount:
播放次数
[currentMedia]wmp.currentMedia//当前媒体属性
currentMedia.duration:
媒体总长度
currentMedia.durationString:
媒体总长度,字符串格式。
如“03:
24”
currentMedia.getItemInfo(conststring);
获取当前媒体信息"
Title"
=媒体标题,"
Author"
=艺术家,"
Copyright"
=版权信息,"
Description"
=媒体内容描述,"
Duration"
=持续时间(秒),"
FileSize"
=文件大小,"
FileType"
=文件类型,"
sourceURL"
=原始地址
currentMedia.setItemInfo(conststring);
通过属性名设置媒体信息
currentMedia.name:
同currentMedia.getItemInfo("
)
[currentPlaylist]wmp.currentPlaylist//当前播放列表属性
currentPlaylist.count:
当前播放列表所包含媒体数
currentPlaylist.Item[integer];
获取或设置指定项目媒体信息,其子属性同wmp.currentMedia
AxWindowsMediaPlayer控件的属
MediaPlayer1.Play 播放
MediaPlayer1.Stop 停止
MediaPlayer1.Pause
暂停
MediaPlayer1.PlayCount 文件播放次数
MediaPlayer1.AutoRewind 是否循环播放
MediaPlayer1.Balance 声道
MediaPlayer1.Volume 音量
MediaPlayer1.Mute 静音
MediaPlayer1.EnableContextMenu 是否允许在控件上点击鼠标右键时弹出快捷菜单
MediaPlayer1.AnimationAtStart 是否在播放前先播放动画
MediaPlayer1.ShowControls 是否显示控件工具栏
MediaPlayer1.ShowAudioControls 是否显示声音控制按钮
MediaPlayer1.ShowDisplay 是否显示数据文件的相关信息
MediaPlayer1.ShowGotoBar 是否显示Goto栏
MediaPlayer1.ShowPositionControls 是否显示位置调节按钮
MediaPlayer1.ShowStatusBar 是否显示状态栏
MediaPlayer1.ShowTracker 是否显示进度条
MediaPlayer1.FastForward 快进
MediaPlayer1.FastReverse 快退
MediaPlayer1.Rate 快进/快退速率
MediaPlayer1.AllowChangeDisplaySize 是否允许自由设置播放图象大小
MediaPlayer1.DisplaySize 设置播放图象大小
1-MpDefaultSize 原始大小
2-MpHalfSize
原始大小的一半
3-MpDoubleSize
原始大小的两倍
4-MpFullScreen
全屏
5-MpOneSixteenthScreen
屏幕大小的1/16
6-MpOneFourthScreen 屏幕大小的1/4
7-MpOneHalfScreen 屏幕大小的1/2
MediaPlayer1.ClickToPlay 是否允许单击播放窗口启动Media
Player
AxWindowsMediaPlayer常用属性
2008-03-1821:
28
2.Ctlcontrols属性
Ctlcontrols属性是AxWindowsMediaPlayer的一个重
要属性,此控件中有许多常用成员。
(1)方法play
用于播放多媒体文件,其格式为:
窗体名.控件名.Ctlcontrols.play()
如:
AxWindowsMediaPlayer1.Ctlcontrols.play()
‘此处缺省窗体名是Me
(2)方法pause
用于暂停正在播放的多媒体文件,其格式为:
窗体名.控件名.Ctlcontrols.pause()
AxWindowsMediaPlayer1.Ctlcontrols.pause()
(3)方法stop
用于停止正在播放的多媒体文件,其格式为:
窗体名.控件名.Ctlcontrols.stop()
AxWindowsMediaPlayer1.Ctlcontrols.stop()
(4)方法fastforward
用于将正在播放的多媒体文件快进,其格式为:
窗体名.控件名.Ctlcontrols.fastforward()
AxWindowsMediaPlayer1.Ctlcontrols.forward()
(5)方法fastreverse
窗体名.控件名.Ctlcontrols.fastreverse()
AxWindowsMediaPlayer1.Ctlcontrols.fastreverse
()
6.属性CurrentPosition
用于获取多媒体文件当前的播放进度,其值是数值类
型,使用格式为:
窗体名.控件名.Ctlcontrols.currentPosition
d1=AxWindowsMediaPlayer1.Ctlcontrols.currentPosi
tion
其中d1是一个整型变量。
7.属性Duration
用于获取当前多媒体文件的播放的总时间,其值为数
值类型,其使用格式为:
窗体名.控件名.currentMedia.duration
d2
=AxWindowsMediaPlayer1.currentMedia.duration
其中d2是一个整型变量。
当前进
度,字符串格式。
23”
播放器界面模式,可为Full,Mini,
None,Invisible
播放状态,1=停止,2=暂停,
3=播放,6=正在缓冲,9=正在连接,10=准备就绪
player.PlayStateChange+=newAxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(player_PlayStateChange);
privatevoidplayer_PlayStateChange(objectsender,AxWMPLib._WMPOCXEvents_PlayStateChangeEvente)
{
//Testthecurrentstateoftheplayeranddisplayamessageforeachstate.
switch(e.newState)
{
case0:
//Undefined
currentStateLabel.Text="
Undefined"
;
break;
case1:
//Stopped
Stopped"
case2:
//Paused
Paused"
case3:
//Playing
Playing"
case4:
//ScanForward
ScanForward"
case5:
//ScanReverse
ScanReverse"
case6:
//Buffering
Buffering"
case7:
//Waiting
Waiting"
case8:
//MediaEnded
MediaEnded"
case9:
//Transitioning
Transitioning"
case10:
//Ready
Ready"
case11:
//Reconnecting
Reconnecting"
case12:
//Last
Last"
default:
currentStateLabel.Text=("
UnknownState:
"
+e.newState.ToString());
}
}
媒体总长度
,字符串格式。
获取当
前媒体信息"
=艺术
家,"
=媒体内
容描述,"
=
文件大小,"
=原
始地址
通过属
性名设置媒体信息
同
currentMedia.getItemInfo("
[currentPlaylist]wmp.currentPlaylist//当前播
放列表属性
当前播放列表所
包含媒体数
获取或设置指定
项目媒体信息,其子属性同wmp.currentMedia
axWindowsMediaPlayer1控件怎么用?
就像QQ一样,有消息来就有声音提示。
我用axWindowsMediaPlayer1来做声音播放器。
但是我不知道axWindowsMediaPlayer1控件怎么用。
哪位大侠能给个例子。
答:
没人理我
用法教程
msdn参考
MSDN有WMP的SDK,另外,如果只是一小段声音的话,sndPlaySound函数是个不错的选择(.netframework2.0里在Microsoft.VisualBasic.Devices.Audio类里已经有相关的函数的.net版了,连声明API都省了~)
AxWindowsMediaPlayerObject(VBandC#)
TheAxWindowsMediaPlayerobjectistherootobjectfortheWindowsMediaPlayercontrol.Itsupportstheproperties,methods,andeventslistedinthefollowingtables.
TheAxWindowsMediaPlayerobjectsupportsthefollowingproperties.
Property
Description
cdromCollection
GetsanIWMPCdromCollectioninterface.
closedCaption
GetsanIWMPClosedCaptioninterface.
Ctlcontrols
GetsanIWMPControlsinterface.
Ctlenabled
GetsorsetsavalueindicatingwhethertheWindowsMediaPlayercontrolisenabled.
currentMedia
GetsorsetstheIWMPMediainterfacethatcorrespondstothecurrentmediaitem.
currentPlaylist
GetsorsetsthecurrentIWMPPlaylist
interface.
dvd
GetsanIWMPDVDinterface.
enableContextMenu
Getsorsetsavalueindicatingwhethertoenablethecontextmenu,whichappearswhentherightmousebuttonisclicked.
Error
GetsanIWMPErrorinterface.
fullScreen
Getsorsetsavalueindicatingwhethervideocontentisplayedbackinfull-screenmode.
isOnline
Getsavalueindicatingwhethertheuserisconnectedtoanetwork.
isRemote
Notsupportedfor.NETprogramming.
mediaCollection
GetsanIWMPMediaCollectioninterface.
network
GetsanIWMPNetworkinterface.
openState
Getsavalueindicatingthestateofthecontentsource.
playerApplication
playlistCollection
GetsanIWMPPlaylistCollectioninterface.
playState
GetsavalueindicatingthestateoftheWindowsMediaPlayeroperation.
settings
GetsanIWMPSettingsinterface.
status
GetsavalueindicatingthecurrentstatusofWindowsMediaPlayer.
stretchToFit
GetsorsetsavalueindicatingwhethervideowillstretchtofitsizeoftheWindowsMediaPlayercontrolvideodisplay.
uiMode
GetsorsetsavalueindicatingwhichcontrolsareshownintheuserinterfacewhenWindowsMediaPlayerisembeddedinaWebpage.
URL
Getsorsetsthenameofthecliptoplay.
versionInfo
GetsavaluethatspecifiestheversionoftheWindowsMediaPlayer.
windowlessVideo
GetsorsetsavalueindicatingwhethertheWindowsMediaPlayercontrolrendersvideoinwindowlessmode.
Method
close
ReleasesWindowsMediaPlayerresources.
launchURL
SendsaURLtotheuser'
sdefaultbrowsertoberendered.
newMedia
ReturnsanIWMPMediainterfaceforanewmediaitem.
newPlaylist
returnsanIWMPPlaylistinterfaceforanewplaylist.
openPlayer
OpensWindowsMediaPlayerusingthespecifiedURL.
TheAxWindowsMediaPlayerobjectsupportsthefollowingevents.
Event
AudioLanguageChange
Occurswhenthecurrentaudio