弘帝企业智能建站系统交流平台

 找回密码
 立即注册
查看: 1224|回复: 0

【KindEditor】添加Video标签Mp4视频的方法

[复制链接]
发表于 2021-5-27 12:34:51 | 显示全部楼层 |阅读模式
修改kindeditor.js具体操作如下:
1.将video添加为不需要过滤过的标签
找到
embed: ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'],
行下添加一行代码:
video : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess','controls'],

2.加上MP4视频类型
找到
if (/\.(swf|flv)(\?|$)/i.test(src)) {
        return 'application/x-shockwave-flash';
}
行下添加:
if (/\.(mp4)(\?|$)/i.test(src)) {
    return 'video/mp4';
}

3.根据视频类型判断
找到
if (/\.(swf|flv)(\?|$)/i.test(src)) {
        return 'application/x-shockwave-flash';
}
行下添加:
if(attrs.type=="video/mp4"){
    var html = '<video ';
    _each(attrs, function(key, val) {
        html += key + '="' + val + '" ';
    });
    html += 'controls="controls"/>';
}
经测试,成功完成。


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|弘帝企业智能建站系统 ( 皖ICP备07503252号 )

GMT+8, 2024-4-26 05:40 , Processed in 0.111016 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表