.net富文本KindEditor集成CKPlayer實現播放MP4


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&amp;p=0" type="application/x-shockwave-flash" width="550" height="400" autostart="false" loop="true">


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM