js wmp操作代码小结(音乐连播功能)
2024-05-06 14:16:49
供稿:网友
WMP-网页中常见属性和方法
<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject" id="wmp" width="0" height="0" style="width:0px;height:0px;"></object>
//基本属性
wmp.URL:String; //指定媒体位置,本机或网络地址
wmp.uiMode:String; //播放器界面模式,可为Full, Mini, None, Invisible
wmp.playState:integer; //播放状态,1=停止,2=暂停,3=播放,6=正在缓冲,9=正在连接,10=准备就绪
wmp.enableContextMenu:Boolean; //启用/禁用右键菜单
wmp.fullScreen:boolean; //是否全屏显示
//播放器常用控制
wmp.controls.play; //播放
wmp.controls.pause; //暂停
wmp.controls.stop; //停止
wmp.controls.currentPosition:double; //当前进度
wmp.controls.currentPositionString:string; //当前进度,字符串格式。如“00:23”
wmp.controls.fastForward; //快进
wmp.controls.fastReverse; //快退
wmp.controls.next; //下一曲
wmp.controls.previous; //上一曲
//播放器常用设置
wmp.settings.volume:integer; //音量,0-100
wmp.settings.autoStart:Boolean; //是否自动播放
wmp.settings.mute:Boolean; //是否静音
wmp.settings.playCount:integer; //播放次数
wmp.settings.balance = -100; //(左声)
wmp.settings.balance=100; //(右声)
wmp.settings.balance=0; //(全声)
//常用当前媒体属性
wmp.currentMedia.duration:double; //媒体总长度
wmp.currentMedia.durationString:string; //媒体总长度,字符串格式。如“03:24”
wmp.currentMedia.getItemInfo(const string); //获取当前媒体信息
//"Title"=媒体标题 "Author"=艺术家 "Copyright"=版权信息
//"Description"=媒体内容描述 "Duration"=持续时间(秒)
//"FileSize"=文件大小 "FileType"=文件类型 "sourceURL"=原始地址
wmp.currentMedia.setItemInfo(const string); //通过属性名设置媒体信息
wmp.currentMedia.name:string; //同currentMedia.getItemInfo("Title")
wmp.network.bufferingProgress; //缓冲百分比
wmp.network.downloadProgress; //下载百分比
较全面的页面参数设置
<object id="Player" height="10" width="100" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<param name="URL" value="" />
<param name="rate" value="1" />
<param name="balance" value="0" />
<param name="currentPosition" value="0" />
<param name="defaultFrame" />
<param name="playCount" value="1" />
<param name="autoStart" value="true" />
<param name="currentMarker" value="0" />
<param name="invokeURLs" value="-1" />
<param name="baseURL" />
<param name="volume" value="50" />
<param name="mute" value="0" />
<param name="uiMode" value="invisible" />
<param name="stretchToFit" value="0" />
<param name="windowlessVideo" value="0" />
<param name="enabled" value="-1" />
<param name="enableContextMenu" value="-1" />