网页中加入Windows media 和操作方法
1、加入Windows Media<OBJECT id=phx height=44 width=220 classid=clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6><PARAM NAME="URL" VALUE="mms://mms.cnr.cn/cnr001?MzE5MTg0IzEjIzI5NjgwOQ=="><PARAM NAME="rate" VALUE="1"><PARAM NAME="balance" VALUE="0"><PARAM NAME="currentPosition" VALUE="196.7526689"><PARAM NAME="defaultFrame" VALUE=""><PARAM NAME="playCount" VALUE="1"><PARAM NAME="autoStart" VALUE="-1"><PARAM NAME="currentMarker" VALUE="0"><PARAM NAME="invokeURLs" VALUE="-1"><PARAM NAME="baseURL" VALUE=""><PARAM NAME="volume" VALUE="50"><PARAM NAME="mute" VALUE="0"><PARAM NAME="uiMode" VALUE="full"><PARAM NAME="stretchToFit" VALUE="0"><PARAM NAME="windowlessVideo" VALUE="0"><PARAM NAME="enabled" VALUE="-1"><PARAM NAME="enableContextMenu" VALUE="-1"><PARAM NAME="fullScreen" VALUE="0"><PARAM NAME="SAMIStyle" VALUE=""><PARAM NAME="SAMILang" VALUE=""><PARAM NAME="SAMIFilename" VALUE=""><PARAM NAME="captioningID" VALUE=""><PARAM NAME="enableErrorDialogs" VALUE="0"><PARAM NAME="_cx" VALUE="5821"><PARAM NAME="_cy" VALUE="1164"> <!--播放器显示模式:Full显示全部;mini最简化;None不显示播放控制,只显示视频窗口;invisible全部不显示--> </OBJECT>
2、JS控制Windows Media 的方法
<SCRIPT language=javascript>var playUrl;var volv ;var arr = new Array();if(arr = parseXmlToShinyvMaterialArray('<Materials><Material><ID><!]></ID><Type><!]></Type><Name><!]></Name><Size><!]></Size><PlayLength><!]></PlayLength><Bitrate><!]></Bitrate><MediaType><!]></MediaType><MediaFormat><!]></MediaFormat><VideoWndSize><!]></VideoWndSize><PlayUrlAsx><!]></PlayUrlAsx><PlayUrlReal><!]></PlayUrlReal></Material></Materials>')){playUrl = arr.PlayUrlAsx;}function playerInit(){zurl = getParameter('zurl');zname = getParameter('zname');if(zurl != null ){phx.URL = decodeURIComponent(zurl);}else{phx.URL = playUrl;}if(zname != null){songName.innerHTML = decodeURIComponent(zname);}setInterval("if(phx.playState==3){phx.currentMedia.durationString=='00:00'?s='':s='/'+phx.currentMedia.durationString;time.innerText = phx.controls.currentPositionString+s}",1000);setInterval("if(phx.playState==0){time.innerText = '准备'}",1000);setInterval("if(phx.playState==1){time.innerText = '停止'}",1000);setInterval("if(phx.playState==2){time.innerText = '暂停'}",1000);setInterval("if(phx.playState==4){time.innerText = 'ScanForward'}",1000);setInterval("if(phx.playState==5){time.innerText = 'ScanReverse'}",1000);setInterval("if(phx.playState==6){time.innerText = '缓冲'}",1000);setInterval("if(phx.playState==7){time.innerText = '准备'}",1000);setInterval("if(phx.playState==8){time.innerText = 'MediaEnded'}",1000);setInterval("if(phx.playState==9){time.innerText = '准备'}",1000);setInterval("if(phx.playState==10){time.innerText = '准备'}",1000);setInterval("if(phx.playState==11){time.innerText = '准备'}",1000);window.setTimeout('setInterval("if(phx.currentMedia != null){if(phx.currentMedia.duration){if(phx.playState==3){bar.style.width=parseInt(196*(phx.controls.currentPosition/phx.currentMedia.duration))}}}",3000)', 500);setInterval("if(phx.playState==1){playImg.src = '/templates/shinyv_zgzs/images/anniu_img_a01.png'}",1000);}//央广定制,读取url;function getParameter( sProp ) { var re = new RegExp( sProp + "=([^\&]*)", "i" ); var a = re.exec( document.location.search ); if ( a == null ) return null; return a;}function volup(){if (volv < 100){volv += 10;phx.settings.volume=volv;time.innerText="音量"+volv;}else{time.innerText='最大';}}function voldown(){if (volv>0){volv -= 10;phx.settings.volume=volv;time.innerText="音量"+volv;}else{time.innerText='最小';}}function playbutton(){if(phx.playState == 2 || phx.playState == 1){if(phx.playState != 3){playImg.src = "/templates/shinyv_zgzs/images/anniu_img_a01_stop.png";phx.controls.play();time.innerText='播放';}}else{if(phx.currentMedia.durationString != '00:00'){playImg.src = "/templates/shinyv_zgzs/images/anniu_img_a01.png";phx.controls.pause();time.innerText='暂停';}}}function initPlay(){if(phx.playState != 2 && phx.playState != 1){playImg.src = "/templates/shinyv_zgzs/images/anniu_img_a01_stop.png";}else{playImg.src = "/templates/shinyv_zgzs/images/anniu_img_a01.png";}if(phx.URL == ''){time.innerText = "加载节目未找到!播放下一曲!";}}function ckeckObject() {try {volv= phx.settings.volume;if(phx.playState!=3) {playerInit();initPlay();}}catch(e){window.setTimeout('ckeckObject();', 1000);}}ckeckObject();</SCRIPT>
页:
[1]