又是FCK,昨天收集了些资料终于把多媒体插入搞定了!
让FCK支持MP3、AVI等多媒体文件上传与播放! 在fckeditor中插入视频或音频文件
1、分别打开:editor/js/fckeditorcode_ie.js和/editor/js/fckeditorcode_gecko.js 找到 C.src.endsWith('.swf',true)
替换为:
(C.src.endsWith('.swf',true) || C.src.endsWith('.wma',true) || C.src.endsWith('.wmv',true)
|| C.src.endsWith('.avi',true) || C.src.endsWith('.asx',true) || C.src.endsWith('.asp',true)
|| C.src.endsWith('.mov',true) || C.src.endsWith('.qt',true) || C.src.endsWith('.mp3',true)
|| C.src.endsWith('.rm',true) || C.src.endsWith('.ra',true) || C.src.endsWith('.rmvb',true)
|| C.src.endsWith('.mid',true) || C.src.endsWith('.ram',true))
2、打开/editor/dialog/fck_flash/fck_flash.js
增加
function WinPlayer(url){ var r, re; re = /.(avi|wmv|asf|wma|mid|mp3|mpg)$/i; r = url.match(re); return r; }
function RealPlayer(url){ var r, re; re = /.(.rm|.ra|.rmvb|ram)$/i; r = url.match(re); return r; }
function QuickTime(url){ var r, re; re = /.(mov|qt)$/i; r = url.match(re); return r; }
function FlashPlayer(url){ var r, re; re = /.swf$/i; r = url.match(re); return r; }
3、找到e.type = 'application/x-shockwave-flash' ; 替换为
if(WinPlayer(GetE('txtUrl').value)!=null){ e.type = 'application/x-mplayer2' ; }
if(RealPlayer(GetE('txtUrl').value)!=null){ e.type = 'audio/x-pn-realaudio-plugin' ; }
if(QuickTime(GetE('txtUrl').value)!=null){ e.type = 'video/quicktime' ; }
if(FlashPlayer(GetE('txtUrl').value)!=null){ SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ;
SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ; }
4、找到
SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ;
SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ;
替换为:
if(WinPlayer(GetE('txtUrl').value)!=null){ e.type = 'application/x-mplayer2' ; SetAttribute(
e, 'autostart', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ; }
if(RealPlayer(GetE('txtUrl').value)!=null){ e.type = 'audio/x-pn-realaudio-plugin' ;
SetAttribute( e, 'autostart', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ; }
if(QuickTime(GetE('txtUrl').value)!=null){ e.type = 'video/quicktime' ; SetAttribute( e,
'autostart', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ; }
if(FlashPlayer(GetE('txtUrl').value)!=null){ e.type = 'application/x-shockwave-flash' ;
SetAttribute( e, 'scale', GetE('cmbScale').value ) ; SetAttribute( e, 'menu', GetE
('chkMenu').checked ? 'true' : 'false' ); SetAttribute( e, 'play', GetE
('chkAutoPlay').checked ? 'true' : 'false' ) ; }