AxWindowsMediaPlayer 主要屬性與方法

屬性/方法名: 說明:
[基本屬性]  
URL:String; 指定媒體位置,本機或網絡地址
uiMode:String; 播放器界面模式,可爲Full, Mini, None, Invisible
playState:integer; 播放狀態,1=停止,2=暫停,3=播放,6=正在緩衝,9=正在連接,10=準備就緒
enableContextMenu:Boolean; 啓用/禁用右鍵菜單
fullScreen:boolean; 是否全屏顯示
[controls] wmp.controls //播放器基本控制
controls.play; 播放
controls.pause; 暫停
controls.stop; 停止
controls.currentPosition:double; 當前進度
controls.currentPositionString:string; 當前進度,字符串格式。如“00:23”
controls.fastForward; 快進
controls.fastReverse; 快退
controls.next; 下一曲
controls.previous; 上一曲
[settings] wmp.settings //播放器基本設置
settings.volume:integer; 音量,0-100
settings.autoStart:Boolean; 是否自動播放
settings.mute:Boolean; 是否靜音
settings.playCount:integer; 播放次數
[currentMedia] wmp.currentMedia //當前媒體屬性
currentMedia.duration:double; 媒體總長度
currentMedia.durationString:string; 媒體總長度,字符串格式。如“03:24”
currentMedia.getItemInfo(const string); 獲取當前媒體信息"Title"=媒體標題,"Author"=藝術家,"Copyright"=版權信息,"Description"=媒體內容描述,"Duration"=持續時間(秒),"FileSize"=文件大小,"FileType"=文件類型,"sourceURL"=原始地址
currentMedia.setItemInfo(const string); 通過屬性名設置媒體信息
currentMedia.name:string; 同 currentMedia.getItemInfo("Title")
[currentPlaylist] wmp.currentPlaylist //當前播放列表屬性
currentPlaylist.count:integer; 當前播放列表所包含媒體數
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  

 

http://blog.csdn.net/brouse8079/archive/2007/10/17/1829885.aspx

 

AxWindowsMediaPlayer常用屬性
2008-03-18 21: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是一個整型變量。
controls.currentPositionString:string; 當前進

度,字符串格式。如“00:23”


屬性/方法名: 說明:
[基本屬性]  

URL:String; 指定媒體位置,本機或網絡地址
uiMode:String; 播放器界面模式,可爲Full, Mini,

None, Invisible
playState:integer; 播放狀態,1=停止,2=暫停,

3=播放,6=正在緩衝,9=正在連接,10=準備就緒

player.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(player_PlayStateChange);

private void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
    // Test the current state of the player and display a message for each state.
    switch (e.newState)
    {
        case 0:    // Undefined
            currentStateLabel.Text = "Undefined";
            break;

        case 1:    // Stopped
            currentStateLabel.Text = "Stopped";
            break;

        case 2:    // Paused
            currentStateLabel.Text = "Paused";
            break;

        case 3:    // Playing
            currentStateLabel.Text = "Playing";
            break;

        case 4:    // ScanForward
            currentStateLabel.Text = "ScanForward";
            break;

        case 5:    // ScanReverse
            currentStateLabel.Text = "ScanReverse";
            break;

        case 6:    // Buffering
            currentStateLabel.Text = "Buffering";
            break;

        case 7:    // Waiting
            currentStateLabel.Text = "Waiting";
            break;

        case 8:    // MediaEnded
            currentStateLabel.Text = "MediaEnded";
            break;

        case 9:    // Transitioning
            currentStateLabel.Text = "Transitioning";
            break;

        case 10:   // Ready
            currentStateLabel.Text = "Ready";
            break;

        case 11:   // Reconnecting
            currentStateLabel.Text = "Reconnecting";
            break;

        case 12:   // Last
            currentStateLabel.Text = "Last";
            break;

        default:
            currentStateLabel.Text = ("Unknown State: " + e.newState.ToString());
            break;
    }
}

 

 


enableContextMenu:Boolean; 啓用/禁用右鍵菜單
fullScreen:boolean; 是否全屏顯示
controls.currentPosition:double; 當前進度
controls.fastForward; 快進
controls.fastReverse; 快退
controls.next; 下一曲
controls.previous; 上一曲
[settings] wmp.settings //播放器基本設置
settings.volume:integer; 音量,0-100
settings.autoStart:Boolean; 是否自動播放
settings.mute:Boolean; 是否靜音
settings.playCount:integer; 播放次數
[currentMedia] wmp.currentMedia //當前媒體屬性
currentMedia.duration:double; 媒體總長度
currentMedia.durationString:string; 媒體總長度

,字符串格式。如“03:24”
currentMedia.getItemInfo(const string); 獲取當

前媒體信息"Title"=媒體標題,"Author"=藝術

家,"Copyright"=版權信息,"Description"=媒體內

容描述,"Duration"=持續時間(秒),"FileSize"=

文件大小,"FileType"=文件類型,"sourceURL"=原

始地址
currentMedia.setItemInfo(const string); 通過屬

性名設置媒體信息
currentMedia.name:string; 同

currentMedia.getItemInfo("Title")
[currentPlaylist] wmp.currentPlaylist //當前播

放列表屬性
currentPlaylist.count:integer; 當前播放列表所

包含媒體數
currentPlaylist.Item[integer]; 獲取或設置指定

項目媒體信息,其子屬性同wmp.currentMedia

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章