# HG changeset patch # User Raphael Velt # Date 1340210816 -7200 # Node ID e0d4e8431de382404dca0b292edfc4dae21dad0d # Parent c282fe964d1959dd5eba4e56611909828ce2d439 Updated Metadata Player diff -r c282fe964d19 -r e0d4e8431de3 web/enmi2012-seminaire-1/index.php --- a/web/enmi2012-seminaire-1/index.php Thu Jun 14 16:05:27 2012 +0200 +++ b/web/enmi2012-seminaire-1/index.php Wed Jun 20 18:46:56 2012 +0200 @@ -1,6 +1,6 @@ \ No newline at end of file diff -r c282fe964d19 -r e0d4e8431de3 web/fens2012/config.php --- a/web/fens2012/config.php Thu Jun 14 16:05:27 2012 +0200 +++ b/web/fens2012/config.php Wed Jun 20 18:46:56 2012 +0200 @@ -35,7 +35,7 @@ 'slide_background' => "images/slide-fens.jpg", // 606 × 282 pixels - 'archive_img' => ".images/achive_img.jpg", // 270 × 150 pixels + 'archive_img' => "images/achive_img.jpg", // 270 × 150 pixels 'archive_title' => "Futur en Seine - Page d'accueil", 'archive_description' => "par IRI et Cap Digital du 14 au 24 juin 2012", diff -r c282fe964d19 -r e0d4e8431de3 web/player_embed.php --- a/web/player_embed.php Thu Jun 14 16:05:27 2012 +0200 +++ b/web/player_embed.php Wed Jun 20 18:46:56 2012 +0200 @@ -35,7 +35,7 @@ @@ -115,7 +116,7 @@
diff -r c282fe964d19 -r e0d4e8431de3 web/polemicaltimeline.php --- a/web/polemicaltimeline.php Thu Jun 14 16:05:27 2012 +0200 +++ b/web/polemicaltimeline.php Wed Jun 20 18:46:56 2012 +0200 @@ -82,7 +82,7 @@ IriSP.libFiles.defaultDir = ""; IriSP.widgetsDir = ""; - IriSP.jwplayer_swf_path = "res/mediaplayer/player.swf"; + IriSP.libFiles.locations.jwPlayerSWF = "res/mediaplayer/player.swf"; IriSP.language = ""; var _metadata = { @@ -134,7 +134,8 @@ height: 360, width: 600, provider: "rtmp", - autostart: true + autostart: true, + metadata: _metadata } }; @@ -285,7 +286,7 @@
diff -r c282fe964d19 -r e0d4e8431de3 web/res/metadataplayer/Annotation.js --- a/web/res/metadataplayer/Annotation.js Thu Jun 14 16:05:27 2012 +0200 +++ b/web/res/metadataplayer/Annotation.js Wed Jun 20 18:46:56 2012 +0200 @@ -77,7 +77,7 @@ this.lastAnnotation = _annotation.id; var _url = (typeof _annotation.url !== "undefined" ? _annotation.url - : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.namespacedId.name)); + : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id)); var _text = this.l10n.watching + _annotation.title + (this.site_name ? this.l10n.on_site + this.site_name : ''); var _tags = _annotation.getTagTexts(); if (_tags.length) { diff -r c282fe964d19 -r e0d4e8431de3 web/res/metadataplayer/AnnotationsList.js --- a/web/res/metadataplayer/AnnotationsList.js Thu Jun 14 16:05:27 2012 +0200 +++ b/web/res/metadataplayer/AnnotationsList.js Wed Jun 20 18:46:56 2012 +0200 @@ -16,7 +16,7 @@ * e.g. http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=? */ ajax_url : false, - /* how much ms should we look before and after the current timecode in the segment API + /* number of milliseconds before/after the current timecode when calling the segment API */ ajax_granularity : 300000, default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png", @@ -84,7 +84,7 @@ this.lastAjaxQuery = _currentTime; _currentTime = Math.floor(1000 * _currentTime); var _url = Mustache.to_html(this.ajax_url, { - media : this.source.currentMedia.namespacedId.name, + media : this.source.currentMedia.id, begin : Math.max(0, _currentTime - this.ajax_granularity), end : Math.min(_duration.milliseconds, _currentTime + this.ajax_granularity) }); @@ -99,11 +99,11 @@ _currentTime = 0; } var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime * 1000); - if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.namespacedId.name !== this.lastMashupAnnotation) { - this.lastMashupAnnotation = _currentAnnotation.namespacedId.name; + if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.id !== this.lastMashupAnnotation) { + this.lastMashupAnnotation = _currentAnnotation.id; var _currentMedia = _currentAnnotation.getMedia(), _url = Mustache.to_html(this.ajax_url, { - media : _currentMedia.namespacedId.name, + media : _currentMedia.id, begin : Math.max(0, _currentAnnotation.annotation.begin.milliseconds - this.ajax_granularity), end : Math.min(_currentMedia.duration.milliseconds, _currentAnnotation.annotation.end.milliseconds + this.ajax_granularity) }); @@ -129,9 +129,9 @@ var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime * 1000); if (typeof _currentAnnotation !== "undefined") { _currentTime = _currentTime - _currentAnnotation.begin.getSeconds() + _currentAnnotation.annotation.begin.getSeconds(); - var _mediaId = _currentAnnotation.getMedia().namespacedId.name; + var _mediaId = _currentAnnotation.getMedia().id; _list = _list.filter(function(_annotation) { - return _annotation.getMedia().namespacedId.name === _mediaId; + return _annotation.getMedia().id === _mediaId; }); } } @@ -169,15 +169,15 @@ { project : _annotation.project, media : _annotation.media.id.replace(/^.*:/,''), - annotation : _annotation.namespacedId.name, + annotation : _annotation.id, annotationType : _annotation.annotationType.id.replace(/^.*:/,'') } ) - : '#id=' + _annotation.namespacedId.name + : '#id=' + _annotation.id ) ); var _res = { - id : _annotation.namespacedId.name, + id : _annotation.id, title : _annotation.title.replace(_annotation.description,''), description : _annotation.description, begin : _annotation.begin.toString(), @@ -234,6 +234,7 @@ this.bindPopcorn("IriSP.search", "onSearch"); this.bindPopcorn("IriSP.search.closed", "onSearch"); this.bindPopcorn("IriSP.search.cleared", "onSearch"); + this.bindPopcorn("IriSP.AnnotationsList.refresh","refresh"); var _this = this; diff -r c282fe964d19 -r e0d4e8431de3 web/res/metadataplayer/Controller.js --- a/web/res/metadataplayer/Controller.js Thu Jun 14 16:05:27 2012 +0200 +++ b/web/res/metadataplayer/Controller.js Wed Jun 20 18:46:56 2012 +0200 @@ -196,7 +196,7 @@ }; IriSP.Widgets.Controller.prototype.muteHandler = function() { - this.player.popcorn.mute(!this.player.popcorn.muted()); + this.player.popcorn.muted(!this.player.popcorn.muted()); }; IriSP.Widgets.Controller.prototype.volumeUpdater = function() { 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('