我有以下.swf播放器,我想在播放器对象中添加更多控件,如播放和暂停:
<object classid="player" width="780" height="420" codebase="[longurl]"
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
<param value="sameDomain" name="allowScriptAccess" />
<param name="movie" value="/root/Desktop/test.swf" />
<param name="quality" value="best" />
<param value="true" name="controller" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="flashvars"
value='config={"clip":{"url":"video.flv","autoPlay":false}}' />
<param name="allowScriptAccess" value="sameDomain" />
</object>
答案 0 :(得分:0)
我不确定,我们是否可以将Play / Pause选项嵌入到控件中。
但是,我们可以为“播放/暂停”添加一个按钮,点击它可以调用javascript函数为我们播放或暂停。
只需在对象标记中添加id =“myVideo”。
<script>
function playPause(){
if(document.getElementById('myVideo').paused){
document.getElementById('myVideo').play();
}
else
{document.getElementById('myVideo').pause();
}
}
</script>
<button onclick="playPause()">PLAY/PAUSE</button>
<object id="myVideo" classid="player" width="780" height="420" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
<param value="sameDomain" name="allowScriptAccess" />
<param name="movie" value="/root/Desktop/test.swf" />
<param name="quality" value="best" />
<param value="true" name="controller" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="flashvars" value='config={"clip":
{"url":"video.flv","autoPlay":false}}' />
<param name="allowScriptAccess" value="sameDomain" />
</object>