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">