最新公告
  • 欢迎您光临329687站长资源网,本站秉承服务宗旨 履行“站长”责任,销售只是起点 服务永无止境!立即加入我们
  • 帝国cms7.5整合CKPlayer播放器教程说明

    将帝国cms7.5编辑器整合CKPlayer播放器,支持一个页面多个视频播放

    帝国cms7.5整合CKPlayer播放器教程步骤

    1、下载ckplayer播放器,下载地址:http://www.ckplayer.com/down/

    2、解压后放置 /e/data/ckplayer/目录

    3、替换信息编辑器中的视频上传js控件,路径为:/e/admin/ecmseditor/infoeditor/plugins/etranmedia/dialogs/etranmedia.js

    (function(){
    CKEDITOR.dialog.add("etranmedia",
    function(ecmseditorv){
    return{
    title:"插入视频",
    minWidth:"500",
    minHeight:"400",
    contents:[{
    id:"etmediainfo1",
    label:"常规",
    title:"常规",
    expand:true,
    width:"500px",
    height:"400px",
    padding:0,
    elements:[
    					{type:"hbox",widths:["90%","10%"],align:"right",children:[
    					{id:"etmediaurl",type:"text",label:"<strong>视频地址</strong>",style:"width:100%;float:left;","default":""}
    					,{type:"button",id:"browse",filebrowser:{action:"Browse",target:"etmediainfo1:etmediaurl",url:ecmseditorv.config.filebrowserFlashUploadUrl+&#039;FileMain.php?&#039;+ecmseditorv.config.filebrowserImageBrowseUrl+&#039;&doecmspage=TranMedia&type=3&tranfrom=1&field=&InstanceId=&#039;+ecmseditorv.id+&#039;&InstanceName=&#039;+ecmseditorv.name},style:"display:inline-block;margin-top:14px;",hidden:!0,label:"选择"}]},
    					
    					{type:"hbox",widths:["25%","25%","25%","25%"],align:"right",children:[
    					{id:"etmediawidth",type:"text",label:"宽度",style:"width:100%;float:left","default":"100%"},
    					{id:"etmediaheight",type:"text",label:"高度",style:"width:100%;float:left","default":"auto"},
    					
    					{
    						id:&#039;etmediatoplay&#039;,
    						type:&#039;select&#039;,
    						label:&#039;播放器&#039;,
    						default:"7",
    						items:[
    							[&#039;自动选择&#039;,&#039;0&#039;],
    							[&#039;HTML5Video&#039;,&#039;5&#039;],
    							[&#039;HTML5Audio&#039;,&#039;6&#039;],
    							[&#039;MediaPlayer&#039;,&#039;1&#039;],
    							[&#039;RealPlayer&#039;,&#039;2&#039;],
    							[&#039;FlvPlayer&#039;,&#039;3&#039;],
    							[&#039;FlashPlayer&#039;,&#039;4&#039;],
    							[&#039;CKPlayer&#039;,&#039;7&#039;]
    						]
    					},
    					
    					{
    						id:&#039;etmediaplaymod&#039;,
    						type:&#039;select&#039;,
    						label:&#039;播放模式&#039;,
    						items:[
    							[&#039;自动播放&#039;,&#039;0&#039;],
    							[&#039;手动播放&#039;,&#039;1&#039;]
    						]
    					}
    					]},
    					
    					{type:"html",id:"preview",style:"width:100%;",html:"<div><strong>"+CKEDITOR.tools.htmlEncode(ecmseditorv.lang.common.preview)+
    "</strong>:<aonclick=etmediaview(&#039;cke_MediaPreviewBox_"+ecmseditorv.name+"&#039;);>[点击这里显示预览]</a><br><divid=&#039;cke_MediaPreviewBox_"+ecmseditorv.name+"&#039;class=&#039;MediaPreviewBox&#039;></div></div>"}
    				
    				]
    },
    			
    {id:"Upload",label:ecmseditorv.lang.image.upload,elements:[	
    	{
    		type:"html",
    		style:"width:500;height:250",
    		html:&#039;<IFRAMEframeBorder="0"id="edtmedia&#039;+ecmseditorv.name+&#039;"name="edtmedia&#039;+ecmseditorv.name+&#039;"scrolling="auto"src="&#039;+ecmseditorv.config.filebrowserFlashUploadUrl+&#039;editorpage/ecmseditorpage.php?&#039;+ecmseditorv.config.filebrowserFlashBrowseUrl+&#039;&doecmspage=TranMedia&type=3&InstanceId=&#039;+ecmseditorv.id+&#039;&InstanceName=&#039;+ecmseditorv.name+&#039;&CKEditorFuncNum=&#039;+ecmseditorv._.filebrowserFn+&#039;&langCode=&#039;+ecmseditorv.langCode+&#039;"style="HEIGHT:250px;VISIBILITY:inherit;WIDTH:100%;Z-INDEX:2"></IFRAME>&#039;
    	}
    ]},
    			
    			
    			],
    onOk:function(){
    				varehtmlstr=&#039;&#039;;
    				varemediaurl=this.getValueOf(&#039;etmediainfo1&#039;,&#039;etmediaurl&#039;);
    				varewidth=this.getValueOf(&#039;etmediainfo1&#039;,&#039;etmediawidth&#039;);
    				vareheight=this.getValueOf(&#039;etmediainfo1&#039;,&#039;etmediaheight&#039;);
    				varetoplay=this.getValueOf(&#039;etmediainfo1&#039;,&#039;etmediatoplay&#039;);
    				vareplaymod=this.getValueOf(&#039;etmediainfo1&#039;,&#039;etmediaplaymod&#039;);
    				ehtmlstr=etmediaViewFile(emediaurl,ewidth,eheight,etoplay,eplaymod);
    //点击确定按钮后的操作
    				ecmseditorv.insertHtml(ehtmlstr);
    				document.getElementById(&#039;cke_MediaPreviewBox_&#039;+ecmseditorv.name).innerHTML=&#039;&#039;;
    },
    			
    			onCancel:function(){
    				document.getElementById(&#039;cke_MediaPreviewBox_&#039;+ecmseditorv.name).innerHTML=&#039;&#039;;
    }
    			
    }
    })
    })();
    
    
    //预览
    functionetmediaview(viewid){	
    	varehtmlstr=&#039;&#039;;
    	varemediaurl=CKEDITOR.dialog.getCurrent().getContentElement(&#039;etmediainfo1&#039;,&#039;etmediaurl&#039;).getValue();
    	varewidth=CKEDITOR.dialog.getCurrent().getContentElement(&#039;etmediainfo1&#039;,&#039;etmediawidth&#039;).getValue();
    	vareheight=CKEDITOR.dialog.getCurrent().getContentElement(&#039;etmediainfo1&#039;,&#039;etmediaheight&#039;).getValue();
    	varetoplay=CKEDITOR.dialog.getCurrent().getContentElement(&#039;etmediainfo1&#039;,&#039;etmediatoplay&#039;).getValue();
    	vareplaymod=CKEDITOR.dialog.getCurrent().getContentElement(&#039;etmediainfo1&#039;,&#039;etmediaplaymod&#039;).getValue();
    	ehtmlstr=etmediaViewFile(emediaurl,ewidth,eheight,etoplay,eplaymod);
    	document.getElementById(viewid).innerHTML=ehtmlstr;
    }
    functionget_uid(){
    functionS4(){
    return(((1+Math.random())*0x10000)|0).toString(16).substring(1);
    }
    return(S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
    }
    //返回播放器代码
    functionetmediaViewFileCode(toplay,width,height,autostart,furl){
    	varfname=&#039;&#039;;
    	varaddauto=&#039;&#039;;
    	if(autostart=="true")
    	{
    		addauto=&#039;autoplay="autoplay"&#039;;
    	}
    	if(toplay==1)//media
    	{
    		imgstr="<objectalign=middleclassid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"class="OBJECT"id="MediaPlayer"width=""+width+""height=""+height+""><PARAMNAME="AUTOSTART"VALUE=""+autostart+""><paramname="ShowStatusBar"value="-1"><paramname="Filename"value=""+furl+""><embedtype="application/x-oleobjectcodebase=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>";
    	}
    	elseif(toplay==5)//html5video
    	{
    		imgstr=&#039;<videoid="ecmsvideoid"width="&#039;+width+&#039;"height="&#039;+height+&#039;"controls="controls"&#039;+addauto+&#039;><sourcesrc="&#039;+furl+&#039;"></source>Yourbrowserisnotsupported</video>&#039;;
    	}
    	elseif(toplay==6)//html5audio
    	{
    		imgstr=&#039;<audioid="ecmsaudioid"src="&#039;+furl+&#039;"controls="controls"&#039;+addauto+&#039;>Yourbrowserisnotsupported</audio>&#039;;
    	}
    	elseif(toplay==3)//flv
    	{
    		imgstr="<objectclassid="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+""><paramname="movie"value="/e/data/images/flvplayer.swf?vcastr_file="+furl+"&vcastr_title="+fname+"&BarColor=0xFF6600&BarPosition=1&IsAutoPlay="+autostart+""><paramname="quality"value="high"><paramname="allowFullScreen"value="true"/><embedsrc="/e/data/images/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>";
    	}
    	elseif(toplay==4)//flash
    	{
    		imgstr="<objectclassid="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+""><paramname="movie"value=""+furl+""><paramname="quality"value="high"><embedsrc=""+furl+""quality="high"pluginspage="http://www.macromedia.com/go/getflashplayer"type="application/x-shockwave-flash"width=""+width+""height=""+height+""><paramname="autoplay"value=""+autostart+""/></embed></object>";
    	}
    	elseif(toplay==7)//CKPlayer
    	{
    		varuid=get_uid();
    		varvid="video-"+uid;
    		varpid="player-"+uid;
    		imgstr=`<divclass="videoplayer-box"id="`+pid+`"style="width:`+width+`;height:`+height+`">
    				<videoclass="videoplayer"id="`+vid+`"src="`+furl+`"`+addauto+`width="100%"height="100%"></video>
    				</div>
    				<scriptsrc="/e/data/ckplayer/ckplayer.js"></script>
    				<scripttype="text/javascript">
    				newckplayer({
    						container:&#039;#`+pid+`&#039;,
    						variable:&#039;player&#039;,
    						poster:&#039;&#039;,
    						mobileCkControls:true,
    						mobileAutoFull:false,
    						h5container:&#039;#`+vid+`&#039;,
    						video:&#039;`+furl+`&#039;
    				});
    				</script>`;
    	}
    	else//reaplayer
    	{
    		imgstr="<objectclassid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"HEIGHT=""+height+""ID="Player"WIDTH=""+width+""VIEWASTEXT><paramNAME="_ExtentX"VALUE="12726"><paramNAME="_ExtentY"VALUE="8520"><paramNAME="AUTOSTART"VALUE=""+autostart+""><paramNAME="SHUFFLE"VALUE="0"><paramNAME="PREFETCH"VALUE="0"><paramNAME="NOLABELS"VALUE=0><paramNAME=CONTROLSVALUE=ImageWindow><paramNAME=CONSOLEVALUE=_master><paramNAME=LOOPVALUE=0><paramNAME=NUMLOOPVALUE=0><paramNAME=CENTERVALUE=0><paramNAME=MAINTAINASPECTVALUE=""+furl+""><paramNAME=BACKGROUNDCOLORVALUE="#000000"></object><br><objectCLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"HEIGHT=32ID="Player"WIDTH=""+width+""VIEWASTEXT><paramNAME=_ExtentXVALUE=18256><paramNAME=_ExtentYVALUE=794><paramNAME=AUTOSTARTVALUE=""+autostart+""><paramNAME=SHUFFLEVALUE=0><paramNAME=PREFETCHVALUE=0><paramNAME=NOLABELSVALUE=0><paramNAME=CONTROLSVALUE=controlpanel><paramNAME=CONSOLEVALUE=_master><paramNAME=LOOPVALUE=0><paramNAME=NUMLOOPVALUE=0><paramNAME=CENTERVALUE=0><paramNAME=MAINTAINASPECTVALUE=0><paramNAME=BACKGROUNDCOLORVALUE="#000000"><paramNAME=SRCVALUE=""+furl+""></object>";
    	}
    	returnimgstr;
    }
    
    //返回
    functionetmediaViewFile(furl,width,height,toplay,playmod){
    	varimgstr="";
    	varautostart;
    	varmediatypes=",.wmv,.asf,.wma,.mp3,.asx,.mid,.midi,";
    	varrealtypes=",.rm,.ra,.rmvb,.mp4,.mov,.avi,.wav,.ram,.mpg,.mpeg,";
    	varhtml5types=",.mp4,.ogg,.webm,";
    	varhtml5audiotypes=",.mp3,.ogg,.wav,";
    	varfiletype;
    	if(furl==&#039;&#039;)
    	{
    		return&#039;&#039;;
    	}
    	autostart="true";
    	if(playmod==1)
    	{
    		autostart="false";
    	}
    	if(toplay==0)
    	{
    		filetype=etmediaToGetFiletype(furl);
    		if(filetype==&#039;.flv&#039;)
    		{
    			toplay=3;
    		}
    		elseif(html5types.indexOf(&#039;,&#039;+filetype+&#039;,&#039;)!=-1)
    		{
    			toplay=5;
    		}
    		elseif(html5audiotypes.indexOf(&#039;,&#039;+filetype+&#039;,&#039;)!=-1)
    		{
    			toplay=6;
    		}
    		elseif(filetype==&#039;.swf&#039;)
    		{
    			toplay=4;
    		}
    		elseif(mediatypes.indexOf(&#039;,&#039;+filetype+&#039;,&#039;)!=-1)
    		{
    			toplay=1;
    		}
    		else
    		{
    			toplay=2;
    		}
    	}
    	imgstr=etmediaViewFileCode(toplay,width,height,autostart,furl);
    	returnimgstr;
    }
    
    functionetmediaToGetFiletype(sfile){
    	varfiletype,s;
    	s=sfile.lastIndexOf(".");
    	filetype=sfile.substring(s+1).toLowerCase();
    	return&#039;.&#039;+filetype;
    }
    
    
    functionEHEcmsEditorDoTranMedia(str){
    	CKEDITOR.dialog.getCurrent().getContentElement(&#039;etmediainfo1&#039;,&#039;etmediaurl&#039;).setValue(str);
    	CKEDITOR.dialog.getCurrent().selectPage(&#039;etmediainfo1&#039;);
    }

    4、清除浏览器缓存后即可。


    329站长网 » 帝国cms7.5二次开发整合CKPlayer播放器教程

    常见问题FAQ

    免费下载或者VIP会员专享资源能否直接商用?
    本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
    提示下载完但解压或打开不了?
    最常见的情况是下载不完整: 可对比下载完压缩包的与网盘上的容量,若小于网盘提示的容量则是这个原因。这是浏览器下载的bug,建议用百度网盘软件或迅雷下载。若排除这种情况,可在对应资源底部留言,或 联络我们.。
    找不到素材资源介绍文章里的示例图片?
    对于PPT,KEY,Mockups,APP,网页模版等类型的素材,文章内用于介绍的图片通常并不包含在对应可供下载素材包内。这些相关商业图片需另外购买,且本站不负责(也没有办法)找到出处。 同样地一些字体文件也是这种情况,但部分素材会在素材包内有一份字体下载链接清单。
    329687站长资源网
    一个专注于各种网站源码、程序模板、技术教程分享的站长资源下载平台
    • 5会员总数(位)
    • 2062资源总数(个)
    • 112本周发布(个)
    • 17 今日发布(个)
    • 209稳定运行(天)

    提供最优质的资源集合

    立即查看 了解详情