#439 ✓ staged
David Humphrey

Lazy load plugin dependencies

Reported by David Humphrey | March 20th, 2011 @ 07:34 PM | in 0.5

With popcorn-complete, we move from a world where users include only what they want, to world where all plugins come bundled for free. One of the downsides of this is that many (i.e., most) plugins load some kind of external script. In some cases we've bundled these statically (see the YouTube player). However, in most cases we load this unconditionally on parse. It would be better if we only loaded plugin dependencies when they are actually needed. This might mean triggering a static init() call or the like when the plugin is first used/invoked.

Comments and changes to this ticket

  • annasob

    annasob March 20th, 2011 @ 08:46 PM

    • Milestone changed from 0.5 to 0.4.1
    • Milestone order changed from “39” to “0”

    I wanted to clarify "However, in most cases we load this unconditionally on parse."
    I am assuming this means when this code is encountered(wiki example) :

    .wikipedia({
      start: 0, // seconds
      end: 10, // seconds
      src: 'http://en.wikipedia.org/wiki/Cape_Town',
      title: "this is an article",
      target: 'wikidiv'
    } )
    

    The getScript in this (most) plugin is in setup_. I am concerned about loading the script when it is needed but I do like the ides of doing a timeout and loading the script 5 sec before the first plugin starts. So if you have 3 wikipedia plugins starting at 3 different times the getSctipt would execute 5 sec before the first start time.

  • Rick

    Rick March 20th, 2011 @ 10:56 PM

    • Milestone order changed from “1” to “0”

    I'm strongly opposed to creating artificial race conditions - which will happen if we get into setting timeouts as a pseudo-buffer while we try to load remote resources.

    Humph, the whole point of "popcorn-complete.js" is that it's one call to load them all. Once we have the "build custom popcorn" feature set up - this ticket will be a non-issue.

  • Rick

    Rick March 21st, 2011 @ 09:30 AM

    The smartest solution, with no effect to core is to put remote resource loading into the _setup function, wrapped in some kind of conditional statement.

  • Scott Downe

    Scott Downe March 21st, 2011 @ 01:37 PM

    I think I agree with Rick on this. Putting it in _setup might be the best place to do the loading.

  • Scott Downe

    Scott Downe March 21st, 2011 @ 03:18 PM

    • Assigned user set to “Scott Downe”
  • David Humphrey

    David Humphrey March 21st, 2011 @ 03:27 PM

    • State changed from “bugs” to “assigned”
    • Milestone changed from 0.4.1 to 0.5
    • Milestone order changed from “3” to “0”

    Moving out of 0.4.1, this doesn't need to happen now.

  • Scott Downe

    Scott Downe April 11th, 2011 @ 01:37 PM

    • State changed from “assigned” to “peer-review-requested”
    • Milestone order changed from “32” to “0”

    https://github.com/ScottDowne/popcorn-js/commits/t439

    They all ended up being pretty straight forward.

  • Rick

    Rick April 11th, 2011 @ 04:36 PM

    • State changed from “peer-review-requested” to “super-review-requested”
    • Assigned user changed from “Scott Downe” to “annasob”

    Test Suite and all plugin test pages affected, tested and passing 100% in:

    Chrome 9, 10, 11

    Firefox 3.0.12, 3.6.16, 4.0

  • annasob

    annasob April 13th, 2011 @ 12:21 PM

    • State changed from “super-review-requested” to “review-looks-good”

    popcorn.mustache.js plugin now loads the script per track but this will be fixed in #469

    Code looks good!

    • all plugin unit tests pass on Chrome, Firefox 3.6 and 4
    • no lint errors
    • semantic_video demo works
  • annasob

    annasob April 13th, 2011 @ 12:22 PM

    • State changed from “review-looks-good” to “staged”

    Staged in annasob/popcorn-js commit

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Popcorn.js is an HTML5 video framework that lets you bring elements of the web into your videos.

Popcorn.js is a project of Web Made Movies, Mozilla's Open Video Lab.

Shared Ticket Bins

Referenced by

Pages