软件下载 | 资讯教程 | 最近更新 | 下载排行 | 一键转帖 | 发布投稿
您的位置:最火下载站 > Web前端 > 工具与技巧 > 网页中嵌入windows media player播放器插件

网页中嵌入windows media player播放器插件

烈火网(LieHuo.Net)教程 网页中嵌入windows 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>

该object可以插入一个不带有media player自己的播放条的播放器。播放功能要自己写js
如果要自带的播放条,修改参数uiMode = full,不过他只是显示播放条,没有真正的功能,要修改参数enabled = -1
来激活播放条的功能。

如果写js,可以这样:

<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一般在线影院有很多,稍有不同。
    相关阅读
    网友评论
    栏目导航
    推荐软件