1.将ckplayer.js、ckplayer.swf、ckplayer.xml、language.xml、style.swf放入KindEditor\plugins
2.将kindeditor.js中_mediaEmbed方法改为:
function _mediaEmbed(attrs) { var html = '<embed '; //获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp var curWwwPath = window.document.location.href; //获取主机地址之后的目录,如: uimcardprj/share/meun.jsp var pathName = window.document.location.pathname; var pos = curWwwPath.indexOf(pathName); //获取主机地址,如: http://localhost:8083 var localhostPath = curWwwPath.substring(0, pos); _each(attrs, function (key, val) { debugger; if (key == "src") { html += key + '="' + K.options.pluginsPath + 'ckplayer/ckplayer.swf" '; html += ' flashvars="f=' + localhostPath + val + '&p=0" '; } else html += key + '="' + val + '" '; }); html += '/>'; return html; }
3.将kindeditor.js中_mediaType方法改为:
function _mediaType(src) {if (/\.(rm|rmvb)(\?|$)/i.test(src)) { return 'audio/x-pn-realaudio-plugin'; } if (/\.(swf|flv|mp4|avi)(\?|$)/i.test(src)) { return 'application/x-shockwave-flash'; } return 'video/x-ms-asf-plugin'; }
4.将kindeditor.js中K.options下的htmlTags下的embed增加 flashvars,
即embed: ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess', 'flashvars'],
5.修改web.config和iis中的上传文件的最大值,iis默认是30M。
Web.config文件中,在<system.web>标记中,增加<httpRuntime maxRequestLength="102400" />
在iis中,双击“请求筛选”-》“编辑功能设置”中允许最大内容长度,设置为100000000
6.在iis的MIME类型中,增加.mp4,类型为application/x-shockwave-flash
7.插入后,在显示前台时,使用div,将KindEditor中的数据,附加到div中即可,具体可播放的html:<embed src="http://网址/Scripts/KindEditor/plugins/ckplayer/ckplayer.swf" flashvars="f=http://网址/Upload/KindEditor/PS_ProjectEvents/940c1f37-57ab-4190-af41-5ee15fdb8153/media/20161227/20161227151618_9003.mp4&p=0" type="application/x-shockwave-flash" width="550" height="400" autostart="false" loop="true">