Posts Tagged ‘object vs embed’

silverstripe shadowbox combination fix for embedded vidoes not playing in firefox

Monday, August 25th, 2008

For several days i struggled to find a fix for my problem with embedding .flv’s in firefox in the silverstripe php framework.  I am using the js video lightbox ‘shadowbox,’ which i really like and can get working just fine when I use it in a typical html page.  But for some reason when I tried implementing this framework into my silverstripe application, the videos wouldn’t load in firefox, exclusively.  All other browsers worked fine, and after days of banging my head and searching for answers on google and irc I found this fix:

Shadowbox needs to load a .js file for each media type you wish to use.  I was using .flv so I loaded the ’shadowbox-flv.js.’  That file returns:

return {
tag:        'object',
id:         this.id,
name:       this.id,
type:       'application/x-shockwave-flash',
data:       options.flvPlayer,
children:   [
{ tag: 'param', name: 'movie', value: options.flvPlayer },
{ tag: 'param', name: 'flashvars', value: flashvars.join('&') },
{ tag: 'param', name: 'allowfullscreen', value: 'true' }
],
height:     h, // new height includes controller
width:      w
};

What i did was change it so that instead of using ‘object’ to embed the video, I used ‘embed,’ and now it worked!! Simple.

here is what i changed:

return {
tag: 'embed',
id: this.id,
src: 'flvplayer.swf',
allowscriptaccess: 'true',
allowfullscreen: 'true',
flashvars:  flashvars.join('&'),
height:     h, // new height includes controller
width:      w
};
},

see it working here

I’ve learned that firefox has a bug dealing with object vs embed which in certain cases doesn’t allow the swf loader to function properly.  Specifying ‘autoplay’ seems to have an effect on this as well.  The firefox bug for this issue is here.

hopefully this bug will be fixed soon :)