Skip to content

Instantly share code, notes, and snippets.

@dmlap
Created June 19, 2014 14:57
Show Gist options
  • Save dmlap/c9d54758549d36620eef to your computer and use it in GitHub Desktop.
Save dmlap/c9d54758549d36620eef to your computer and use it in GitHub Desktop.
Psuedo-code for a SmartPlayer plugin that dynamically loads another script based on information supplied by the player at runtime.
(function(window) {
'use strict';
/* Collect the runtime parameters we need. In this case, we parse them out of the fragment identifier. */
var params = window.location.hash.substring(1); // drop the '#'
/* jQuery is available for Smart Player plugins so we can use it to load our primary plugin with the parameters we just gathered */
$.getScript('https://example.com/plugins/plugin.js?' + params, function() {
console.log('Finished loading the main plugin');
});
})(window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment