網頁中嵌入widow media player播放器插件
??????很簡單的,放在著方便我快速查閱。
media player7.1以上的播放器:
<OBJECT?id=my_mp
??????style="LEFT:?0px;?WIDTH:?341px;?TOP:?0px;?HEIGHT:?237px"?height=200?
??????width=304?classid=clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6?VIEWASTEXT>
??????<PARAM?NAME="URL"?VALUE="">
??????<PARAM?NAME="rate"?VALUE="1">
??????<PARAM?NAME="balance"?VALUE="0">
??????<PARAM?NAME="currentPosition"?VALUE="4">
??????<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="none">
??????<PARAM?NAME="stretchToFit"?VALUE="0">
??????<PARAM?NAME="windowlessVideo"?VALUE="0">
??????<PARAM?NAME="enabled"?VALUE="0">
??????<PARAM?NAME="enableContextMenu"?VALUE="0">
??????<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="13150">
??????<PARAM?NAME="_cy"?VALUE="7673">
??????<param?name="BufferingTime"?value="10">
</OBJECT>
<SCRIPT?language=javascript?event=PlayStateChange?for=my_mp>
????my_mp_PlayStateChange();
</SCRIPT>

<script>
var?p_length?=?228;?//?進度條長度
var?p_left?=?70;????//?進度條與左惻邊緣的距離

var?v_top?=?230;????//?音量條與上惻邊緣的距離(這里音量條美工是用的上下移動層)
var?default_vol?=?50;??//?默認音量

//?下面所有Layer6,Layer7的display=none的代碼都可以不要,看具體情況

function?my_mp_bar()?
{

??if?(my_mp.playState?==?3)?
{
???????Layer6.style.left?=?(my_mp.controls.currentPosition/my_mp.currentMedia.duration)*p_length?+p_left;

??}?else?
{
?????????Layer6.style.display?=?"none";
???????Layer7.style.display?=?"none";
??}
?
??window.setTimeout('my_mp_bar()',1000);

}


function?my_mp_PlayStateChange()?
{
????Layer6.style.display?=?"none";
????Layer7.style.display?=?"none";

????if?(my_mp.playState?==?3)?
{
???????img_play.src?=?"/vidio/play_2.gif";
?????????Layer6.style.display?=?"block";
???????Layer7.style.display?=?"block";
}

//--------------------------------------------------------

var?index;


function?setpos()?
{
????if(Layer6.style.left.length==4)
??????my_mp.controls.currentPosition=(((Layer6.style.left.slice(0,2)-p_left)/p_length)*my_mp.currentMedia.duration);
????else
??????my_mp.controls.currentPosition=(((Layer6.style.left.slice(0,3)-p_left)/p_length)*my_mp.currentMedia.duration);
}


function?setvol()?
{
??my_mp.settings.volume=default_vol+((v_top-Layer7.style.top.slice(0,3))*100/60);
}


function?playVideo()?
{

????try
{
????????my_mp.controls.play();
????????img_play.src?=?"/vidio/play_2.gif";
????????img_stop.src?=?"/vidio/stop.gif";
????????img_pause.src?=?"/vidio/pause.gif";

????}catch(e)
{}
}


function?pauseVideo()?
{

????try
{
????????my_mp.controls.pause();
????????img_play.src?=?"/vidio/play.gif";
????????img_stop.src?=?"/vidio/stop.gif";
????????img_pause.src?=?"/vidio/pause_2.gif";

????}catch(e)
{}
}


function?stopVideo()?
{

??try
{
????my_mp.controls.stop();;
????img_play.src?=?"/vidio/play.gif";
????img_stop.src?=?"/vidio/stop_2.gif";
????img_pause.src?=?"/vidio/pause.gif";

??}?catch(e)
{}
}


function?reverseVideo()?
{
??my_mp.controls.fastReverse();
}


function?forwardVideo()?
{
??my_mp.controls.fastForward();
}


function?videoVol()?
{

??if?(my_mp.settings.mute)?
{
????my_mp.settings.mute?=?0;
????img_vol.src?=?"/vidio/quiet_2.gif";
????Layer7.style.display?=?"block";
??}

??else?
{
????my_mp.settings.mute?=?1;
????img_vol.src?=?"/vidio/quiet_1.gif";
????Layer7.style.display?=?"none";
??}
}


function?videoScreen()?
{
????if?(my_mp.playState?==?3)
????????my_mp.fullScreen?=?true;
}


function?restartVideo(url,?i)?
{
??//?now,?same?video
??stopVideo();
??document.my_mp.URL?=?url;
??clearAllInfo();
??playVideo();
}


function?clearAllInfo()?
{

}

document.my_mp.URL?=?"
.."

my_mp.settings.volume?=?default_vol;
img_vol.src?=?"/vidio/quiet_2.gif";
my_mp_bar();

var?returnValue?=?"";

</script>類似的js一般在線影院有很多,稍有不同。
media player7.1以上的播放器:






























該object可以插入一個不帶有media player自己的播放條的播放器。播放功能要自己寫js
如果要自帶的播放條,修改參數uiMode = full,不過他只是顯示播放條,沒有真正的功能,要修改參數enabled = -1
來激活播放條的功能。
如果寫js,可以這樣:











































































































































































posted on 2006-04-26 17:49 howard 閱讀(4392) 評論(4) 編輯 收藏 所屬分類: JavaScript