17 var _container = document.getElementById(config.gui.container); |
17 var _container = document.getElementById(config.gui.container); |
18 _container.innerHTML = '<h3 class="Ldt-Loader">Loading... Chargement...</h3>'; |
18 _container.innerHTML = '<h3 class="Ldt-Loader">Loading... Chargement...</h3>'; |
19 this.video_metadata = video_metadata; |
19 this.video_metadata = video_metadata; |
20 this.sourceManager = new IriSP.Model.Directory(); |
20 this.sourceManager = new IriSP.Model.Directory(); |
21 this.config = config; |
21 this.config = config; |
|
22 this.callbackQueue = []; |
|
23 this.isLoaded = false; |
22 this.loadLibs(); |
24 this.loadLibs(); |
23 } |
25 } |
24 |
26 |
25 IriSP.Metadataplayer.prototype.toString = function() { |
27 IriSP.Metadataplayer.prototype.toString = function() { |
26 return 'A Metadataplayer in DIV #' + this.config.gui.container; |
28 return 'Metadataplayer in #' + this.config.gui.container; |
|
29 } |
|
30 |
|
31 IriSP.Metadataplayer.prototype.deferCallback = function(_callback) { |
|
32 var _this = this; |
|
33 IriSP._.defer(function() { |
|
34 _callback.call(_this); |
|
35 }); |
|
36 } |
|
37 |
|
38 IriSP.Metadataplayer.prototype.handleCallbacks = function() { |
|
39 this.isLoaded = true; |
|
40 while (this.callbackQueue.length) { |
|
41 this.deferCallback(this.callbackQueue.splice(0,1)[0]); |
|
42 } |
|
43 } |
|
44 |
|
45 IriSP.Metadataplayer.prototype.onLoad = function(_callback) { |
|
46 if (this.isLoaded) { |
|
47 this.deferCallback(_callback); |
|
48 } else { |
|
49 this.callbackQueue.push(_callback); |
|
50 } |
27 } |
51 } |
28 |
52 |
29 IriSP.Metadataplayer.prototype.loadLibs = function() { |
53 IriSP.Metadataplayer.prototype.loadLibs = function() { |
30 IriSP.log("IriSP.Metadataplayer.prototype.loadLibs"); |
54 IriSP.log("IriSP.Metadataplayer.prototype.loadLibs"); |
31 var $L = $LAB |
55 var $L = $LAB |
119 this.loadWidget(this.config.gui.widgets[i], function(_widget) { |
143 this.loadWidget(this.config.gui.widgets[i], function(_widget) { |
120 _this.widgets.push(_widget) |
144 _this.widgets.push(_widget) |
121 }); |
145 }); |
122 }; |
146 }; |
123 this.$.find('.Ldt-Loader').detach(); |
147 this.$.find('.Ldt-Loader').detach(); |
|
148 this.handleCallbacks(); |
124 } |
149 } |
125 |
150 |
126 IriSP.Metadataplayer.prototype.loadWidget = function(_widgetConfig, _callback) { |
151 IriSP.Metadataplayer.prototype.loadWidget = function(_widgetConfig, _callback) { |
127 /* Creating containers if needed */ |
152 /* Creating containers if needed */ |
128 if (typeof _widgetConfig.container === "undefined") { |
153 if (typeof _widgetConfig.container === "undefined") { |