diff -r 27b248a13355 -r 8a6c9e3d0158 src/js/init.js --- a/src/js/init.js Thu May 24 15:05:47 2012 +0200 +++ b/src/js/init.js Thu Aug 30 13:16:33 2012 +0200 @@ -1,260 +1,382 @@ /* init.js - initialization and configuration of Popcorn and the widgets -exemple json configuration: - - */ +*/ -/** - set up the IriSP.__dataloader instance - - we need it because we have to get the metadata - about the video before that the widget have even - loaded. -*/ -IriSP.setupDataLoader = function() { - /* we set it up separately because we need to - get data at the very beginning, for instance when - setting up the video */ - IriSP.__dataloader = new IriSP.DataLoader(); -}; +if (typeof window.IriSP === "undefined") { + IriSP = {}; +} + +/* The Metadataplayer Object, single point of entry, replaces IriSP.init_player */ -/** do some magic to configure popcorn according to the options object passed. - Works for html5, jwplayer and youtube videos -*/ -IriSP.configurePopcorn = function (layoutManager, options) { - var pop; - var ret = layoutManager.createDiv(); - var containerDiv = ret[0]; - var spacerDiv = ret[1]; - - /* insert one pixel of margin between the video and the first widget, using the - spacer. - */ - IriSP.jQuery("#" + spacerDiv).css("height", "1px"); - - switch(options.type) { - /* - todo : dynamically create the div/video tag which - will contain the video. - */ - case "html5": - var tmpId = Popcorn.guid("video"); - IriSP.jQuery("#" + containerDiv).append(""); +IriSP.Metadataplayer = function(config) { + IriSP.log("IriSP.Metadataplayer constructor"); + for (var key in IriSP.guiDefaults) { + if (IriSP.guiDefaults.hasOwnProperty(key) && !config.gui.hasOwnProperty(key)) { + config.gui[key] = IriSP.guiDefaults[key] + } + } + var _container = document.getElementById(config.gui.container); + _container.innerHTML = '