views:

26

answers:

1

Not entirely sure how to do this, but I noticed that Facebox works perfectly, but when I use it to load a movie, the FLV Player, JWplayer isn't fully loaded yet, and errors out. So I want to load JWplayer ( the FLV player ), before Facebox.

Facebox gives this as their embed code. And they explain that you can pass an argument in it as well.

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

My embed code for the FLV player is this :

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');

I tried just copying and pasting the embed code into Facebox's (). But I got a syntax error returned. Any ideas?

+1  A: 

I don't know how you have your links set up, but this is how I would do it:

HTML (video url in href and video image in rel)

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

Script (untested)

$(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;
 })
})
fudgey
Sweet. Totally is awesome and works. Except for the fact that IE doesn't display the video. But that's another issue all together it seems. The only rewrite I'd add to your code is so.write('fbvideo'). And it works.
Trip
Cool, I'm glad it worked for you :) I've updated my code above, and I don't know why it wouldn't work in IE... are you getting any errors?
fudgey
None, but sans facebox, it had the same problems where the video wouldn't display but the sound would. Sounds like a JWplayer error to me. I definately dig you so.addVariable (this), because that onLoads that content.
Trip