帝国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+'FileMain.php?'+ecmseditorv.config.filebrowserImageBrowseUrl+'&doecmspage=TranMedia&type=3&tranfrom=1&field=&InstanceId='+ecmseditorv.id+'&InstanceName='+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:'etmediatoplay', type:'select', label:'播映器', default:"7", items:[ ['主动挑选','0'], ['HTML5Video','5'], ['HTML5Audio','6'], ['MediaPlayer','1'], ['RealPlayer','2'], ['FlvPlayer','3'], ['FlashPlayer','4'], ['CKPlayer','7'] ] }, { id:'etmediaplaymod', type:'select', label:'播映形式', items:[ ['主动播映','0'], ['手动播映','1'] ] } ]}, {type:"html",id:"preview",style:"width:100%;",html:"<p><strong>"+CKEDITOR.tools.htmlEncode(ecmseditorv.lang.common.preview)+ "</strong>:<aonclick=etmediaview('cke_MediaPreviewBox_"+ecmseditorv.name+"');>[点击这儿显现预览]</a><br><pid='cke_MediaPreviewBox_"+ecmseditorv.name+"'class='MediaPreviewBox'></p></p>"} ] }, {id:"Upload",label:ecmseditorv.lang.image.upload,elements:[ { type:"html", style:"width:500;height:250", html:'<IFRAMEframeBorder="0"id="edtmedia'+ecmseditorv.name+'"name="edtmedia'+ecmseditorv.name+'"scrolling="auto"src="'+ecmseditorv.config.filebrowserFlashUploadUrl+'editorpage/ecmseditorpage.php?'+ecmseditorv.config.filebrowserFlashBrowseUrl+'&doecmspage=TranMedia&type=3&InstanceId='+ecmseditorv.id+'&InstanceName='+ecmseditorv.name+'&CKEditorFuncNum='+ecmseditorv._.filebrowserFn+'&langCode='+ecmseditorv.langCode+'"style="HEIGHT:250px;VISIBILITY:inherit;WIDTH:100%;Z-INDEX:2"></IFRAME>' } ]}, ], onOk:function(){ varehtmlstr=''; varemediaurl=this.getValueOf('etmediainfo1','etmediaurl'); varewidth=this.getValueOf('etmediainfo1','etmediawidth'); vareheight=this.getValueOf('etmediainfo1','etmediaheight'); varetoplay=this.getValueOf('etmediainfo1','etmediatoplay'); vareplaymod=this.getValueOf('etmediainfo1','etmediaplaymod'); ehtmlstr=etmediaViewFile(emediaurl,ewidth,eheight,etoplay,eplaymod); //点击确认按钮后的操作 ecmseditorv.insertHtml(ehtmlstr); document.getElementById('cke_MediaPreviewBox_'+ecmseditorv.name).innerHTML=''; }, onCancel:function(){ document.getElementById('cke_MediaPreviewBox_'+ecmseditorv.name).innerHTML=''; } } }) })(); //预览 functionetmediaview(viewid){ varehtmlstr=''; varemediaurl=CKEDITOR.dialog.getCurrent().getContentElement('etmediainfo1','etmediaurl').getValue(); varewidth=CKEDITOR.dialog.getCurrent().getContentElement('etmediainfo1','etmediawidth').getValue(); vareheight=CKEDITOR.dialog.getCurrent().getContentElement('etmediainfo1','etmediaheight').getValue(); varetoplay=CKEDITOR.dialog.getCurrent().getContentElement('etmediainfo1','etmediatoplay').getValue(); vareplaymod=CKEDITOR.dialog.getCurrent().getContentElement('etmediainfo1','etmediaplaymod').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=''; varaddauto=''; if(autostart=="true") { addauto='autoplay="autoplay"'; } 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='<videoid="ecmsvideoid"width="'+width+'"height="'+height+'"controls="controls"'+addauto+'><sourcesrc="'+furl+'"></source>Yourbrowserisnotsupported</video>'; } elseif(toplay==6)//html5audio { imgstr='<audioid="ecmsaudioid"src="'+furl+'"controls="controls"'+addauto+'>Yourbrowserisnotsupported</audio>'; } 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=`<pclass="videoplayer-box"id="`+pid+`"style="width:`+width+`;height:`+height+`"> <videoclass="videoplayer"id="`+vid+`"src="`+furl+`"`+addauto+`width="100%"height="100%"></video> </p> <scriptsrc="/e/data/ckplayer/ckplayer.js"></script> <scripttype="text/javascript"> newckplayer({ container:'#`+pid+`', variable:'player', poster:'', mobileCkControls:true, mobileAutoFull:false, h5container:'#`+vid+`', video:'`+furl+`' }); </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=='') { return''; } autostart="true"; if(playmod==1) { autostart="false"; } if(toplay==0) { filetype=etmediaToGetFiletype(furl); if(filetype=='.flv') { toplay=3; } elseif(html5types.indexOf(','+filetype+',')!=-1) { toplay=5; } elseif(html5audiotypes.indexOf(','+filetype+',')!=-1) { toplay=6; } elseif(filetype=='.swf') { toplay=4; } elseif(mediatypes.indexOf(','+filetype+',')!=-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'.'+filetype; } functionEHEcmsEditorDoTranMedia(str){ CKEDITOR.dialog.getCurrent().getContentElement('etmediainfo1','etmediaurl').setValue(str); CKEDITOR.dialog.getCurrent().selectPage('etmediainfo1'); }
4、铲除浏览器缓存后即可。
声明:有的资源均来自网络转载,版权归原作者所有,如有侵犯到您的权益 请联系邮箱:123456@qq.com 我们将配合处理!
原文地址:帝国cms7.5二次开发整合CKPlayer播放器教程发布于2022-06-21 07:43:53