ueditor处理不能上传音乐的问题

选了个较简单的方法,在上传视频的功能里处理上传音乐

参考:https://segmentfault.com/a/1190000010364068

但上文方法不能同时上传音乐和视频,需要处理一下第一个方法:文件路径ueditor/dialog/video/video.js

/* 插入上传视频 */ function insertUpload() { var videoObjs = [], uploadDir = editor.getOpt('videoUrlPrefix'), width = parseInt(G('upload_width').value, 10) || 420, height = parseInt(G('upload_height').value, 10) || 280, align = findFocus("upload_alignment", "name") || 'none'; // for (var key in uploadVideoList) { // var file = uploadVideoList[key]; // videoObjs.push({ // url: uploadDir + file.url, // width: width, // height: height, // align: align // }); // } var count = uploadFile.getQueueCount(); // if (count) { // ('.info', '#queueList').html('<span style="color:red;">' + '还有2个未上传文件'.replace(/[\d]/, count) + '</span>'); // return false; // } else { // editor.execCommand('insertvideo', videoObjs, 'upload'); // } if (count) {('.info', '#queueList').html('<span style="color:red;">' + '还有2个未上传文件'.replace(/[\d]/, count) + '</span>'); return false; } else { for (var key in uploadVideoList) { var is_music = 0; var file = uploadVideoList[key]; var ext = file.url.split('.').pop().toLowerCase(); var music_type = ['mp3', 'wav']; for (var i in music_type) { if (music_type[i] == ext) {

is_music = 1; }

} if (is_music) { editor.execCommand('music', { url: uploadDir + file.url, width: 400, height: 95 }); } else { var file = uploadVideoList[key]; videoObjs.push({ url: uploadDir + file.url, width: width, height: height, align: align

}); editor.execCommand('insertvideo', videoObjs, 'upload'); }

}

}

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容