--- 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 @@
<?php
// Permanent redirection
header("HTTP/1.1 301 Moved Permanently");
-header("Location: client.php");
+header("Location: polemicaltimeline.php");
exit();
?>
\ No newline at end of file
--- 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 <a href=\"http://www.iri.centrepompidou.fr/\" target=\"_blank\">IRI</a> et <a href=\"http://www.capdigital.com/\" target=\"_blank\">Cap Digital</a> du 14 au 24 juin 2012",
--- 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 @@
<script type="text/javascript">
IriSP.libFiles.defaultDir = "<?php echo(registry_url('libdir','js'));?>";
IriSP.widgetsDir = "<?php echo(registry_url('ldtwidgets','js'));?>";
- IriSP.jwplayer_swf_path = "<?php echo(URL_ROOT); ?>res/mediaplayer/player.swf";
+ IriSP.libFiles.locations.jwPlayerSWF = "<?php echo(URL_ROOT); ?>res/mediaplayer/player.swf";
IriSP.language = "<?php echo($actual) ?>";
var _metadata = {
@@ -74,7 +74,8 @@
height: 300,
width: 630,
provider: "rtmp",
- autostart: true
+ autostart: true,
+ metadata: _metadata
}
};
</script>
@@ -115,7 +116,7 @@
<div id="LdtPlayer"></div>
<script type="text/javascript">
- var _myPlayer = new IriSP.Metadataplayer(_config, _metadata);
+ var _myPlayer = new IriSP.Metadataplayer(_config);
</script>
</body>
</html>
--- 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 = "<?php echo(registry_url('libdir','js'));?>";
IriSP.widgetsDir = "<?php echo(registry_url('ldtwidgets','js'));?>";
- IriSP.jwplayer_swf_path = "<?php echo(URL_ROOT); ?>res/mediaplayer/player.swf";
+ IriSP.libFiles.locations.jwPlayerSWF = "<?php echo(URL_ROOT); ?>res/mediaplayer/player.swf";
IriSP.language = "<?php echo($actual) ?>";
var _metadata = {
@@ -134,7 +134,8 @@
height: 360,
width: 600,
provider: "rtmp",
- autostart: true
+ autostart: true,
+ metadata: _metadata
}
};
@@ -285,7 +286,7 @@
<div id="LdtPlayer"></div>
</div>
<script type="text/javascript">
- var _myPlayer = new IriSP.Metadataplayer(_config, _metadata);
+ var _myPlayer = new IriSP.Metadataplayer(_config);
</script>
</div>
--- 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) {
--- 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;
--- 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() {
--- 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 = '<h3 class="Ldt-Loader">Loading... Chargement...</h3>';
- 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('<audio>');
+
+ _videoEl.attr({
+ "src" : this.config.player.video,
+ "id" : _tmpId
+ })
+
+ if(this.config.player.hasOwnProperty("width")) {
+ _videoEl.attr("width", this.config.player.width);
+ }
+ if(this.config.player.hasOwnProperty("height")) {
+ _videoEl.attr("height", this.config.player.height);
+ }
+ IriSP.jQuery("#" + containerDiv).append(_videoEl);
+ pop = Popcorn("#" + _tmpId);
+ break;
+
case "jwplayer":
var opts = IriSP.jQuery.extend({}, this.config.player);
delete opts.container;
@@ -224,7 +272,7 @@
delete opts.video;
if(!opts.hasOwnProperty("flashplayer")) {
- opts.flashplayer = IriSP.jwplayer_swf_path;
+ opts.flashplayer = IriSP.getLib("jwPlayerSWF");
}
if(!opts.hasOwnProperty("controlbar.position")) {
@@ -264,6 +312,10 @@
pop = new IriSP.PopcornReplacement.allocine("#" + containerDiv, this.config.player);
break;
+ case "mashup-html":
+ pop = new IriSP.PopcornReplacement.htmlMashup("#" + containerDiv, this.config.player, this.videoData);
+ break;
+
default:
pop = undefined;
};
@@ -275,7 +327,7 @@
@param widgetName the name of the widget.
@return an array of the form [createdivId, spacerdivId].
*/
-IriSP.Metadataplayer.prototype.layoutDivs = function(_name) {
+IriSP.Metadataplayer.prototype.layoutDivs = function(_name, _height) {
if (typeof(_name) === "undefined") {
_name = "";
}
@@ -296,6 +348,9 @@
position: "relative",
clear: "both"
});
+ if (typeof _height !== "undefined") {
+ divHtml.css("height", _height);
+ }
this.$.append(divHtml);
this.$.append(spacerHtml);
@@ -373,7 +428,7 @@
a segment (similar to the popcorn.code plugin). */
this._options = options;
-
+
};
IriSP.PopcornReplacement.player.prototype.listen = function(msg, callback) {
@@ -383,6 +438,8 @@
this.msgPump[msg].push(callback);
};
+IriSP.PopcornReplacement.player.prototype.on = IriSP.PopcornReplacement.player.prototype.listen;
+
IriSP.PopcornReplacement.player.prototype.trigger = function(msg, params) {
if (!this.msgPump.hasOwnProperty(msg))
return;
@@ -395,6 +452,8 @@
};
+IriSP.PopcornReplacement.player.prototype.emit = IriSP.PopcornReplacement.player.prototype.trigger;
+
IriSP.PopcornReplacement.player.prototype.guid = function(prefix) {
var str = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
@@ -438,16 +497,13 @@
IriSP.PopcornReplacement.player.prototype.play = function() {
this.media.paused = false;
this.trigger("play");
- //IriSP.PopcornReplacement.trigger("playing");
this.playerFns.play();
};
IriSP.PopcornReplacement.player.prototype.pause = function() {
-// if ( !this.media.paused ) {
this.media.paused = true;
this.trigger( "pause" );
this.playerFns.pause();
-// }
};
IriSP.PopcornReplacement.player.prototype.muted = function(val) {
@@ -487,7 +543,13 @@
return _vol;
};
-IriSP.PopcornReplacement.player.prototype.mute = IriSP.PopcornReplacement.player.prototype.muted;
+IriSP.PopcornReplacement.player.prototype.mute = function() {
+ this.muted(true);
+}
+
+IriSP.PopcornReplacement.player.prototype.unmute = function() {
+ this.muted(false);
+}
IriSP.PopcornReplacement.player.prototype.code = function(options) {
this.__codes.push(options);
@@ -561,15 +623,35 @@
IriSP.PopcornReplacement.player.prototype.roundTime = function() {
var currentTime = this.currentTime();
return Math.round(currentTime);
-};/* model.js is where data is stored in a standard form, whatever the serializer */
+};/* TODO: Separate Project-specific data from Source */
+
+/* model.js is where data is stored in a standard form, whatever the serializer */
IriSP.Model = {
_SOURCE_STATUS_EMPTY : 0,
_SOURCE_STATUS_WAITING : 1,
_SOURCE_STATUS_READY : 2,
_ID_AUTO_INCREMENT : 0,
+ _ID_BASE : (function(_d) {
+ function pad(n){return n<10 ? '0'+n : n}
+ function fillrand(n) {
+ var _res = ''
+ for (var i=0; i<n; i++) {
+ _res += Math.floor(16*Math.random()).toString(16);
+ }
+ return _res;
+ }
+ return _d.getUTCFullYear() + '-'
+ + pad(_d.getUTCMonth()+1) + '-'
+ + pad(_d.getUTCDate()) + '-'
+ + fillrand(16);
+ })(new Date()),
getUID : function() {
- return "autoid-" + (++this._ID_AUTO_INCREMENT);
+ var _n = (++this._ID_AUTO_INCREMENT).toString();
+ while (_n.length < 4) {
+ _n = '0' + _n
+ }
+ return "autoid-" + this._ID_BASE + '-' + _n;
},
regexpFromTextOrArray : function(_textOrArray) {
function escapeText(_text) {
@@ -610,7 +692,7 @@
_res.setTime(Number(time));
return _res;
},
- dateToIso : function(d) {
+ dateToIso : function(d) {
function pad(n){return n<10 ? '0'+n : n}
return d.getUTCFullYear()+'-'
+ pad(d.getUTCMonth()+1)+'-'
@@ -773,26 +855,33 @@
});
}
-IriSP.Model.List.prototype.removeId = function(_id) {
- var _index = (IriSP._(this.idIndex).indexOf(_id));
+IriSP.Model.List.prototype.removeId = function(_id, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false,
+ _index = (IriSP._(this.idIndex).indexOf(_id));
if (_index !== -1) {
this.splice(_index,1);
}
+ if (_deleteFromDirectory) {
+ delete this.directory.elements[_id];
+ }
}
-IriSP.Model.List.prototype.removeElement = function(_el) {
+IriSP.Model.List.prototype.removeElement = function(_el, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false;
this.removeId(_el.id);
}
-IriSP.Model.List.prototype.removeIds = function(_list) {
- var _this = this;
+IriSP.Model.List.prototype.removeIds = function(_list, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false,
+ _this = this;
IriSP._(_list).forEach(function(_id) {
_this.removeId(_id);
});
}
-IriSP.Model.List.prototype.removeElements = function(_list) {
- var _this = this;
+IriSP.Model.List.prototype.removeElements = function(_list, _deleteFromDirectory) {
+ var _deleteFromDirectory = _deleteFromDirectory || false,
+ _this = this;
IriSP._(_list).forEach(function(_el) {
_this.removeElement(_el);
});
@@ -832,11 +921,11 @@
}
IriSP.Model.Time.prototype.getSeconds = function() {
- return Math.floor(this.milliseconds / 1000);
+ return this.milliseconds / 1000;
}
IriSP.Model.Time.prototype.getHMS = function() {
- var _totalSeconds = Math.abs(this.getSeconds());
+ var _totalSeconds = Math.abs(Math.floor(this.getSeconds()));
return {
hours : Math.floor(_totalSeconds / 3600),
minutes : (Math.floor(_totalSeconds / 60) % 60),
@@ -874,14 +963,11 @@
IriSP.Model.Reference = function(_source, _idRef) {
this.source = _source;
+ this.id = _idRef;
if (typeof _idRef === "object") {
this.isList = true;
- this.id = IriSP._(_idRef).map(function(_id) {
- return _source.getNamespaced(_id).fullname;
- });
} else {
this.isList = false;
- this.id = _source.getNamespaced(_idRef).fullname;
}
this.refresh();
}
@@ -922,8 +1008,7 @@
_id = IriSP.Model.getUID();
}
this.source = _source;
- this.namespacedId = _source.getNamespaced(_id)
- this.id = this.namespacedId.fullname;
+ this.id = _id;
this.title = "";
this.description = "";
this.source.directory.addElement(this);
@@ -1063,7 +1148,7 @@
/* */
IriSP.Model.MashedAnnotation = function(_mashup, _annotation) {
- IriSP.Model.Element.call(this, _mashup.namespacedId.name + "_" + _annotation.namespacedId.name, _annotation.source);
+ IriSP.Model.Element.call(this, _mashup.id + "_" + _annotation.id, _annotation.source);
this.elementType = 'mashedAnnotation';
this.annotation = _annotation;
this.begin = new IriSP.Model.Time(_mashup.duration);
@@ -1167,54 +1252,10 @@
})
this.callbackQueue = [];
this.contents = {};
- if (typeof this.namespace === "undefined") {
- this.namespace = "metadataplayer";
- } else {
- if (typeof this.namespaceUrl === "undefined" && typeof this.url !== "undefined") {
- var _matches = this.url.match(/(^[^?&]+|[^?&][a-zA-Z0-9_%=?]+)/g),
- _url = _matches[0];
- if (_matches.length > 1) {
- _matches = IriSP._(_matches.slice(1)).reject(function(_txt) {
- return /\?$/.test(_txt);
- });
- }
- if (_matches.length > 0) {
- _url += '?' + _matches.join('&');
- }
- this.namespaceUrl = _url;
- }
- }
- if (typeof this.namespaceUrl === "undefined") {
- this.namespaceUrl = "http://ldt.iri.centrepompidou.fr/";
- }
- this.directory.addNamespace(this.namespace, this.namespaceUrl);
this.get();
}
}
-IriSP.Model.Source.prototype.getNamespaced = function(_id) {
- var _tab = _id.split(':');
- if (_tab.length > 1) {
- return {
- namespace : _tab[0],
- name : _tab[1],
- fullname : _id
- }
- } else {
- return {
- namespace : this.namespace,
- name : _id,
- fullname : this.namespace + ':' + _id
- }
- }
-}
-
-IriSP.Model.Source.prototype.unNamespace = function(_id) {
- if (typeof _id !== "undefined") {
- return _id.replace(this.namespace + ':', '');
- }
-}
-
IriSP.Model.Source.prototype.addList = function(_listId, _contents) {
if (typeof this.contents[_listId] === "undefined") {
this.contents[_listId] = new IriSP.Model.List(this.directory);
@@ -1241,7 +1282,7 @@
}
IriSP.Model.Source.prototype.getElement = function(_elId) {
- return this.directory.getElement(this.getNamespaced(_elId).fullname);
+ return this.directory.getElement(_elId);
}
IriSP.Model.Source.prototype.setCurrentMediaId = function(_idRef) {
@@ -1256,21 +1297,6 @@
}
}
-IriSP.Model.Source.prototype.listNamespaces = function(_excludeSelf) {
- var _this = this,
- _nsls = [],
- _excludeSelf = (typeof _excludeSelf !== "undefined" && _excludeSelf);
- this.forEach(function(_list) {
- IriSP._(_list).forEach(function(_el) {
- var _ns = _el.id.replace(/:.*$/,'');
- if (IriSP._(_nsls).indexOf(_ns) === -1 && (!_excludeSelf || _ns !== _this.namespace)) {
- _nsls.push(_ns);
- }
- })
- });
- return _nsls;
-}
-
IriSP.Model.Source.prototype.get = function() {
this.status = IriSP.Model._SOURCE_STATUS_WAITING;
this.handleCallbacks();
@@ -1348,6 +1374,13 @@
}
}
+IriSP.Model.Source.prototype.merge = function(_source) {
+ var _this = this;
+ _source.forEach(function(_value, _key) {
+ _this.getList(_key).addElements(_value);
+ });
+}
+
/* */
IriSP.Model.RemoteSource = function(_config) {
@@ -1370,14 +1403,12 @@
IriSP.Model.Directory = function() {
this.remoteSources = {};
this.elements = {};
- this.namespaces = {};
-}
-
-IriSP.Model.Directory.prototype.addNamespace = function(_namespace, _url) {
- this.namespaces[_namespace] = _url;
}
IriSP.Model.Directory.prototype.remoteSource = function(_properties) {
+ if (typeof _properties !== "object" || typeof _properties.url === "undefined") {
+ throw "Error : IriSP.Model.Directory.remoteSource(configuration): configuration.url is undefined";
+ }
var _config = IriSP._({ directory: this }).extend(_properties);
if (typeof this.remoteSources[_properties.url] === "undefined") {
this.remoteSources[_properties.url] = new IriSP.Model.RemoteSource(_config);
@@ -1420,7 +1451,9 @@
popcorn : "popcorn-complete.min.js",
jwplayer : "jwplayer.js",
raphael : "raphael-min.js",
- tracemanager : "tracemanager.js"
+ tracemanager : "tracemanager.js",
+ jwPlayerSWF : "player.swf",
+ json : "json2.js"
},
locations : {
// use to define locations outside defautl_dir
@@ -1526,7 +1559,15 @@
}
}
- this.l10n = (typeof this.messages[IriSP.language] !== "undefined" ? this.messages[IriSP.language] : this.messages["en"]);
+ this.l10n = (
+ typeof this.messages[IriSP.language] !== "undefined"
+ ? this.messages[IriSP.language]
+ : (
+ IriSP.language.length > 2 && typeof this.messages[IriSP.language.substr(0,2)] !== "undefined"
+ ? this.messages[IriSP.language.substr(0,2)]
+ : this.messages["en"]
+ )
+ );
};
@@ -1570,14 +1611,7 @@
*/
IriSP.Widgets.Widget.prototype.draw = function() {
/* implemented by "sub-classes" */
-};
-/**
- * Optional method if you want your widget to support redraws.
- */
-IriSP.Widgets.Widget.prototype.redraw = function() {
- /* implemented by "sub-classes" */
-};
-/* To wrap a player the develop should create a new class derived from
+};/* To wrap a player the develop should create a new class derived from
the IriSP.PopcornReplacement.player and defining the correct functions */
/** allocine player wrapper */
@@ -1851,29 +1885,174 @@
/** jwplayer player wrapper */
IriSP.PopcornReplacement.jwplayer = function(container, options) {
- /* appel du parent pour initialiser les structures communes à tous les players */
- IriSP.PopcornReplacement.player.call(this, container, options);
+ /* appel du parent pour initialiser les structures communes à tous les players */
+ IriSP.PopcornReplacement.player.call(this, container, options);
- this.media.duration = options.duration; /* optional */
+ this.media.duration = options.duration; /* optional */
+
+ var _player = jwplayer(this.container);
/* Définition des fonctions de l'API - */
- this.playerFns = {
- play: function() { return jwplayer(this.container).play(); },
- pause: function() { return jwplayer(this.container).pause(); },
- getPosition: function() { return jwplayer(this.container).getPosition(); },
- seek: function(pos) { return jwplayer(this.container).seek(pos); },
- getMute: function() { return jwplayer(this.container).getMute() },
- setMute: function(p) { return jwplayer(this.container).setMute(p); },
- getVolume: function() { return jwplayer(this.container).getVolume() / 100; },
- setVolume: function(p) { return jwplayer(this.container).setVolume(Math.floor(100*p)); }
- }
+ this.playerFns = {
+ play: function() { return _player.play(); },
+ pause: function() { return _player.pause(); },
+ getPosition: function() { return _player.getPosition(); },
+ seek: function(pos) { return _player.seek(pos); },
+ getMute: function() { return _player.getMute() },
+ setMute: function(p) { return _player.setMute(p); },
+ getVolume: function() { return _player.getVolume() / 100; },
+ setVolume: function(p) { return _player.setVolume(Math.floor(100*p)); }
+ }
- options.events = this.callbacks;
+ options.events = this.callbacks;
- jwplayer(this.container).setup(options);
+ _player.setup(options);
};
IriSP.PopcornReplacement.jwplayer.prototype = new IriSP.PopcornReplacement.player("", {});
+/* To wrap a player the develop should create a new class derived from
+ the IriSP.PopcornReplacement.player and defining the correct functions */
+
+/** jwplayer player wrapper */
+IriSP.PopcornReplacement.htmlMashup = function(container, options, metadata) {
+ /* appel du parent pour initialiser les structures communes à tous les players */
+ IriSP.PopcornReplacement.player.call(this, container, options);
+
+ this.mashup = metadata.currentMedia;
+ this.$ = IriSP.jQuery(container);
+
+ var _w = this.$.width(),
+ _h = this.$.height(),
+ _this = this;
+
+ IriSP._(metadata.currentMedia.medias).each(function(_media) {
+ var _tmpId = Popcorn.guid("video"),
+ _videoEl = IriSP.jQuery('<video>');
+
+ _videoEl
+ .attr({
+ src : _media.video,
+ id : _tmpId,
+ width : _w,
+ height : _h
+ })
+ .css({
+ position: "absolute",
+ top: 0,
+ left: 0
+ });
+
+ _this.$.append(_videoEl);
+ _media.videoEl = _videoEl;
+ _media.popcorn = Popcorn("#" + _tmpId);
+ _media.popcorn.on("timeupdate", function() {
+ if (!_this.media.paused && _media === _this.currentMedia) {
+ var _time = _media.popcorn.currentTime();
+ // var _status = "Timeupdate from " + _media.id + " at time " + _time;
+ if ( _time < _this.segmentEnd ) {
+ if ( _time >= _this.segmentBegin ) {
+ _this.timecode = _time - _this.timedelta;
+ // _status += " within segment";
+ } else {
+ _this.timecode = _this.segmentBegin - _this.timedelta;
+ _media.popcorn.currentTime(_this.segmentBegin);
+ // _status += " before segment begin";
+ }
+ } else {
+ _this.timecode = _this.segmentEnd - _this.timedelta;
+ _media.popcorn.pause();
+ _this.changeCurrentAnnotation();
+ // _status += " after segment end";
+ }
+ /* _status += ", translated to " + _this.timecode;
+ console.log(_status); */
+ _this.trigger("timeupdate");
+ }
+ });
+ });
+
+ this.timecode = 0;
+
+ /* Définition des fonctions de l'API */
+ this.playerFns = {
+ play: function() {
+ _this.changeCurrentAnnotation();
+ },
+ pause: function() {
+ _this.currentMedia.popcorn.pause();
+ },
+ getPosition: function() {
+ return _this.timecode;
+ },
+ seek: function(pos) {
+ _this.timecode = pos;
+ _this.changeCurrentAnnotation();
+ },
+ getMute: function() {
+ return
+ typeof _this.currentMedia !== "undefined"
+ ? _this.currentMedia.popcorn.muted()
+ : false;
+ },
+ setMute: function(p) {
+ var _mute = !!p;
+ for (var _i = 0; _i < _this.mashup.medias.length; _i++) {
+ _this.mashup.medias[_i].popcorn.muted(_mute);
+ }
+ },
+ getVolume: function() {
+ return
+ typeof _this.currentMedia !== "undefined"
+ ? _this.currentMedia.popcorn.volume()
+ : .5;
+ },
+ setVolume: function(_vol) {
+ for (var _i = 0; _i < _this.mashup.medias.length; _i++) {
+ _this.mashup.medias[_i].popcorn.volume(_vol);
+ }
+ }
+ }
+/*
+ options.events = this.callbacks;
+
+ _player.setup(options);
+ */
+};
+
+IriSP.PopcornReplacement.htmlMashup.prototype = new IriSP.PopcornReplacement.player("", {});
+
+IriSP.PopcornReplacement.htmlMashup.prototype.changeCurrentAnnotation = function() {
+ var _annotation = this.mashup.getAnnotationAtTime( 1000 * this.timecode );
+ if (typeof _annotation == "undefined") {
+ if (typeof this.currentMedia !== "undefined") {
+ this.currentMedia.popcorn.pause();
+ this.media.paused = true;
+ }
+ return;
+ }
+ if (_annotation !== this.currentAnnotation) {
+ this.currentAnnotation = _annotation;
+ this.segmentBegin = this.currentAnnotation.annotation.begin.getSeconds();
+ this.segmentEnd = this.currentAnnotation.annotation.end.getSeconds();
+ this.timedelta = this.segmentBegin - this.currentAnnotation.begin.getSeconds();
+ this.currentMedia = this.currentAnnotation.getMedia();
+
+ for (var _i = 0; _i < this.mashup.medias.length; _i++) {
+ if (this.mashup.medias[_i].id !== this.currentMedia.id) {
+ this.mashup.medias[_i].videoEl.hide();
+ this.mashup.medias[_i].popcorn.pause();
+ } else {
+ this.mashup.medias[_i].videoEl.show();
+ }
+ }
+ }
+ if (this.currentMedia.popcorn.readyState()) {
+ this.currentMedia.popcorn.currentTime(this.timecode + this.timedelta);
+ }
+ if (!this.media.paused) {
+ this.currentMedia.popcorn.play();
+ }
+}
/* To wrap a player the develop should create a new class derived from
the IriSP.PopcornReplacement.player and defining the correct functions */
@@ -2015,49 +2194,7 @@
break;
}
-};/* Used when Putting annotations on the platform */
-
-if (typeof IriSP.serializers === "undefined") {
- IriSP.serializers = {}
-}
-
-IriSP.serializers.ldt_annotate = {
- types : {
- annotation : {
- serialized_name : "annotations",
- serializer : function(_data, _source) {
- return {
- begin: _data.begin.milliseconds,
- end: _data.end.milliseconds,
- content: {
- data: _data.description
- },
- tags: _data.getTagTexts(),
- media: _source.unNamespace(_data.getMedia().id),
- title: _data.title,
- type_title: _data.getAnnotationType().title,
- type: _source.unNamespace(_data.getAnnotationType().id)
- }
- }
- }
- },
- serialize : function(_source) {
- var _res = {},
- _this = this;
- _source.forEach(function(_list, _typename) {
- if (typeof _this.types[_typename] !== "undefined") {
- _res[_this.types[_typename].serialized_name] = _list.map(function(_el) {
- return _this.types[_typename].serializer(_el, _source);
- });
- }
- });
- _res.meta = {
- creator: _source.creator,
- created: _source.created
- }
- return JSON.stringify(_res);
- }
-}/* LDT Platform Serializer */
+};/* LDT Platform Serializer */
if (typeof IriSP.serializers === "undefined") {
IriSP.serializers = {}
@@ -2084,11 +2221,15 @@
_res.title = _data.meta["dc:title"];
_res.description = _data.meta["dc:description"];
_res.setDuration(_data.meta["dc:duration"]);
+ _res.url = _data.meta.url;
+ if (typeof _data.meta.img !== "undefined" && _data.meta.img.src !== "undefined") {
+ _res.thumbnail = _data.meta.img.src;
+ }
return _res;
},
serializer : function(_data, _source) {
return {
- id : _source.unNamespace(_data.id),
+ id : _data.id,
url : _data.video,
meta : {
"dc:title" : _data.title,
@@ -2108,7 +2249,7 @@
},
serializer : function(_data, _source) {
return {
- id : _source.unNamespace(_data.id),
+ id : _data.id,
meta : {
"dc:title" : _data.title
}
@@ -2125,7 +2266,7 @@
},
serializer : function(_data, _source) {
return {
- id : _source.unNamespace(_data.id),
+ id : _data.id,
"dc:title" : _data.title,
"dc:description" : _data.description
}
@@ -2148,7 +2289,7 @@
}
_res.color = '#' + _c;
}
- _res.setMedia(_data.media, _source);
+ _res.setMedia(_data.media);
_res.setAnnotationType(_data.meta["id-ref"]);
_res.setTags(IriSP._(_data.tags).pluck("id-ref"));
_res.setBegin(_data.begin);
@@ -2158,27 +2299,31 @@
if (typeof _data.meta["dc:source"] !== "undefined" && typeof _data.meta["dc:source"].content !== "undefined") {
_res.source = JSON.parse(_data.meta["dc:source"].content);
}
+ if (typeof _data.content.audio !== "undefined" && _data.content.audio.href) {
+ _res.audio = _data.content.audio;
+ }
return _res;
},
serializer : function(_data, _source) {
return {
- id : _source.unNamespace(_data.id),
+ id : _data.id,
begin : _data.begin.milliseconds,
end : _data.end.milliseconds,
content : {
title : _data.title,
- description : _data.description
+ description : _data.description,
+ audio : _data.audio
},
- media : _source.unNamespace(_data.media.id),
+ media : _data.media.id,
meta : {
- "id-ref" : _source.unNamespace(_data.annotationType.id),
+ "id-ref" : _data.annotationType.id,
"dc:created" : IriSP.Model.dateToIso(_data.created),
"dc:creator" : _data.creator,
project : _source.projectId
},
tags : IriSP._(_data.tag.id).map(function(_id) {
return {
- "id-ref" : _source.unNamespace(_id)
+ "id-ref" : _id
}
})
}
@@ -2200,7 +2345,7 @@
"dc:title": _data.title,
"dc:description": _data.description,
segments: _data.segments.map(function(_annotation) {
- return _source.unNamespace(_id);
+ return _id;
})
}
}
@@ -2226,9 +2371,9 @@
return;
}
IriSP._(this.types).forEach(function(_type, _typename) {
- var _listdata = _data[_type.serialized_name];
+ var _listdata = _data[_type.serialized_name],
+ _list = new IriSP.Model.List(_source.directory);
if (typeof _listdata !== "undefined" && _listdata !== null) {
- var _list = new IriSP.Model.List(_source.directory);
if (_listdata.hasOwnProperty("length")) {
var _l = _listdata.length;
for (var _i = 0; _i < _l; _i++) {
@@ -2237,8 +2382,8 @@
} else {
_list.push(_type.deserializer(_listdata, _source));
}
- _source.addList(_typename, _list);
}
+ _source.addList(_typename, _list);
});
if (typeof _data.meta !== "undefined") {
@@ -2252,3 +2397,93 @@
}
}
+/* Used when Putting annotations on the platform */
+
+if (typeof IriSP.serializers === "undefined") {
+ IriSP.serializers = {}
+}
+
+IriSP.serializers.ldt_annotate = {
+ types : {
+ annotation : {
+ serialized_name : "annotations",
+ serializer : function(_data, _source) {
+ var _annType = _data.getAnnotationType();
+ return {
+ begin: _data.begin.milliseconds,
+ end: _data.end.milliseconds,
+ content: {
+ data: _data.description,
+ audio: _data.audio
+ },
+ tags: _data.getTagTexts(),
+ media: _data.getMedia().id,
+ title: _data.title,
+ type_title: _annType.title,
+ type: ( typeof _annType.dont_send_id !== "undefined" && _annType.dont_send_id ? "" : _annType.id )
+ }
+ }
+ }
+ },
+ serialize : function(_source) {
+ var _res = {},
+ _this = this;
+ _source.forEach(function(_list, _typename) {
+ if (typeof _this.types[_typename] !== "undefined") {
+ _res[_this.types[_typename].serialized_name] = _list.map(function(_el) {
+ return _this.types[_typename].serializer(_el, _source);
+ });
+ }
+ });
+ _res.meta = {
+ creator: _source.creator,
+ created: _source.created
+ }
+ return JSON.stringify(_res);
+ },
+ deSerialize : function(_data, _source) {
+ if (typeof _data == "string") {
+ _data = JSON.parse(_data);
+ }
+ _source.addList('tag', new IriSP.Model.List(_source.directory));
+ _source.addList('annotationType', new IriSP.Model.List(_source.directory));
+ _source.addList('annotation', new IriSP.Model.List(_source.directory));
+ if (typeof _data.annotations == "object" && _data.annotations && _data.annotations.length) {
+ var _anndata = _data.annotations[0],
+ _ann = new IriSP.Model.Annotation(_anndata.id, _source);
+ _ann.title = _anndata.content.title || "";
+ _ann.description = _anndata.content.data || "";
+ _ann.created = new Date(_data.meta.created);
+ _ann.setMedia(_anndata.media, _source);
+ var _anntypes = _source.getAnnotationTypes(true).searchByTitle(_anndata.type_title);
+ if (_anntypes.length) {
+ var _anntype = _anntypes[0];
+ } else {
+ var _anntype = new IriSP.Model.AnnotationType(_anndata.type, _source);
+ _anntype.title = _anndata.type_title;
+ _source.getAnnotationTypes().push(_anntype);
+ }
+ _ann.setAnnotationType(_anntype.id);
+ var _tagIds = IriSP._(_anndata.tags).map(function(_title) {
+ var _tags = _source.getTags(true).searchByTitle(_title);
+ if (_tags.length) {
+ var _tag = _tags[0];
+ }
+ else {
+ _tag = new IriSP.Model.Tag(_title.replace(/\W/g,'_'),_source);
+ _tag.title = _title;
+ _source.getTags().push(_tag);
+ }
+ return _tag.id;
+ });
+ _ann.setTags(_tagIds);
+ _ann.setBegin(_anndata.begin);
+ _ann.setEnd(_anndata.end);
+ _ann.creator = _data.meta.creator;
+ if (typeof _anndata.content.audio !== "undefined" && _anndata.content.audio.href) {
+ _ann.audio = _anndata.content.audio;
+ }
+ _source.getAnnotations().push(_ann);
+ }
+ }
+}
\ No newline at end of file
--- a/web/res/metadataplayer/Mediafragment.js Thu Jun 14 16:05:27 2012 +0200
+++ b/web/res/metadataplayer/Mediafragment.js Wed Jun 20 18:46:56 2012 +0200
@@ -6,7 +6,7 @@
if (typeof window.addEventListener !== "undefined") {
window.addEventListener('message', function(_msg) {
if (/^#/.test(_msg.data)) {
- document.location.hash = _msg.data;
+ this.setWindowHash(_msg.data);
}
})
};
@@ -22,6 +22,14 @@
this.goToHash();
}
+IriSP.Widgets.Mediafragment.prototype.setWindowHash = function(_hash) {
+ if (typeof window.history !== "undefined" && typeof window.history.replaceState !== "undefined") {
+ window.history.replaceState({}, "", _hash);
+ } else {
+ document.location.hash = _hash;
+ }
+}
+
IriSP.Widgets.Mediafragment.prototype.getLastHash = function() {
var _tab = document.location.hash.replace(/^#/,'').split('&');
_tab = IriSP._(_tab).filter(function(_el) {
@@ -57,7 +65,7 @@
}
IriSP.Widgets.Mediafragment.prototype.setHashToAnnotation = function(_annotationId) {
- this.setHash( 'id', this.source.unNamespace(_annotationId) );
+ this.setHash( 'id', _annotationId );
}
IriSP.Widgets.Mediafragment.prototype.setHashToTime = function(_time) {
@@ -71,7 +79,7 @@
this.last_hash_key = _key;
this.last_hash_value = _value;
var _hash = this.getLastHash();
- document.location.hash = _hash;
+ this.setWindowHash(_hash);
if (window.parent !== window) {
window.parent.postMessage(_hash,"*")
}
--- a/web/res/metadataplayer/Polemic.js Thu Jun 14 16:05:27 2012 +0200
+++ b/web/res/metadataplayer/Polemic.js Wed Jun 20 18:46:56 2012 +0200
@@ -26,22 +26,18 @@
polemics : [
{
"keywords" : [ "++" ],
- "description" : "positif",
"color" : "#1D973D"
},
{
"keywords" : [ "--" ],
- "description" : "negatif",
"color" : "#CE0A15"
},
{
- "keywords" : [ "==" ],
- "description" : "reference",
+ "keywords" : [ "==", "http://" ],
"color" : "#C5A62D"
},
{
- "keywords" : [ "??" ],
- "description" : "question",
+ "keywords" : [ "?" ],
"color" : "#036AAE"
}
],
@@ -173,13 +169,13 @@
var _y = _this.height;
_slice.annotations.forEach(function(_annotation) {
_y -= _this.element_height;
- displayElement(_x, _y, _this.defaultcolor, _annotation.namespacedId.name, _annotation.title);
+ displayElement(_x, _y, _this.defaultcolor, _annotation.id, _annotation.title);
});
IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
var _color = _this.polemics[_j].color;
_annotations.forEach(function(_annotation) {
_y -= _this.element_height;
- displayElement(_x, _y, _color, _annotation.namespacedId.name, _annotation.title);
+ displayElement(_x, _y, _color, _annotation.id, _annotation.title);
});
});
_x += _this.element_width;
--- a/web/res/metadataplayer/Segments.js Thu Jun 14 16:05:27 2012 +0200
+++ b/web/res/metadataplayer/Segments.js Wed Jun 20 18:46:56 2012 +0200
@@ -51,7 +51,7 @@
left : Math.floor( _left ),
width : Math.floor( _width ),
center : Math.floor( _center ),
- id : _annotation.namespacedId.name
+ id : _annotation.id
}
})
}));
--- a/web/res/metadataplayer/Slider.js Thu Jun 14 16:05:27 2012 +0200
+++ b/web/res/metadataplayer/Slider.js Wed Jun 20 18:46:56 2012 +0200
@@ -4,9 +4,6 @@
IriSP.Widgets.Slider = function(player, config) {
IriSP.Widgets.Widget.call(this, player, config);
- this.bindPopcorn("timeupdate","onTimeupdate");
- this.bindPopcorn("IriSP.PlayerWidget.MouseOver","onMouseover");
- this.bindPopcorn("IriSP.PlayerWidget.MouseOut","onMouseout");
};
IriSP.Widgets.Slider.prototype = new IriSP.Widgets.Widget();
@@ -14,14 +11,14 @@
IriSP.Widgets.Slider.prototype.defaults = {
minimized_height : 4,
maximized_height : 10,
- minimize_timeout : 1500 // time before minimizing slider after mouseout
+ minimize_timeout : 1500 /* time before minimizing slider after mouseout,
+ set to zero for fixed slider */
};
IriSP.Widgets.Slider.prototype.draw = function() {
this.$slider = IriSP.jQuery('<div>')
- .addClass("Ldt-Slider")
- .css(this.calculateSliderCss(this.minimized_height));
+ .addClass("Ldt-Slider");
this.$.append(this.$slider);
@@ -40,14 +37,21 @@
this.$handle = this.$slider.find('.ui-slider-handle');
- this.$handle.css(this.calculateHandleCss(this.minimized_height));
+ this.bindPopcorn("timeupdate","onTimeupdate");
+ this.bindPopcorn("IriSP.PlayerWidget.MouseOver","onMouseover");
+ this.bindPopcorn("IriSP.PlayerWidget.MouseOut","onMouseout");
- this.$
- .mouseover(this.functionWrapper("onMouseover"))
- .mouseout(this.functionWrapper("onMouseout"));
-
- this.maximized = false;
- this.timeoutId = false;
+ if (this.minimize_timeout) {
+ this.$slider.css(this.calculateSliderCss(this.minimized_height));
+ this.$handle.css(this.calculateHandleCss(this.minimized_height));
+
+ this.$
+ .mouseover(this.functionWrapper("onMouseover"))
+ .mouseout(this.functionWrapper("onMouseout"));
+
+ this.maximized = false;
+ this.timeoutId = false;
+ }
};
IriSP.Widgets.Slider.prototype.onTimeupdate = function() {
@@ -57,30 +61,33 @@
}
IriSP.Widgets.Slider.prototype.onMouseover = function() {
- if (this.timeoutId) {
- window.clearTimeout(this.timeoutId);
- this.timeoutId = false;
- }
- if (!this.maximized) {
- this.animateToHeight(this.maximized_height);
- this.maximized = true;
+ if (this.minimize_timeout) {
+ if (this.timeoutId) {
+ window.clearTimeout(this.timeoutId);
+ this.timeoutId = false;
+ }
+ if (!this.maximized) {
+ this.animateToHeight(this.maximized_height);
+ this.maximized = true;
+ }
}
}
IriSP.Widgets.Slider.prototype.onMouseout = function() {
- if (this.timeoutId) {
- window.clearTimeout(this.timeoutId);
- this.timeoutId = false;
+ if (this.minimize_timeout) {
+ if (this.timeoutId) {
+ window.clearTimeout(this.timeoutId);
+ this.timeoutId = false;
+ }
+ var _this = this;
+ this.timeoutId = window.setTimeout(function() {
+ if (_this.maximized) {
+ _this.animateToHeight(_this.minimized_height);
+ _this.maximized = false;
+ }
+ _this.timeoutId = false;
+ }, this.minimize_timeout);
}
- var _this = this;
- this.timeoutId = window.setTimeout(function() {
- if (_this.maximized) {
- _this.animateToHeight(_this.minimized_height);
- _this.maximized = false;
- }
- _this.timeoutId = false;
- }, this.minimize_timeout);
-
}
IriSP.Widgets.Slider.prototype.animateToHeight = function(_height) {
--- a/web/res/metadataplayer/Tagcloud.js Thu Jun 14 16:05:27 2012 +0200
+++ b/web/res/metadataplayer/Tagcloud.js Wed Jun 20 18:46:56 2012 +0200
@@ -13,11 +13,13 @@
IriSP.Widgets.Tagcloud.prototype.defaults = {
include_titles: true,
include_descriptions: true,
+ include_tag_texts: true,
tag_count: 30,
stopword_language: "fr",
custom_stopwords: [],
exclude_pattern: false,
annotation_type: false,
+ segment_annotation_type: false,
min_font_size: 10,
max_font_size: 26
}
@@ -37,13 +39,51 @@
}
IriSP.Widgets.Tagcloud.prototype.draw = function() {
+ this.bindPopcorn("IriSP.search", "onSearch");
+ this.bindPopcorn("IriSP.search.closed", "onSearch");
+ this.bindPopcorn("IriSP.search.cleared", "onSearch");
+ if (this.segment_annotation_type) {
+ this.bindPopcorn("timeupdate","onTimeupdate");
+ } else {
+ this.redraw();
+ }
+}
+
+IriSP.Widgets.Tagcloud.prototype.onTimeupdate = function() {
+ var _time = Math.floor(this.player.popcorn.currentTime() * 1000),
+ _list = this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).filter(function(_annotation) {
+ return _annotation.begin <= _time && _annotation.end > _time;
+ });
+ if (_list.length) {
+ if (_list[0].begin !== this.begin_time || _list[0].end !== this.end_time) {
+ this.begin_time = _list[0].begin;
+ this.end_time = _list[0].end;
+ this.redraw();
+ }
+ }
+}
+
+IriSP.Widgets.Tagcloud.prototype.redraw = function() {
var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
_regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g,
_words = {},
- _this = this;
- this.getWidgetAnnotations().forEach(function(_annotation) {
- var _txt = (_this.include_titles ? _annotation.title : '') + ' ' + (_this.include_descriptions ? _annotation.description : '');
+ _this = this,
+ _annotations = this.getWidgetAnnotations();
+
+ if (typeof this.begin_time !== "undefined" && typeof this.end_time !== "undefined") {
+ _annotations = _annotations.filter(function(_annotation) {
+ return _annotation.begin >= _this.begin_time && _annotation.end <= _this.end_time;
+ })
+ }
+
+ _annotations.forEach(function(_annotation) {
+ var _txt =
+ (_this.include_titles ? _annotation.title : '')
+ + ' '
+ + (_this.include_descriptions ? _annotation.description : '')
+ + ' '
+ + (_this.include_tag_texts ? _annotation.getTagTexts() : '');
IriSP._(_txt.toLowerCase().replace(_urlRegExp, '').match(_regexpword)).each(function(_word) {
if (IriSP._(_this.stopwords).indexOf(_word) == -1 && (!_this.exclude_pattern || !_this.exclude_pattern.test(_word))) {
_words[_word] = 1 + (_words[_word] || 0);
@@ -66,25 +106,20 @@
})
.first(this.tag_count)
.value();
- if (!_words.length) {
- return;
+ if (_words.length) {
+ var _max = _words[0].count,
+ _min = Math.min(_words[_words.length - 1].count, _max - 1),
+ _scale = (this.max_font_size - this.min_font_size) / Math.sqrt(_max - _min);
+ IriSP._(_words).each(function(_word) {
+ _word.size = Math.floor( _this.min_font_size + _scale * Math.sqrt(_word.count - _min) );
+ });
}
- var _max = _words[0].count,
- _min = Math.min(_words[_words.length - 1].count, _max - 1),
- _scale = (this.max_font_size - this.min_font_size) / Math.sqrt(_max - _min);
- IriSP._(_words).each(function(_word) {
- _word.size = Math.floor( _this.min_font_size + _scale * Math.sqrt(_word.count - _min) );
- });
- this.words = _words;
- this.renderTemplate();
- this.$words = this.$.find(".Ldt-Tagcloud-item");
- this.$words.click(function() {
+ this.$.html(Mustache.to_html(this.template, {words: _words }));
+ this.$.find(".Ldt-Tagcloud-item").click(function() {
var _txt = IriSP.jQuery(this).attr("content");
_this.player.popcorn.trigger("IriSP.search.triggeredSearch", _txt);
});
- this.bindPopcorn("IriSP.search", "onSearch");
- this.bindPopcorn("IriSP.search.closed", "onSearch");
- this.bindPopcorn("IriSP.search.cleared", "onSearch");
+
}
IriSP.Widgets.Tagcloud.prototype.onSearch = function(searchString) {
@@ -92,7 +127,7 @@
if (searchString) {
var _rgxp = IriSP.Model.regexpFromTextOrArray(searchString);
}
- this.$words.each(function() {
+ this.$.find(".Ldt-Tagcloud-item").each(function() {
var _el = IriSP.jQuery(this),
_txt = _el.attr("content");
if (searchString) {
--- a/web/res/metadataplayer/Tweet.css Thu Jun 14 16:05:27 2012 +0200
+++ b/web/res/metadataplayer/Tweet.css Wed Jun 20 18:46:56 2012 +0200
@@ -2,7 +2,14 @@
border: 1px solid #b7b7b7;
padding: 1px;
margin: 0;
- font-family: Helvetica, Arial, sans-serif;
+}
+
+.Ldt-Tweet-Widget a {
+ color: #0068C4;
+}
+
+.Ldt-Tweet-Widget a:hover {
+ color: #003366;
}
.Ldt-Tweet-Inner {
@@ -51,12 +58,10 @@
}
a.Ldt-Tweet-ScreenName {
- color: #0068c4;
text-decoration: none;
}
a.Ldt-Tweet-ScreenName:hover {
- color: #000000;
text-decoration: underline;
}
@@ -78,7 +83,6 @@
.Ldt-Tweet-Bottom a {
display: inline-block;
margin-left: 12px;
- color: #000000;
text-decoration: none;
}
--- a/web/res/metadataplayer/Tweet.js Thu Jun 14 16:05:27 2012 +0200
+++ b/web/res/metadataplayer/Tweet.js Wed Jun 20 18:46:56 2012 +0200
@@ -1,3 +1,5 @@
+/* TODO: Show Twitter Links in a small Window */
+
IriSP.Widgets.Tweet = function(player, config) {
IriSP.Widgets.Widget.call(this, player, config);
this.lastAnnotation = false;
@@ -10,25 +12,22 @@
polemics : [
{
"keywords" : [ "++" ],
- "description" : "positif",
"color" : "#30d765"
},
{
"keywords" : [ "--" ],
- "description" : "negatif",
"color" : "#f51123"
},
{
"keywords" : [ "==" ],
- "description" : "reference",
"color" : "#f1e24a"
},
{
"keywords" : [ "??" ],
- "description" : "question",
"color" : "#05aae6"
}
- ]
+ ],
+ pin_at_start: false
}
IriSP.Widgets.Tweet.prototype.messages = {
@@ -38,8 +37,9 @@
keep_visible: "Garder visible",
dont_keep_visible: "Permettre la fermeture automatique",
close_widget: "Fermer l'affichage du tweet",
- original_time: "Heure d'envoi ",
- video_time: "Temps de la vidéo : "
+ original_time: "Heure d'envoi : ",
+ video_time: "Temps de la vidéo : ",
+ show_original: "Voir l'original"
},
"en": {
retweet: "Retweet",
@@ -48,25 +48,28 @@
dont_keep_visible: "Don't keep visible",
close_widget: "Close tweet display",
original_time: "Tweet sent at: ",
- video_time: "Video time: "
+ video_time: "Video time: ",
+ show_original: "Show original"
}
}
IriSP.Widgets.Tweet.prototype.template =
'<div class="Ldt-Tweet-Widget"><div class="Ldt-Tweet-Inner"><div class="Ldt-Tweet-PinClose-Buttons">'
- + '<a href="#" class="Ldt-Tweet-Pin" title="{{l10n.keep_visible}}"></a>'
- + '<a href="#" class="Ldt-Tweet-Close" title="{{l10n.close_widget}}"></a>'
+ + '<a href="#" class="Ldt-Tweet-Pin Ldt-TraceMe{{#pin_at_start}} active" title="{{l10n.dont_keep_visible}}{{/pin_at_start}}{{^pin_at_start}}" title="{{l10n.keep_visible}}{{/pin_at_start}}"></a>'
+ + '<a href="#" class="Ldt-Tweet-Close Ldt-TraceMe" title="{{l10n.close_widget}}"></a>'
+ '</div><div class="Ldt-Tweet-AvatarContainer"><a href="#" class="Ldt-Tweet-ProfileLink" target="_blank">'
+ '<img src="" class="Ldt-Tweet-Avatar"/></a></div><h3><a href="#" class="Ldt-Tweet-ProfileLink Ldt-Tweet-ScreenName" target="_blank">'
+ '</a> (<span class="Ldt-Tweet-FullName"></span>)</h3><p class="Ldt-Tweet-Contents"></p><div class="Ldt-Tweet-Bottom">'
- + '<span class="Ldt-Tweet-Time"></span><a href="" target="_blank" class="Ldt-Tweet-Retweet"><div class="Ldt-Tweet-Icon"></div>{{l10n.retweet}}</a>'
+ + '<span class="Ldt-Tweet-Time"></span>'
+ + '<a class="Ldt-Tweet-Original" href="" target="_blank">{{l10n.show_original}}</a>'
+ + '<a href="" target="_blank" class="Ldt-Tweet-Retweet"><div class="Ldt-Tweet-Icon"></div>{{l10n.retweet}}</a>'
+ '<a href="" target="_blank" class="Ldt-Tweet-Reply"><div class="Ldt-Tweet-Icon"></div>{{l10n.reply}}</a></div></div></div>';
IriSP.Widgets.Tweet.prototype.draw = function() {
this.renderTemplate();
this.bindPopcorn("IriSP.Tweet.show","show");
- this.pinned = false;
+ this.pinned = this.pin_at_start;
var _this = this;
this.$.find(".Ldt-Tweet-Pin").click(function() {
_this.pinned = !_this.pinned;
@@ -162,10 +165,13 @@
_txt += _tweet.source.text.substring(_currentPos);
this.$.find(".Ldt-Tweet-Avatar").attr("src",_tweet.source.user.profile_image_url);
this.$.find(".Ldt-Tweet-ScreenName").html('@'+_tweet.source.user.screen_name);
- this.$.find(".Ldt-Tweet-ProfileLink").attr("href", "http://twitter.com/" + _tweet.source.user.screen_name);
+ this.$.find(".Ldt-Tweet-ProfileLink").attr("href", "https://twitter.com/" + _tweet.source.user.screen_name);
this.$.find(".Ldt-Tweet-FullName").html(_tweet.source.user.name);
this.$.find(".Ldt-Tweet-Contents").html(_txt);
this.$.find(".Ldt-Tweet-Time").html(this.l10n.original_time + new Date(_tweet.source.created_at).toLocaleTimeString() + " / " + this.l10n.video_time + _tweet.begin.toString());
+ this.$.find(".Ldt-Tweet-Retweet").attr("href", "https://twitter.com/intent/retweet?tweet_id=" + _tweet.source.id_str);
+ this.$.find(".Ldt-Tweet-Reply").attr("href", "https://twitter.com/intent/tweet?in_reply_to=" + _tweet.source.id_str);
+ this.$.find(".Ldt-Tweet-Original").attr("href", "https://twitter.com/" + _tweet.source.user.screen_name + "/status/" + _tweet.source.id_str);
this.player.popcorn.trigger("IriSP.Annotation.minimize");
this.$.slideDown();
this.cancelTimeout();