天天看點

如何在網頁中播放FLV檔案的代碼

 使用方法:

方法一、js嵌入

直接copy下面代碼,修改其中紅色部分,即:swf_width、swf_height、texts、files 參數

​​view plain​​​

​​​print​​​

​​​?​​

1. <script type="text/javascript">
2. var swf_width=240
3. var swf_height=240
4. var texts=’幸福的腳丫預告片’
5. var files=’http://vir.jxstnu.edu.cn/xieyunc/product/vcastr/flv/happy_feet.flv’
6. document.write(’<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="’+ swf_width +’" height="’+ swf_height +’">’);
7. document.write(’<param name="movie" value="http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf"><param name="quality" value="high">’);
8. document.write(’<param name="menu" value="false"><param name="allowFullScreen" value="true" />’);
9. document.write(’<param name="FlashVars" value="vcastr_file=’+files+’&vcastr_title=’+texts+’">’);
10. document.write(’<embed src="http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf" allowFullScreen="true" FlashVars="vcastr_file=’+files+’&vcastr_title=’+texts+’" menu="false" quality="high" width="’+ swf_width +’" height="’+ swf_height +’" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />’); document.write(’</object>’);
11. </script>      

其中:

幸福的腳丫預告片 是标題。

http://vir.jxstnu.edu.cn/xieyunc/product/vcastr/flv/happy_feet.flv 是FLV檔案位址。

http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf 是FLV檔案播放器位址(如果你不會制作,可下載下傳别人的然後上傳到自己的空間再調用)。

flv播放器 Vcastr 2.0 下載下傳

​​​http://vir.jxstnu.edu.cn/xieyunc/product/vcastr2/vcastr22.zip​​​

方法二、簡單直接傳遞影片位址

​​view plain​​​

​​​print​​​

​​​?​​

1. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="240" height="180">
2. <param name="movie" value="http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf?vcastr_file=http://vir.jxstnu.edu.cn/xieyunc/product/vcastr/flv/happy_feet.flv">
3. <param name="quality" value="high">
4. <param name="allowFullScreen" value="true" />
5. <embed src="http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf?vcastr_file=http://vir.jxstnu.edu.cn/xieyunc/product/vcastr/flv/happy_feet.flv" allowFullScreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="240" height="180"></embed>
6. </object>      

方法三、讀取影片xml

​​view plain​​​

​​​print​​​

​​​?​​

1. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="240" height="120">
2. <param name="movie" value="http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf?vcastr_xml=http://vir.jxstnu.edu.cn/xieyunc/product/vcastr2/vcastr.xml">
3. <param name="quality" value="high">
4. <param name="allowFullScreen" value="true" />
5. <embed src="http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf?vcastr_xml=http://vir.jxstnu.edu.cn/xieyunc/product/vcastr2/vcastr.xml" allowFullScreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="240" height="120"></embed>
6. </object>      

其中:http://vir.jxstnu.edu.cn/xieyunc/product/vcastr/vcastr.xml 是播放清單的xml位址

進階選項

​​view plain​​​

​​​print​​​

​​​?​​

1. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="240" height="180">
2. <param name="movie" value="http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf?vcastr_file=http://vir.jxstnu.edu.cn/xieyunc/product/vcastr/flv/happy_feet.flv">
3. <param name="quality" value="high">
4. <param name="allowFullScreen" value="true" />
5. <embed src="http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf?vcastr_file=http://vir.jxstnu.edu.cn/xieyunc/product/vcastr/flv/happy_feet.flv" allowFullScreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="240" height="180"></embed>
6. </object>      

在以上"參數A=111&參數B=222"部分添加參數,使用 參數=值 的格式,多個參數用&連接配接,參數數量不限制,注意有2個紅色部分http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf地方需要修改

例如:

​​view plain​​​

​​​print​​​

​​​?​​

1. value="http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf?vcastr_file=http://vir.jxstnu.edu.cn/xieyunc/product/vcastr/flv/happy_feet.flv&vcastr_title=幸福的腳丫預告片&BarColor=0xFF6600&BarPosition=1"      

表示影片位址是"http://vir.jxstnu.edu.cn/xieyunc/product/vcastr/flv/happy_feet.flv",标題是"變形金剛預告片",控制欄顔色是0xFF6600,控制欄位置在下方。

​​view plain​​​

​​​print​​​

​​​?​​

1. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="500" height="224">
2. <param name="movie" value="http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf?vcastr_file=http://vir.jxstnu.edu.cn/xieyunc/product/vcastr/flv/happy_feet.flv&vcastr_title=幸福的腳丫預告片&BarColor=0xFF6600&BarPosition=1">
3. <param name="quality" value="high">
4. <param name="allowFullScreen" value="true" />
5. <embed src="http://vir.jxstnu.edu.cn/xieyunc/attachment/vcastr22.swf?vcastr_file=http://vir.jxstnu.edu.cn/xieyunc/product/vcastr/flv/happy_feet.flv&vcastr_title=幸福的腳丫預告片&BarColor=0xFF6600&BarPosition=1" allowFullScreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="500" height="224"></embed>      

參數名稱 參數說明 預設值 

​​​​

常見問題

問:Logo 文字無法顯示

答:Logo 文字不能支援中文,可以用LogoUrl參數将Logo做成.swf檔案或者.png檔案。

問:xml 如何設定進階參數

答:如下

​​view plain​​​

​​​print​​​

​​​?​​

1. <param name="FlashVars" value="vcastr_xml=http://vir.jxstnu.edu.cn/xieyunc/product/vcastr2/vcastr.xml&vcastr_title=幸福的腳丫預告片|變形金剛預告片|江南MV|魔獸世界-晚安部落&BarColor=0xFF6600&BarPosition=1" />
2. <embed src="http://vir.jxstnu.edu.cn/xieyunc/product/vcastr2/vcastr2.swf" allowFullScreen="true" FlashVars="vcastr_xml=http://vir.jxstnu.edu.cn/xieyunc/product/vcastr2/vcastr.xml&vcastr_title=幸福的腳丫預告片|變形金剛預告片|江南MV|魔獸世界-晚安部落&BarColor=0xFF6600&BarPosition=1">      

問:不能全屏

答:需要更新到flashplayer9.0以上

問:不能退出全屏

答:輕按兩下可以進入或退出全屏

問:影片不能拖動進度

答:是由于轉換檔案格式時候有一些資訊丢失,可以使用FLV MetaData Injector修複, 下載下傳位址: http://www.buraks.com/flvmdi ;

問:flv放在自己伺服器上就不能播放了