diff -r c282fe964d19 -r e0d4e8431de3 web/res/metadataplayer/LdtPlayer-core.js
--- a/web/res/metadataplayer/LdtPlayer-core.js Thu Jun 14 16:05:27 2012 +0200
+++ b/web/res/metadataplayer/LdtPlayer-core.js Wed Jun 20 18:46:56 2012 +0200
@@ -29,7 +29,7 @@
/* The Metadataplayer Object, single point of entry, replaces IriSP.init_player */
-IriSP.Metadataplayer = function(config, video_metadata) {
+IriSP.Metadataplayer = function(config) {
IriSP.log("IriSP.Metadataplayer constructor");
for (var key in IriSP.guiDefaults) {
if (IriSP.guiDefaults.hasOwnProperty(key) && !config.gui.hasOwnProperty(key)) {
@@ -38,14 +38,37 @@
}
var _container = document.getElementById(config.gui.container);
_container.innerHTML = '
Loading... Chargement...
';
- this.video_metadata = video_metadata;
this.sourceManager = new IriSP.Model.Directory();
this.config = config;
+ this.callbackQueue = [];
+ this.isLoaded = false;
this.loadLibs();
}
IriSP.Metadataplayer.prototype.toString = function() {
- return 'A Metadataplayer in DIV #' + this.config.gui.container;
+ return 'Metadataplayer in #' + this.config.gui.container;
+}
+
+IriSP.Metadataplayer.prototype.deferCallback = function(_callback) {
+ var _this = this;
+ IriSP._.defer(function() {
+ _callback.call(_this);
+ });
+}
+
+IriSP.Metadataplayer.prototype.handleCallbacks = function() {
+ this.isLoaded = true;
+ while (this.callbackQueue.length) {
+ this.deferCallback(this.callbackQueue.splice(0,1)[0]);
+ }
+}
+
+IriSP.Metadataplayer.prototype.onLoad = function(_callback) {
+ if (this.isLoaded) {
+ this.deferCallback(_callback);
+ } else {
+ this.callbackQueue.push(_callback);
+ }
}
IriSP.Metadataplayer.prototype.loadLibs = function() {
@@ -54,8 +77,13 @@
.script(IriSP.getLib("underscore"))
.script(IriSP.getLib("Mustache"))
.script(IriSP.getLib("jQuery"))
- .script(IriSP.getLib("swfObject"))
- .wait()
+ .script(IriSP.getLib("swfObject"));
+
+ if (typeof JSON == "undefined") {
+ $L.script(IriSP.getLib("json"));
+ }
+
+ $L.wait()
.script(IriSP.getLib("jQueryUI"));
if (this.config.player.type === "jwplayer" || this.config.player.type === "auto") {
@@ -92,7 +120,7 @@
IriSP.loadCss(IriSP.getLib("cssjQueryUI"));
IriSP.loadCss(this.config.gui.css);
- this.videoData = this.loadMetadata(this.video_metadata);
+ this.videoData = this.loadMetadata(this.config.player.metadata);
this.$ = IriSP.jQuery('#' + this.config.gui.container);
this.$.css({
"width": this.config.gui.width,
@@ -143,6 +171,7 @@
});
};
this.$.find('.Ldt-Loader').detach();
+ this.handleCallbacks();
}
IriSP.Metadataplayer.prototype.loadWidget = function(_widgetConfig, _callback) {
@@ -173,7 +202,7 @@
IriSP.Metadataplayer.prototype.configurePopcorn = function() {
IriSP.log("IriSP.Metadataplayer.prototype.configurePopcorn");
var pop,
- ret = this.layoutDivs("video"),
+ ret = this.layoutDivs("video",this.config.player.height || undefined),
containerDiv = ret[0],
spacerDiv = ret[1],
_this = this,
@@ -216,6 +245,25 @@
pop = Popcorn("#" + _tmpId);
break;
+ case "html5-audio":
+ var _tmpId = Popcorn.guid("audio"),
+ _videoEl = IriSP.jQuery('