使Facebox等到FLV播放器加载完毕

时间:2010-06-21 16:26:14

标签: javascript jquery popup facebox jwplayer

不完全确定如何做到这一点,但我注意到Facebox工作得很好,但是当我用它来加载电影时,FLV播放器,JWplayer还没有完全加载,并且出错了。所以我想在Facebox之前加载JWplayer(FLV播放器)。

Facebox将此作为其嵌入代码。他们解释说你也可以在其中传递论据。

jQuery(document).ready(function($) {
  $('a[rel*=facebox]').facebox() 
})

我的FLV播放器嵌入代码如下:

var so = new SWFObject('/flash/playerTrans.swf','mpl','640px','360px','0');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addParam('wmode','transparent');
so.addVariable('file', 'http://hometownquarterlyvideos.s3.amazonaws.com/whatishqchannel.flv');
so.addVariable('autostart','true');
so.addVariable('controlbar','none');
so.addVariable('repeat','always');
so.addVariable('image','/flash/video_girl/whatishqchannel.jpg');
so.addVariable('icons','false')
so.addVariable('screencolor','none');
so.addVariable('backcolor','FFFFFF');
so.addVariable('screenalpha','0');
so.addVariable('overstretch', 'true');
so.write('player');

我尝试将嵌入代码复制并粘贴到Facebox()中。但是我收到了语法错误。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我不知道你是如何设置你的链接的,但我就是这样做的:

HTML(href中的视频网址和rel中的视频图像)

<a class="flash" href="http://hometownquarterlyvideos.s3.amazonaws.com/whatishqchannel.flv" rel="/flash/video_girl/whatishqchannel.jpg">Flash</a>

脚本(未经测试)

$(document).ready(function(){
 // click on flash video link
 $('.flash').click(function(){
  $.facebox('<div id="fbvideo"></div>');
  var so = new SWFObject('/flash/playerTrans.swf','fbvideo','640px','360px','0');
  so.addParam('allowscriptaccess','always');
  so.addParam('allowfullscreen','true');
  so.addParam('wmode','transparent');
  so.addVariable('file', $(this).attr('href'));
  so.addVariable('autostart','true');
  so.addVariable('controlbar','none');
  so.addVariable('repeat','always');
  so.addVariable('image',$(this).attr('rel'));
  so.addVariable('icons','false')
  so.addVariable('screencolor','none');
  so.addVariable('backcolor','FFFFFF');
  so.addVariable('screenalpha','0');
  so.addVariable('overstretch', 'true');
  so.write('fbvideo');
  return false;
 })
})