7.5.13 播放接口调用
采用FLEX开放的播放器编译后最终生成的是一个.swf文件,需要通过页面去加载调用,可以是静态的html页面,也可以是动态的aspx页面,调用过程中引用之前讲过的swfobject.js,
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var swfVersionStr = "10.0.0";
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
flashvars.videoUrl = "xxx.flv";
flashvars.videoWidth = "640";
flashvars.videoHeight = "400";
flashvars.videoVolumn = "0.6";
flashvars.isAutoPlay = "true";
var params = {};
params.quality = "high";
params.bgcolor = "#ffffff";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "player";
attributes.name = "player";
attributes.align = "middle";
swfobject.embedSWF(
"player.swf", "flashContent",
"650", "450",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
</script>
<div id="flashContent"></div>
其中flashContent标签作为嵌入的swf播放器文件(player.swf)的容器,同时网站的http头进行如下设置(添加.flv和.f4v扩展名):