Kindeditor-all.js文件修改:
1.修改支持MP4格式视频
// if (/\.(swf|flv)(\?|$)/i.test(src)) { //源码
if (/\.(swf|flv|mp4)(\?|$)/i.test(src)) { //需修改为
return ‘application/x-shockwave-flash’;
}
2.修改媒体流方法
function _mediaEmbed(attrs) {
// var html = ‘<embed ‘;// 源码;
var html = ‘<embed id=”player” name=”player” allowscriptaccess=”always” allowfullscreen=”true” ‘; //需修改为;
Flash.js文件修改
1.修改设置
var html = K.mediaImg(self.themesPath + ‘common/blank.gif’, {
// src : url, // 源码
flashvars : ‘file=’ + url, //需修改为
src : ‘/Uploads/media/player.swf’,//需修改为
2.修改
var img = self.plugin.getSelectedFlash();
if (img) {
var attrs = K.mediaAttrs(img.attr(‘data-ke-tag’));
// urlBox.val(attrs.src);//源码;
urlBox.val(attrs.flashvars);//需修改为 ;
如果是服务上传脚本是php的话,修改upload_json.php文件:
‘image’ => array(‘gif’, ‘jpg’, ‘jpeg’, ‘png’, ‘bmp’),
‘flash’ => array(‘swf’, ‘flv’),
//’media’ => array(‘swf’, ‘flv’, ‘mp3’, ‘wav’, ‘wma’, ‘wmv’, ‘mid’, ‘avi’, ‘mpg’, ‘asf’, ‘rm’, ‘rmvb’),//源码;
‘media’ => array(‘swf’, ‘flv’, ‘mp3’, ‘wav’, ‘wma’, ‘wmv’, ‘mid’, ‘avi’, ‘mpg’, ‘asf’, ‘rm’, ‘rmvb’,’mp4′),//需修改为 ;
如果是服务上传脚本是php的话,根据file_manager_json.php脚本设置的路径新建相应文件夹,并确保该文件夹具备写权限:
//根目录路径,可以指定绝对路径,比如 /var/www/attached/
$root_path = $php_path . ‘../attached/’;
//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
$root_url = $php_url . ‘../attached/’;
即在kindeditor下新建一个attached文件夹。并设置该文件夹具备读写权限。
在需要播放的web视频的页面添加jwplayer插件的引入路径及License
<script type=”text/javascript” src=”__PUBLIC__/jwplayer/jwplayer.js”></script>
<script type=”text/JavaScript”>jwplayer.key=”*********上jwplayer官网注册下载时就会有key********”;</script>
并在添加以下js代码,即可确保chrome、360、firefox浏览器皆可兼容视屏播放:
$(document).ready(function(e) {
//非视频,不加载播放器
if(document.getElementById(‘player’) != null) {
jwplayer(‘player’).onReady(function() {});
jwplayer(‘player’).onPlay(function() {});
jwplayer(“player”).play();
}
var src = document.getElementById(‘player’) != null? document.getElementById(‘player’).getAttribute(‘src’):”;
//加载视频。
jwplayer(“player”).setup({
file: src, //此处放视频封面图片地址
image: “http://yc.duoduo365.com.cn/Public/app/ty1.png”,//此处放视频封面图片
// primary: “flash” //360极速模式不支持,会报错!
});
});
评论前必须登录!
注册