客戶需要使用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>