多少事,从来急,天地转,光阴迫,一万年太久,只争朝夕。
无言博客
一个菜鸟程序员,在复制粘贴的道路上越走越远!!!
网页插入cmp4播放器
无言博客 228 2020-3-19

下载最新 CMP4安装包


1.直接embed标签插入,便捷方式:

<embed width="100%" height="100%" src="http://www.xxxxx.com/cmp/cmp.swf" type="application/x-shockwave-flash"></embed>

2.直接在当前位置写入,最简方式:

<script type="text/javascript" src="http://www.xxxxx.com/cmp/cmp.js"></script>
<script type="text/javascript">
    CMP.write("cmp", "600", "400", "cmp.swf");
</script>

3.在指定容器中插入,易于扩展:

<div id="player" style="width:600px;height:400px;"></div>
<script type="text/javascript" src="http://www.xxxxx.com/cmp/cmp.js"></script>
<script type="text/javascript">
    var htm = CMP.create("cmp", "100%", "100%", "cmp.swf");
    document.getElementById("player").innerHTML = htm;
</script>

4.插入的同时传递一些参数:

<div id="player" style="width:600px;height:400px;"></div>
<script type="text/javascript" src="http://www.xxxxx.com/cmp/cmp.js"></script> 
<script type="text/javascript">
var flashvars = {
    name : "CMP4",
    skin : "skins/vplayer.zip",
    lists : "mylist.xml"
};
var htm = CMP.create("cmp", "100%", "100%", "cmp.swf", flashvars);
document.getElementById("player").innerHTML = htm;
</script>
/*
其中flashvars参数也支持字符串的形式(注意值需要URL转义),如:
var flashvars = "name=CMP4&skin=skins/vplayer.zip&lists=mylist.xml";
*/

关于列表和配置方面,详见 cmp4官方手册

END

发表评论: