Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

How to dynamically load a plugin.

7 replies [Last post]
Reply

Hello,

i'm trying to dynamically load a plugin. Is this possible? I'm trying to add the syntax for loading the plugin in a javascript variable but the quotes always break it. Even when trying to escape them or mixing double quotes and single quotes.

What i'm trying:

- On page load do a check for a value
- If value is set variable add plugin syntax otherwise keep variable empty
- on document ready load jwplayer (with jw embedder) with the variable under plugin call.

Hope this is clear. It is difficult to show a working page because the development environment is IP-restricted and not to be posted on non-restricted webpages. If more info is needed please tell.

Kind regards,

Son

Reply

Can you show me where you tried this and it broke?

Reply
var duration = 3100;
var commercial = "";

function star(){
  if (duration > 3000){
    commercial  = ","
    commercial  += "http://lp.longtailvideo.com/5/googima/googima.js/': {";
    commercial  += "'ad': {";
    commercial  += "'first_ad': {";
    commercial  += "'tag': 'http://ad.doubleclick.net/darttag;sz=320x240;tile=1',";
    commercial  += "'type': 'video',";
    commercial  += "'position': 'pre'";
    commercial  += "},";
    commercial  += "},";
    commercial  += "'admessagedynamic': 'This ad will close in _countdown_ seconds',";
    commercial  += "'admessagedynamickey': '_countdown_'";                    
    commercial  += "}";
  }
}

And then trying to implement player like this:

$(document).ready( function() {
        jwplayer('videoplayer').setup({
            'id': 'player',
            'width': '480',
            'height': '270',       
            'skin': 'skins/son2/son2.zip',
            'repeat': 'none',
            'debug': 'console',
            'playlistfile': onDemandFile,
            // 'image': 'http://example.com/thumbs/sintel.jpg',
            'plugins': {
              /* 'qualitymonitor-2':{}, */
              'related-1': {
                'file': 'xml/related.xml',
                'onclick': 'play',
                'heading': "Related videos",
                'usedock': "true"
              },
              './plugins/sonstats.swf': { }
              commercial
            },
            'modes': [
                {type: 'flash', src: 'swf/player.swf', wmode: 'opaque', allowfullscreen: 'true', allowscriptaccess: 'always', autostart: 'true', controlbar: 'over', bufferlength: '5',/* 'playlistfile': onDemandFile */},
                {
                  type: 'html5',
                  config: {
                   'file': onDemandMP4,    
                   'provider': 'video'
                  }
                },                               
                {
                  type: 'download',
                  config: {
                    'file': onDemandMP4
                  }
                }
            ]          
          });
      });
Reply

I mean a link, can you provide that?

Reply

It is difficult to show a working page because the development environment is IP-restricted and not to be posted on non-restricted webpages. If more info is needed please tell.

Reply

I will need to see something. Please contact us and we can give you our IP for access.

http://www.longtailvideo.com/support/contact-us

Reply

Hi Ethan,

thanks for your helped but I solved it already. For me the solution was to do a check for the duration of te clip and if that was longer than value x, I load a different jwplayer setup config with the googima plugin.

Reply

Cool, glad you got it.

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • You may post code using <code>...</code> .
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options