您的位置:首页 > 其它

AxWindowsMediaPlayer媒体文件主要方法属性

2009-09-30 18:42 435 查看
axWindowsMediaPlayer1.currentMedia.sourceURL; //获取正在播放的媒体文件的路径
axWindowsMediaPlayer1.currentMedia.name; //获取正在播放的媒体文件的名称
axWindowsMediaPlayer1.Ctlcontrols.Play          播放
axWindowsMediaPlayer1.Ctlcontrols.Stop          停止
axWindowsMediaPlayer1.Ctlcontrols.Pause          暂停
axWindowsMediaPlayer1.Ctlcontrols.PlayCount        文件播放次数
axWindowsMediaPlayer1.Ctlcontrols.AutoRewind       是否循环播放
axWindowsMediaPlayer1.Ctlcontrols.Balance         声道
axWindowsMediaPlayer1.Ctlcontrols.Volume         音量
axWindowsMediaPlayer1.Ctlcontrols.Mute          静音
axWindowsMediaPlayer1.Ctlcontrols.EnableContextMenu    是否允许在控件上点击鼠标右键时弹出快捷菜单
axWindowsMediaPlayer1.Ctlcontrols.AnimationAtStart    是否在播放前先播放动画
axWindowsMediaPlayer1.Ctlcontrols.ShowControls      是否显示控件工具栏
axWindowsMediaPlayer1.Ctlcontrols.ShowAudioControls    是否显示声音控制按钮
axWindowsMediaPlayer1.Ctlcontrols.ShowDisplay       是否显示数据文件的相关信息
axWindowsMediaPlayer1.Ctlcontrols.ShowGotoBar       是否显示Goto栏
axWindowsMediaPlayer1.Ctlcontrols.ShowPositionControls  是否显示位置调节按钮
axWindowsMediaPlayer1.Ctlcontrols.ShowStatusBar      是否显示状态栏
axWindowsMediaPlayer1.Ctlcontrols.ShowTracker       是否显示进度条
axWindowsMediaPlayer1.Ctlcontrols.FastForward       快进
axWindowsMediaPlayer1.Ctlcontrols.FastReverse       快退
axWindowsMediaPlayer1.Ctlcontrols.Rate          快进/快退速率
axWindowsMediaPlayer1.AllowChangeDisplaySize 是否允许自由设置播放图象大小
axWindowsMediaPlayer1.DisplaySize       设置播放图象大小
axWindowsMediaPlayer1.ClickToPlay       是否允许单击播放窗口启动Media Player

axWindowsMediaPlayer.settings.setMode("loop", true);//

在视频播放之后,可以通过如下方式读取源视频的宽度和高度,然后设置其还原为原始的大小.
private void ResizeOriginal()
{
int intWidth = axWindowsMediaPlayer1.currentMedia.imageSourceWidth;
int intHeight = axWindowsMediaPlayer1.currentMedia.imageSourceHeight;
axWindowsMediaPlayer1.Width = intWidth + 2;
axWindowsMediaPlayer1.Height = intHeight + 2;
}

AxWindowsMediaPlayer1.URL 中URL是表示要播放的文件名,取消了原来的Name属性.
AxWindowsMediaPlayer1.Ctlcontrols.play()播放,同样还有Pause,Stop等其他属性.
AxWindowsMediaPlayer1.settings.balance表示媒体播放的声道设置,0表示均衡,-1和1表示左右声道.
AxWindowsMediaPlayer1.currentMedia.duration 表示要播放的文件的时间长度.可用它获取文件长度.
AxWindowsMediaPlayer1.Ctlcontrols.currentPosition表示正在播放的文件的当前播放位置,可用这个属性来对媒体文件进行前进后退等设置.如
AxWindowsMediaPlayer1.Ctlcontrols.currentPosition+1 表示前进1个时间单位.
AxWindowsMediaPlayer1.settings.rate播放速率,一般乘以16后再显示kbps单位.
AxWindowsMediaPlayer1.currentMedia.duration.ToString 则显示结果很可能为0,因此,这时候很可能获取不到文件的播放时间长度,容易出错。所以在利用的时候可以加一个timer控件:

================================================
axWindowsMediaPlayer.fullScreen = true;
执行了这句话后出现异常
错误提示:
灾难性故障(异常来自HRESULT:0x8000FFFF(E_UNEXPECTED))

原因是由于要在播放状态才能设置,解决方法是设置一个timer,过1秒左右再设置就不会出错
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: