编程爱好者联盟 2016-12-22
客户需要使用cuplayer,直接调用swf 播放器。
/Player/player.swf?FlvID=745,此处写入视频ID;
官方给的例子,运行是有问题的。
http://www.cuplayer.com/cuplayer/help/Help62.html
/player.swf?FlvID=745 ,这样写的话,swf会自动调用同目录下面CuSunV3Set.xml的配置文件,
这个文件是固定的,肯定不能达到我们的目的,我们是需要根据一个ID,来或者数据库中的视频地址。
所以这个文件必须是PHP,能接受参数,链接数据库
/player.swf?FlvID=745&JcScpFile=xx.php 这样用才是正确的。
这个xx.php就是一个配置文件,可以写PHP语句了,只要输出,配置文件的,XML格式就可以了。
另外有其实/player.swf?FlvID=745 直接使用这样的 格式也是可以的,只是需要一个.htaccess设置一个转向规则就行了
CuSunV3Set.xml 转向到配置文件地址,就行了,我本地测试可以。但是客户服务器,当时不知道是不是不支持HTACCESS文件,还是其它问题
没有成功,就给他/player.swf?FlvID=745&JcScpFile=xx.php这样使用。
上代码。
<?php header("Content-type:text/html;charset=utf-8");require_once("../Cs_DB.php"); $conn = mysql_connect(CS_Sqlserver,CS_Sqluid,CS_Sqlpwd) or die ("Can't connect db server");@mysql_select_db(CS_Sqlname,$conn) or die ("Can't select db");@mysql_query("SET NAMES 'utf-8'");//@mysql_query("SET NAMES 'utf8'");//’②. 此处对传过来FlvID的值,进行查询 $exec="select id,purl from v4_vod where id = ".$_GET['FlvID'];$result=mysql_query($exec); $row=mysql_fetch_array($result); $u = $row['purl']; $tmp = explode('$',$u); ?>
<CuPlayer> <Player_Set JcScpBufferTime = "3" JcScpVolume = "75" JcScpCode = "utf8" JcScpImgDisplay = "no" JcScpAutoHideControl="yes" JcScpControlHideTime="0.5" JcScpControlheight="40" JcScpShowList= "yes" JcScpAutoRepeat = "no" JcScpsetMode = "1" JcScpAFrontCanClose = "no" JcScpShowRightmenu = "yes" JcScpShareMode = "JcScpVideoPath" JcScpLoadbarMode = "0" JcScpLiveMode = "0" />
<Core_Set JcScpMenuInfo = "百度(Baidu.com)|超有范,更有爱。 酷播,让传播更生动。|官方论坛:bbs.cuplayer.com" JcScpMenuLink = "http://www.baidu.com|http://www.cuplayer.com/CuPlayer|http://bbs.cuplayer.com"
JcScpMinilogoPath = "" JcScpMinilogoLink = "http://www.cuplayer.com/CuPlayer" /> <Logo_Set JcScpLogoDisplay = "no" JcScpLogoPath = "images/logo.png" JcScpLogoPosition = "top-left" JcScpLogoWidth = "150" JcScpLogoHeight = "70" JcScpLogoAlpha = "0.2" />
<Flashvars_Set JcScpAutoPlay = "yes" JcScpServer ="" JcScpVideoPath = "<?php echo $tmp[1];?>"
JcScpVideoPathHD = "" JcScpImg ="images/startpic.jpg" JcScpTitle = "" JcScpStarTime = "0" JcScpEndTime = "0" JcScpCuePointInfo = "提示点1|提示点2|提示点3" JcScpCuePointTime = "50|80|120" ShowJcScpAMoveText = "yes" />
<SkinColor_Set JcScpBackcolor = "0x000000" JcScpBackcolortop = "0x353535" JcScpLightcolor = "0xcfcfcf" JcScpFontcolor = "0xffffff" JcScptimebg = "0x393939" JcScpLoadbar = "0x00a0e9" JcScpLoaded = "0x4d4b4b" JcScpLoadbg = "0x222222" JcScpPlayBtn = "0x2d2d2d" JcScpBar = "0xffffff" /> </CuPlayer>