0

I've run into a little snag and it's been driving me mad for the past 3 hours. I've tried everything I could think of...

I'm trying to embed mutiple JWplayers into a page using SWFObject. It's being constructed from a function within the SilverStripe framework. The embedding itself works just fine, but it just won't load the skin. The bastard.

The code that is returned for each instance is as follows:

<script type="text/javascript"> 
//<![CDATA[
swfobject.embedSWF(
'http://xxxxxxx.xxxxxxx.nl/dataobject_manager/code/flv/shadowbox/libraries/mediaplayer/player.swf',
'player-1',
'646',
'341',
'9.0.0',
'expressInstall.swf',
{
    file : 'http://xxxxxxx.xxxxxxx.nl/assets/Uploads/1.Introductie.flv',
    image : '/assets/video_thumbnails/_resampled/croppedimage646341-1.jpg',
    skin : 'http://xxxxxxx.xxxxxxx.nl/dataobject_manager/code/flv/jwplayer-skin/jw-skin_nedtrain.zip'
},
{
    allowscriptaccess : 'true', 
    wmode : 'opaque', 
    allowfullscreen : 'true'
}
)
//]]>
</script> 

Now, the URL that's being given for the skin IS correct. But when I run this page in Chrome, its console tells me the following:

Failed to load resource: the server responded with a status of 404 (Not Found) /dataobject_manager/code/flv/jwplayer-skin/jw-skin_nedtrain.zip.swf

Notice the ".swf" at the end? Where the HELL does it get that from?! Damn right that file doesn't exist. I'm guessing that SWFObject processes the URL and adds the .swf-part, so I've tried using jwplayer.js to embed it instead. Which caused the exact same error.

I'm stumped. Can anyone please help me out of my misery? Anyone??

Adrian van Vliet
  • 1,411
  • 1
  • 12
  • 17

1 Answers1

0
  1. You've added the player into the dataobject_manager folder? IMHO this should never be added there - keep any custom code/utility in mysite, your theme, or a dedicated module/widget folder.

  2. You are generating the above JS from a function? IMHO this should be done in a template. I'm doing pretty much the same with an include - using a different method of JS inclusion and other modules, but the principle should be the same:

    <div id="mediaspace">Please activate JS or install Flash.</div>
    <script type="text/javascript" src="/{$ThemeDir}/videoplayer/swfobject.js"></script>
    <script type="text/javascript">
        var so = new SWFObject('{$BaseHref}{$ThemeDir}/videoplayer/player-licensed.swf', 'mpl', '600', '320', '9');
        so.addParam('allowscriptaccess', 'always');
        so.addParam('allownetworking', 'all');
        so.addParam('allowfullscreen', 'true');
        so.addParam('wmode', 'opaque');
        so.addVariable('file', '$xmlfile');
        so.addVariable('plugins', '{$BaseHref}{$ThemeDir}/videoplayer/GridCommercial.swf');
        so.addVariable('dock', 'true');
        so.write('mediaspace'); 
    </script>
    
xeraa
  • 10,456
  • 3
  • 33
  • 66
  • xeraa, thanks so much for your feedback. However, JWPlayer is actually built into the dataobject_manager _by default_: https://github.com/unclecheese/DataObjectManager/tree/master/code/flv. I'll trust Uncle Cheese with my (SilverStripe-related) coding issues any day ;) The client needs to be able to upload multiple video's and shopw them on the page - dataobject_manager's media features were perfect for this. I eventually fixed this problem by simply saving a copy of the skin with the **.zip.swf**-extension. Sloppy fix, but I was quite amused to see that it actually worked :D – Adrian van Vliet Aug 15 '11 at 14:21
  • My bad - I assumed that you were using your own, licensed player like we do. – xeraa Aug 15 '11 at 16:26