其他 2007-05-18 ChenReal 906

让FCKeditor支持多媒体


又是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' ) ; }

评论 (7)

whipk

2007-08-14 15:56

谢谢,高手。希望可以与您多多交流。

chenreal

2007-08-17 04:32

不用客气,多多交流~~

fanngyuan

2007-10-14 16:45

我怎么实现不了啊\r 老是不能播放\r 用了媒体插件也是这样,mp3,flash能放了\r rmvb,mp4等都不行

fangyuan

2007-10-14 16:46

可以的话请联系我,期待您的赐教\r 179405470\r fangyuantdy@163.com(可以把成品发给我)\r 非常感谢

xudengliang

2009-03-14 02:11

是呀 我 修改了可是也没有用呀 那里有完整的列子呀!

xudengliang

2009-03-14 02:12

那里有列子呀 可以的话联系我QQ:664265542谢谢

ChenReal

2009-03-14 05:24

to xudengliang:例子发送到你的QQ邮箱了,一年半前的FCK版本,可能旧一点,新版的还没有试过,也许不一定兼容

发表评论

验证码
返回