木子屋 Dnawo's BLOG

支持播放列表的FLV播放器Vcastr 3.0

👤 dnawo 📅 2009-02-14 👁 9587 👍 0 💬 2 🔄 来源:本站原创
Vcastr 是开源的FLV播放器,使用简单,并且功能可以通过插件不断增加其功能,在页面中调用方式为:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="507" height="370">
  <param name="movie" value="vcastr3.swf" />
  <param name="quality" value="high" />
  <param name="allowFullScreen" value="true" />
  <param name="FlashVars" value="xml=xml文件路径或xml片断" />
  <embed src="vcastr3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="507" height="370"></embed>
</object>

xml文件/片断内容如下:

<vcastr>
        <channel>
                <item>
                        <source>http://vcastr.ruochi.com/video/happy_feet.flv</source>
                        <duration></duration>
                        <title></title>
                </item>
                <item>
                        <source>http://vcastr.ruochi.com/video/happy_feet.flv</source>
                        <duration></duration>
                        <title></title>
                </item>
                <item>
                        <source>http://vcastr.ruochi.com/video/happy_feet.flv</source>
                        <duration></duration>
                        <title></title>
                </item>
        </channel>
        <config>
                <bufferTime>4</bufferTime>
                <contralPanelAlpha>0.75</contralPanelAlpha>
                <controlPanelBgColor>0xff6600</controlPanelBgColor>
                <controlPanelBtnColor>0xffffff</controlPanelBtnColor>
                <contralPanelBtnGlowColro>0xffff00</contralPanelBtnGlowColro>
                <controlPanelMode>float</controlPanelMode>
                <defautVolume>0.8</defautVolume>
                <isAutoPlay>true</isAutoPlay>
                <isLoadBegin>true</isLoadBegin>
                <isShowAbout>true</isShowAbout>
                <scaleMode>showAll</scaleMode>
        </config>
</vcastr>

节点说明:

source:flv影片地址参数(必填)
duration:影片的总时间,单位是秒
tilte:影片的标题
link:影片点击后的链接
bufferTime:在缓存区影片的时间,单位是秒
contralPanelAlpha:控制栏的透明度,在 0-1 之间
controlPanelBgColor:控制栏背景的颜色
controlPanelBtnColor:控制按钮的颜色
contralPanelBtnGlowColro:控制按钮光晕的颜色
defautVolume:默认的声音大小,最大为1,最小为0
controlPanelMode:控制栏的显示模式,float|normal|bottom|none
isAutoPlay:是否影片自动开始播放,默认是true
isLoadBegin:是否一开始就读取影片,默认是true
isRepeat:是否循环播放影片,默认是false
isShowAbout:是否显示关于信息
scaleMode:影片放缩模式,showAll|exactFil|noScale|noBorder

上边xml内容可单独放在一个xml文件中(编码为utf-8),也可以直接跟在"xml="后面(为符合w3c标准,此时可用{代替<,}代替>),例如:

<object type="application/x-shockwave-flash" data="vcastr3.swf" width="650" height="500" id="vcastr3">
	<param name="movie" value="vcastr3.swf"/> 
	<param name="allowFullScreen" value="true" />
	<param name="FlashVars" value="xml=
		{vcastr}
			{channel}
				{item}
					{source}http://vcastr.ruochi.com/video/happy_feet.flv{/source}
					{duration}{/duration}
					{title}{/title}
				{/item}
			{/channel}
			{config}
			{/config}
		{/vcastr}"/>
</object>

页面中可用Javascript来对播放器进行控制,常用方法如下(FLVObject为页面的Vcastr播放器对象):

播放:FLVObject.videoPlay()
暂停:FLVObject.pause()
播放/暂停:FLVObject.playPause()
停止:FLVObject.videoStop()
上一个:FLVObject.prev()
下一个:FLVObject.next()
音量:FLVObject.volumeTo(n)


Vcastr 3.0源码下载:http://www.mzwu.com/pic/200902/Vcastr 3.0.zip
Vcastr 3.0官方站点:http://www.ruochi.com/main/2008/03/19/vcastr-30/

评论(2)

mol_xue 2011-10-09 16:26
请问source:flv影片地址我写了中文,会找不到影片,乱码,是由于本身不支持中文吗?
dnawo 2011-10-10 10:16
@mol_xue,建议对地址进行编码应能解决🙂
计算题
评论需审核通过后显示
← 上一篇 C# Object对象的ToString方法在转换日期时丢失毫秒 下一篇 → 中国海峡人才市场借用户口单页和办理户口迁出流程