Commit 52249dfc authored by 杨培's avatar 杨培

支持播放器大小自适应

parent 6c217da7
.idea .idea
/e/data /e/data/dbcache
/e/data/fc
/e/data/filecache
/e/data/html
/e/data/LoadTemp
/e/data/tmp
/testdata /testdata
/d /d
/build/ /build/
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
//注册 //注册
FCKCommands.RegisterCommand('lecloud', FCKCommands.RegisterCommand('lecloud',
new FCKDialogCommand('lecloud', FCKLang.LecloudTitle, path + "lecloud_insert.html", 300, 200)); new FCKDialogCommand('lecloud', FCKLang.LecloudTitle, path + "lecloud_insert.html", 300, 150));
//定义工具栏 //定义工具栏
var Lecloud = new FCKToolbarButton('lecloud', FCKLang.LecloudTitle); var Lecloud = new FCKToolbarButton('lecloud', FCKLang.LecloudTitle);
......
...@@ -28,7 +28,6 @@ window.onload = function() { ...@@ -28,7 +28,6 @@ window.onload = function() {
oEditor.FCKLanguageManager.TranslatePage(document); oEditor.FCKLanguageManager.TranslatePage(document);
if (oVideo) { if (oVideo) {
$('videoId').value = oVideo.getAttribute("vd");
$('videoVU').value = oVideo.getAttribute("vu"); $('videoVU').value = oVideo.getAttribute("vu");
} }
...@@ -37,8 +36,7 @@ window.onload = function() { ...@@ -37,8 +36,7 @@ window.onload = function() {
}; };
function Ok() { function Ok() {
var videoId = $('videoId').value; var vu = $('videoVU').value;
var videoVU = $('videoVU').value;
oEditor.FCKUndo.SaveUndoStep() ; oEditor.FCKUndo.SaveUndoStep() ;
...@@ -48,8 +46,7 @@ function Ok() { ...@@ -48,8 +46,7 @@ function Ok() {
oFakeImage = null; oFakeImage = null;
} }
oVideo.setAttribute("vd", videoId); oVideo.setAttribute("vu", vu);
oVideo.setAttribute("vu", videoVU);
if (!oFakeImage) { if (!oFakeImage) {
oFakeImage = oEditor.FCKDocumentProcessor_CreateFakeImage('FCK__Lecloud', oVideo) ; oFakeImage = oEditor.FCKDocumentProcessor_CreateFakeImage('FCK__Lecloud', oVideo) ;
...@@ -70,14 +67,7 @@ function $(id) { ...@@ -70,14 +67,7 @@ function $(id) {
<body> <body>
<table cellspacing="3" cellpadding="2" width="100%" border="0"> <table cellspacing="3" cellpadding="2" width="100%" border="0">
<tbody><tr> <tbody>
<td nowrap="nowrap">
<label for="videoId" fcklang="videoId">Video ID:</label>
</td>
<td width="100%">
<input id="videoId" style="width: 100%" tabindex="1" type="text">
</td>
</tr>
<tr> <tr>
<td valign="top" nowrap="nowrap"> <td valign="top" nowrap="nowrap">
<label for="videoVU" fcklang="videoVU">Video VU:</label> <label for="videoVU" fcklang="videoVU">Video VU:</label>
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>帝国CMS-视频播放器集合插件</title>
<style type=text/css>
<!--
{ font-family: 宋体; font-size: 12px; line-height: 19px; color: #333333;text-decoration: none} a:hover { color: #FF0000}a:hover { text-decoration: none}a:hover { line-height: 19px}a:link { font-family: 宋体; font-size: 14px; line-height: 19px; color: #333333;text-decoration: none} a:visited { text-decoration: none; }Table{ font-family: 宋体; font-size: 13px; color: #000000; line-height: 21px; text-decoration: none } }
.box {border: 1px solid #333333;height: 10px;width: 10px;font-size:1px;cursor:hand;filter:blur(add=ture,direction=135,strength=2);}
.STYLE1 {color: #666666}
-->
</Style>
</head>
<body>
<table width="800" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#4FB4DE">
<tr>
<td height="38"><div align="center"><strong><font color="#FFFFFF" size="4">帝国CMS-视频播放器集合插件使用说明</font></strong></div></td>
</tr>
<tr>
<td height="30" bgcolor="#FFFFFF"> <div align="center"><a href="http://www.phome.net/OpenSource/" target="_blank"><font color="#FF0000"><strong>帝国CMS - 最安全、最稳定的开源CMS系统</strong></font></a></div></td>
</tr>
<tr>
<td height="23" bgcolor="#C9F1FF"><strong>一、显示效果:</strong></td>
</tr>
<tr>
<td height="30" bgcolor="#FFFFFF"> <table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td height="23"><div align="center"><img src="doc/demopic.jpg" width="600" height="404"></div></td>
</tr>
</table>
<br></td>
</tr>
<tr>
<td height="23" bgcolor="#C9F1FF"><strong>二、使用语法说明</strong></td>
</tr>
<tr>
<td height="30" bgcolor="#FFFFFF"> <table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td height="25"><strong><font color="#0000FF">(一)、【显示视频播放器JS函数语法说明】</font></strong></td>
</tr>
<tr>
<td height="25"><strong>1、格式:</strong></td>
</tr>
<tr>
<td height="25"><textarea name="textarea" cols="60" rows="5" wrap="off" style="WIDTH:100%">&lt;script src=&quot;/e/data/modadd/moreplayer/empirecmsplayer.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
EmpireCMSPlayVideo('播放器类型','视频地址','显示宽度','显示高度',是否自动播放,'帝国CMS网站地址');
&lt;/script&gt;</textarea></td>
</tr>
<tr>
<td height="25">参数说明:</td>
</tr>
<tr>
<td height="25"><table width="99%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="22%" bgcolor="#FFFFFF">播放器类型:</td>
<td width="78%" bgcolor="#FFFFFF">设为空''或'auto'为自动识别<br>
设为'flash'为采用flash播放器<br>
设为'jwplayer'为采用jwplayer播放器<br>
设为'realplayer'为采用realplayer播放器<br>
设为'mediaplayer'为采用mediaplayer播放器</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">视频地址:</td>
<td bgcolor="#FFFFFF">填要播放的视频地址,比如:http://localhost/file/movie.flv</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">显示宽度:</td>
<td bgcolor="#FFFFFF">视频显示的宽度。</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">显示高度:</td>
<td bgcolor="#FFFFFF">视频显示的高度。</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">是否自动播放:</td>
<td bgcolor="#FFFFFF">0为不自动播放,1为自动播放。</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">帝国CMS网站地址:</td>
<td bgcolor="#FFFFFF">要以“/”结尾,也就是后台系统参数设置的网站地址,模板中用“[!--news.url--]”即可。</td>
</tr>
</table></td>
</tr>
<tr>
<td height="25">&nbsp;</td>
</tr>
<tr>
<td height="25"><strong>2、使用范例1:</strong></td>
</tr>
<tr>
<td height="25"><textarea name="textarea2" cols="80" rows="5" wrap="off" style="WIDTH:100%">&lt;script src=&quot;[!--news.url--]e/data/modadd/moreplayer/empirecmsplayer.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
EmpireCMSPlayVideo('auto','[!--movieurl--]','600','400',0,'[!--news.url--]');
&lt;/script&gt;</textarea></td>
</tr>
<tr>
<td height="25"><font color="#666666">(其中例子中的“[!--movieurl--]”是假设视频地址字段名是movieurl,“[!--news.url--]”为网站地址。)</font></td>
</tr>
<tr>
<td height="25"><strong>3、使用范例2:</strong>(不加到模板,直接在html页面中播放视频)</td>
</tr>
<tr>
<td height="25"><textarea name="textarea3" cols="80" rows="5" wrap="off" style="WIDTH:100%">&lt;script src=&quot;/e/data/modadd/moreplayer/empirecmsplayer.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
EmpireCMSPlayVideo('auto','http://localhost/file/movie.flv','600','400',0,'/');
&lt;/script&gt;</textarea></td>
</tr>
<tr>
<td height="25"><strong>4、使用范例3:</strong>(播放电影系统模型中的第一个视频地址)</td>
</tr>
<tr>
<td height="25"><textarea name="textarea5" cols="80" rows="10" wrap="off" style="WIDTH:100%">&lt;?php
$onlinepath=$navinfor['onlinepath'];//取得onlinepath字段内容
$olr=explode(egetzy('rn'),$onlinepath);
$olfr=explode('::::::',$olr[0]);
?&gt;
&lt;script src=&quot;[!--news.url--]e/data/modadd/moreplayer/empirecmsplayer.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
EmpireCMSPlayVideo('auto','&lt;?=$olfr[1]?&gt;','600','400',0,'[!--news.url--]');
&lt;/script&gt;</textarea></td>
</tr>
<tr>
<td height="25">&nbsp;</td>
</tr>
<tr>
<td height="25"><strong><font color="#0000FF">(二)、【完整范例】</font></strong></td>
</tr>
<tr>
<td height="25">
<textarea name="textarea4" cols="80" rows="22" wrap="off" style="WIDTH:100%">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot;&gt;
&lt;title&gt;视频播放&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;script src=&quot;/e/data/modadd/moreplayer/empirecmsplayer.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
EmpireCMSPlayVideo('auto','http://localhost/file/movie.flv','600','400',0,'/');
&lt;/script&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;</textarea></td>
</tr>
<tr>
<td height="25">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<hr>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td height="25">
<div align="center"><a href="http://www.phome.net" target="_blank">官方网站</a> |
<a href="http://bbs.phome.net" target="_blank">论坛交流</a> | <a href="http://www.phome.net/product/" target="_blank">产品中心</a>
| <a href="http://www.phome.net/download/" target="_blank">产品下载中心</a></div></td>
</tr>
</table>
</body>
</html>
//show
function EmpireCMSPlayVideo(vtype,furl,width,height,autostart,baseurl){
var filetype;
var cfiletype;
var playstr='';
var filetypeflash='|.swf|';
var filetypeflv='|.flv|';
var filetypemediaplayer='|.wmv|.asf|.wma|.mp3|.asx|.mid|.midi|';
var filetyperealplayer='|.rm|.ra|.rmvb|.mp4|.mov|.avi|.wav|.ram|.mpg|.mpeg|';
var filetypejwplayer='|.flv|.mp4|';
if(vtype=='auto'||vtype=='')
{
filetype=EmpireCMSPlayerGetFiletype(furl);
cfiletype='|'+filetype+'|';
if(filetypejwplayer.indexOf(cfiletype)!=-1)//jwplayer
{
playstr=EmpireCMSShowJwplayer(furl,width,height,autostart,baseurl);
}
else if(filetypeflash.indexOf(cfiletype)!=-1)//flash
{
playstr=EmpireCMSShowFlash(furl,width,height,autostart,baseurl);
}
else if(filetyperealplayer.indexOf(cfiletype)!=-1)//realplayer
{
playstr=EmpireCMSShowRealPlayer(furl,width,height,autostart,baseurl);
}
else//mediaplayer
{
playstr=EmpireCMSShowMediaPlayer(furl,width,height,autostart,baseurl);
}
}
else
{
if(vtype=='jwplayer')//jwplayer
{
playstr=EmpireCMSShowJwplayer(furl,width,height,autostart,baseurl);
}
else if(vtype=='flash')//flash
{
playstr=EmpireCMSShowFlash(furl,width,height,autostart,baseurl);
}
else if(vtype=='realplayer')//realplayer
{
playstr=EmpireCMSShowRealPlayer(furl,width,height,autostart,baseurl);
}
else//mediaplayer
{
playstr=EmpireCMSShowMediaPlayer(furl,width,height,autostart,baseurl);
}
}
document.write(playstr);
}
//filetype
function EmpireCMSPlayerGetFiletype(sfile){
var filetype,s;
s=sfile.lastIndexOf(".");
filetype=sfile.substring(s+1).toLowerCase();
return '.'+filetype;
}
//flash
function EmpireCMSShowFlash(furl,width,height,autostart,baseurl){
var str='';
str='<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="'+width+'" height="'+height+'"><param name="movie" value="'+furl+'"><param name="quality" value="high"><embed src="'+furl+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" autostart="'+autostart+'"></embed></object>';
return str;
}
//flv
function EmpireCMSShowFlv(furl,width,height,autostart,baseurl){
var str='';
var fname='';
str='<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="'+width+'" height="'+height+'"><param name="movie" value="'+baseurl+'e/data/modadd/moreplayer/flv/flvplayer.swf?vcastr_file='+furl+'&vcastr_title='+fname+'&BarColor=0xFF6600&BarPosition=1&IsAutoPlay='+autostart+'"><param name="quality" value="high"><param name="allowFullScreen" value="true" /><embed src="flv/flvplayer.swf?vcastr_file='+furl+'&vcastr_title='+fname+'&BarColor=0xFF6600&BarPosition=1&IsAutoPlay='+autostart+'" allowFullScreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed></object>';
return str;
}
//mediaplayer
function EmpireCMSShowMediaPlayer(furl,width,height,autostart,baseurl){
var str='';
str='<object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer" width="'+width+'" height="'+height+'"><PARAM NAME="AUTOSTART" VALUE="'+autostart+'"><param name="ShowStatusBar" value="-1"><param name="Filename" value="'+furl+'"><embed type="application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" flename="mp" src="'+furl+'" width="'+width+'" height="'+height+'"></embed></object>';
return str;
}
//realplayer
function EmpireCMSShowRealPlayer(furl,width,height,autostart,baseurl){
var str='';
str='<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT="'+height+'" ID="Player" WIDTH="'+width+'" VIEWASTEXT><param NAME="_ExtentX" VALUE="12726"><param NAME="_ExtentY" VALUE="8520"><param NAME="AUTOSTART" VALUE="'+autostart+'"><param NAME="SHUFFLE" VALUE="0"><param NAME="PREFETCH" VALUE="0"><param NAME="NOLABELS" VALUE=0><param NAME=CONTROLS VALUE=ImageWindow><param NAME=CONSOLE VALUE=_master><param NAME=LOOP VALUE=0><param NAME=NUMLOOP VALUE=0><param NAME=CENTER VALUE=0><param NAME=MAINTAINASPECT VALUE="'+furl+'"><param NAME=BACKGROUNDCOLOR VALUE="#000000"></object><br><object CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT=32 ID="Player" WIDTH="'+width+'" VIEWASTEXT><param NAME=_ExtentX VALUE=18256><param NAME=_ExtentY VALUE=794><param NAME=AUTOSTART VALUE="'+autostart+'"><param NAME=SHUFFLE VALUE=0><param NAME=PREFETCH VALUE=0><param NAME=NOLABELS VALUE=0><param NAME=CONTROLS VALUE=controlpanel><param NAME=CONSOLE VALUE=_master><param NAME=LOOP VALUE=0><param NAME=NUMLOOP VALUE=0><param NAME=CENTER VALUE=0><param NAME=MAINTAINASPECT VALUE=0><param NAME=BACKGROUNDCOLOR VALUE="#000000"><param NAME=SRC VALUE="'+furl+'"></object>';
return str;
}
//jwplayer
function EmpireCMSShowJwplayer(furl,width,height,autostart,baseurl){
var str='';
str='<scri'+'pt type="text/javascript" src="'+baseurl+'e/data/modadd/moreplayer/jwplayer/jwplayer.js"></scri'+'pt><div id="EmpireCMSmyElement">Loading the player...</div><scri'+'pt type="text/javascript">jwplayer("EmpireCMSmyElement").setup({ autostart:'+autostart+',file: "'+furl+'",height:'+height+',width:'+width+' });</scri'+'pt>';
return str;
}
if (typeof jQuery !== "undefined") {
(function($) {
//加载乐视视频
$("div.lecloud-video").each(function() {
var width = 640, height = 360, rate = width / height;
var video = createVideoElement(width, height);
$(this).replaceWith(video);
//按设定的比例调整大小
var pNode = video.parentNode,
toWidth = pNode.clientWidth >= 800 ? 800 : pNode.clientWidth,
toHeight = toWidth / rate;
setVideo(video, $(this).attr('vu'), toWidth, toHeight);
});
function createVideoElement(w, h) {
var node = document.createElement('iframe');
node.setAttribute("allowfullscreen", true);
node.setAttribute("allowtransparency", true);
node.setAttribute("frameborder", "0");
node.setAttribute("scrolling", "no");
//node.setAttribute("width", w);
//node.setAttribute("height", h);
node.style.maxWidth = "100%";
return node;
}
function setVideo(node, vu, w, h) {
node.setAttribute("width", w);
node.setAttribute("height", h);
node.src = 'http://yuntv.letv.com/bcloud.html?uu=pjseptwfce&vu=' + vu + '&pu=510360dfc7&auto_play=1&width=' + w + '&height=' + h + '&lang=zh_CN';
}
})(jQuery);
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment