特點(diǎn)
- 使用as3.0重新寫了播放器
- 播放器大小縮小,在20+k左右
- 可以通過xml對(duì)播放器設(shè)置
- 可以播放多個(gè)影片,并且有影片列表
- 可以設(shè)置循環(huán)播放,自動(dòng)播放,是否直接開始下載,控制欄的顏色和模式
- 控制欄可以適應(yīng)超小的尺寸
- 可以使用插件擴(kuò)充播放器的功能
- 可以用插件設(shè)置logo及連接
- 可以用插件來用javascript控制播放器
- 可以用插件來用設(shè)定播放器開始或者結(jié)束的圖片或者flash(swf) beta
更新歷史
下載
插入代碼
直接寫入?yún)?shù)
? ? ? ? <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>
? ? ? ? ? ? ? ? ? ? ? ? <plugIns>
? ? ? ? ? ? ? ? ? ? ? ? </plugIns>
? ? ? ? ? ? ? ? </vcastr> "/>
</object>
如果你需要符合w3c的標(biāo)準(zhǔn),可以用”{”"}”替換xml中的”<"">“,例子
使用xml傳遞參數(shù)
? ? ? ? <param name = “movie” value = “vcastr3.swf” / >
? ? ? ? <param name = “allowFullScreen” value = “true” / >
? ? ? ? <param name = “FlashVars” value = “xml=vcastr.xml” / >
</object>
參數(shù)說明
xml的可以設(shè)置的全部參數(shù),以及默認(rèn)的數(shù)值
? ? ? ? <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 >
? ? ? ? <plugIns >
? ? ? ? ? ? ? ? <logoPlugIn >
? ? ? ? ? ? ? ? ? ? ? ? <url > LogoPlugIn.swf </url >
? ? ? ? ? ? ? ? ? ? ? ? <logoText > Ruochi.com </logoText >
? ? ? ? ? ? ? ? ? ? ? ? <logoTextAlpha > 0.75 </logoTextAlpha >
? ? ? ? ? ? ? ? ? ? ? ? <logoTextFontSize > 24 </logoTextFontSize > ???
? ? ? ? ? ? ? ? ? ? ? ? <logoTextColor > 0xffffff </logoTextColor >
? ? ? ? ? ? ? ? ? ? ? ? <textMargin > 10 auto auto 10 </textMargin >
? ? ? ? ? ? ? ? ? ? ? ? <logoClipUrl > http://www.ruochigroup.com/images/logo.png </logoClipUrl >
? ? ? ? ? ? ? ? ? ? ? ? <logoClipAlpha > 1 </logoClipAlpha >
? ? ? ? ? ? ? ? ? ? ? ? <clipMargin > 10 10 auto auto </clipMargin >
? ? ? ? ? ? ? ? </logoPlugIn >
? ? ? ? ? ? ? ? <beginEndImagePlugIn >
? ? ? ? ? ? ? ? ? ? ? ? <url > beginEndImagePlugIn.swf </url >
? ? ? ? ? ? ? ? ? ? ? ? <source > beginSwfTest.swf </source >
? ? ? ? ? ? ? ? ? ? ? ? <type > begin </type >
? ? ? ? ? ? ? ? ? ? ? ? <scaleType > exactFit </scaleType >
? ? ? ? ? ? ? ? </beginEndImagePlugIn >
? ? ? ? ? ? ? ? <javaScriptPlugIn >
? ? ? ? ? ? ? ? ? ? ? ? <url > javaScriptPlugIn.swf </url >
? ? ? ? ? ? ? ? </javaScriptPlugIn >
? ? ? ? </plugIns >
</vcastr >
以下用”.”描述xml樹結(jié)構(gòu)并說明參數(shù)作用
影片信息
channel.item
影片信息,可以設(shè)置多個(gè)影片
channel.itme.source
flv影片地址參數(shù),此參數(shù)是唯一必須要有的參數(shù),其他參數(shù)都可以不要,播放器有默認(rèn)參數(shù)
channel.itme.duration
對(duì)應(yīng)影片的總時(shí)間, 單位是秒,由于有些影片在制作過程中時(shí)間信息丟失,可以通過這里來設(shè)置
channel.itme.tilte
對(duì)應(yīng)影片的標(biāo)題
channel.itme.link
對(duì)應(yīng)影片點(diǎn)擊后的鏈接
播放器設(shè)置
config.bufferTime
在緩存區(qū)影片的時(shí)間,單位是秒
config.contralPanelAlpha
控制欄的透明度,在 0 — 1 之間
config.controlPanelBgColor
控制欄背景的顏色
config.controlPanelBtnColor
控制按鈕的顏色
config.contralPanelBtnGlowColro
控制按鈕光暈的顏色
config.defautVolume
默認(rèn)的聲音大小,最大為1,最小為0
config.controlPanelMode
控制欄的顯示模式,
“float”: 默認(rèn)的浮動(dòng)模式,鼠標(biāo)移除播放器就會(huì)隱藏掉
“normal”: 正常模式,任何時(shí)候都在影片的下部浮動(dòng)顯示
“bottom”: 下部模式,不浮動(dòng)在影片之上,而是顯示在影片下方
“none”: 不顯示播放器控制欄
config.isAutoPlay
是否影片自動(dòng)開始播放,默認(rèn)是true
config.isLoadBegin
是否一開始就讀取影片,默認(rèn)是true
config.isRepeat
是否循環(huán)播放影片,默然是false
config.isShowAbout
是否顯示關(guān)于信息
config.scaleMode
影片放縮模式:
“showAll”: 可以看到全部影片,保持比例,可能上下或者左右
“exactFil”: 放縮影片到播放器的尺寸,可能比例失調(diào)
“noScale”: 影片的原始尺寸,無放縮
“noBorder”: 影片充滿播放器,保持比例,可能會(huì)被裁剪
插件設(shè)置
plugIns 中每一個(gè)子節(jié)點(diǎn)代表一個(gè)插件,可以設(shè)置多個(gè)插件
plugIns.logoPlugIn,顯示logo插件的參數(shù)設(shè)置
plugIns.logoPlugIn.url
插件的地址,可以使用絕對(duì)地址,也可以使用相對(duì)地址,絕對(duì)地址需要http://開始
plugIns.logoPlugIn.logoText
logo文字,注意之可以使用英文和英文標(biāo)點(diǎn),不支持中文,如果想放中文,就把中文做成文字png透明圖片,用plugIns.logoPlugIn.logoClipUrl參數(shù)設(shè)置
plugIns.logoPlugIn.logoTextAlpha
文字的透明度
plugIns.logoPlugIn.logoTextLink
文字的連接
plugIns.logoPlugIn.logoTextFontSize
文字字體的大小
plugIns.logoPlugIn.logoTextColor
文字的顏色
plugIns.logoPlugIn.textMargin
文字的位置,用了css的margin概念,四個(gè)數(shù)值代表 上 右 下 左 相對(duì)于播放器的距離,四個(gè)數(shù)值用空格分開,不需具體數(shù)值用”auto”填寫 ,比如左上對(duì)齊并都有10像素的距離可以寫 “10 auto auto 10″, 右下角對(duì)齊是”auto 10 10 auto”
plugIns.logoPlugIn.logoClipUrl
圖片logo的url,可以使用絕對(duì)地址,也可以使用相對(duì)地址,絕對(duì)地址需要http://開始
plugIns.logoPlugIn.logoClipAlpha
圖片logo的透明度
plugIns.logoPlugIn.logoClipLink
圖片logo的連接
plugIns.logoPlugIn.clipMargin
圖片logo的位置,用了css的margin概念,四個(gè)數(shù)值代表 上 右 下 左 相對(duì)于播放器的距離,四個(gè)數(shù)值用空格分開,不需具體數(shù)值用”auto”填寫 ,比如左上對(duì)齊并都有10像素的距離可以寫 “10 auto auto 10″, 右下角對(duì)齊是”auto 10 10 auto”
plugIns.javaScriptPlugIn,javaScript控制插件的參數(shù)設(shè)置
plugIns.javaScriptPlugIn.url
插件的地址,可以使用絕對(duì)地址,也可以使用相對(duì)地址,絕對(duì)地址需要http://開始
javaScript插件
使用方法參看實(shí)例頁面
http://vcastr.ruochi.com/v3/vcastr_javaScript_example.html
javaScript可以控制播放器 播放,暫停,停止,快進(jìn),快退,下一個(gè),上一個(gè),音量控制,影片跳轉(zhuǎn)到需要的時(shí)間
在javaScript可以獲得播放器的事件,有四個(gè)參數(shù)回來,分別是type:事件種類,state:當(dāng)前狀態(tài), phayHeadTime:當(dāng)前播放時(shí)間,loadPersent:下載百分比
事件 type有
stateChange,播放狀態(tài)變化,播放或者暫停
complete,播放完畢
init,播放器初始化完畢
ready,影片下載了一部分,已經(jīng)可以開始播放
playheadUpdate,每一秒即發(fā)一次
startBuffering,開始緩沖
stopBuffering,緩沖結(jié)束
狀態(tài) state
playing,播放中
paused,暫停中
beginEndImagePlugIn 影片開始和結(jié)尾需要加載外部資源(可以是圖片或者swf)的插件
beginEndImagePlugIn.logoPlugIn.url
插件的地址,可以使用相對(duì)或者絕對(duì)地址,絕對(duì)地址需要http://開始
beginEndImagePlugIn.logoPlugIn.source
開始的圖片或者swf的地址
beginEndImagePlugIn.logoPlugIn.type
顯示方式,有3種顯示方法,begin:在開始的顯示,end:結(jié)尾部分顯示,beginEnd:在開始和結(jié)尾部分同時(shí)顯示
beginEndImagePlugIn.logoPlugIn.scaleType
“showAll”: 可以看到全部影片,保持比例,可能上下或者左右
“exactFil”: 放縮影片到播放器的尺寸,可能比例失調(diào)
“noScale”: 影片的原始尺寸,無放縮
“noBorder”: 影片充滿播放器,保持比例,可能會(huì)被裁剪
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
