Binary file metadataplayer edwin/fonts/DINBd.ttf has changed
Binary file metadataplayer edwin/fonts/DINRg.ttf has changed
Binary file metadataplayer edwin/images/apollo.jpg has changed
Binary file metadataplayer edwin/images/atlas.jpg has changed
Binary file metadataplayer edwin/images/background.png has changed
Binary file metadataplayer edwin/images/barbg.png has changed
Binary file metadataplayer edwin/images/bunny.png has changed
Binary file metadataplayer edwin/images/mashupbar.png has changed
Binary file metadataplayer edwin/images/melies.jpg has changed
Binary file metadataplayer edwin/images/title.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/metadataplayer edwin/json/moon.json Fri Jun 29 12:12:38 2012 +0200
@@ -0,0 +1,258 @@
+{
+ "views": null,
+ "tags": null,
+ "lists": [
+ {
+ "items": ["segment-bunny-003", "segment-melies-001", "segment-bunny-001", "segment-melies-002", "segment-bunny-002"],
+ "meta": {
+ "dc:contributor": "IRI",
+ "dc:creator": "IRI",
+ "dc:title": "Bout à bout Lunaire",
+ "dc:modified": "2012-06-22T15:04:17.752880",
+ "dc:created": "2012-06-22T15:04:17.752880",
+ "listtype": "mashup",
+ "dc:description": ""
+ },
+ "id": "mashup-001"
+ }
+ ],
+ "medias": [
+ {
+ "origin": "0",
+ "url": "melies.webm",
+ "http://advene.liris.cnrs.fr/ns/frame_of_reference/ms": "o=0",
+ "meta": {
+ "dc:contributor": "IRI",
+ "dc:created": "2011-09-19T13:17:56.656743",
+ "dc:duration": 674000,
+ "dc:creator": "IRI",
+ "dc:created.contents": "2012-02-13",
+ "dc:title": "Le Voyage dans la Lune de Méliès",
+ "dc:creator.contents": "IRI",
+ "dc:modified": "2012-02-13T11:55:33.052583",
+ "dc:description": "Georges Méliès, 1902. Domaine public.",
+ "url": "http://en.wikipedia.org/wiki/File:Le_Voyage_dans_la_Lune_%28Georges_M%C3%A9li%C3%A8s,_1902%29.ogv",
+ "img": {
+ "src": "images/melies.jpg"
+ }
+ },
+ "id": "media-melies",
+ "unit": "ms"
+ }, {
+ "origin": "0",
+ "url": "big_buck_bunny.ogv",
+ "http://advene.liris.cnrs.fr/ns/frame_of_reference/ms": "o=0",
+ "meta": {
+ "dc:contributor": "IRI",
+ "dc:created": "2011-09-19T13:17:56.656743",
+ "dc:duration": 87000,
+ "dc:creator": "IRI",
+ "dc:created.contents": "2012-02-13",
+ "dc:title": "Bick Buck Bunny",
+ "dc:creator.contents": "IRI",
+ "dc:modified": "2012-02-13T11:55:33.052583",
+ "dc:description": "Animation movie",
+ "url": "http://www.nasa.gov/multimedia/videogallery/index.html?media_id=11463015",
+ "img": {
+ "src": "images/bunny.png"
+ }
+ },
+ "id": "media-bunny",
+ "unit": "ms"
+ }
+ ],
+ "meta": {
+ "dc:contributor": "admin",
+ "dc:created": "2012-05-11T16:26:53.787298",
+ "dc:creator": "admin",
+ "main_media": {
+ "id-ref": "mashup-001"
+ },
+ "dc:description": "",
+ "dc:title": "To the Moon, feat. Méliès + NASA",
+ "id": "5afd8bbe-9b75-11e1-9e5d-00145ea4a2be",
+ "dc:modified": "2012-05-11T16:37:30.246796"
+ },
+ "annotations": [
+ {
+ "content": {
+ "mimetype": "application/x-ldt-structured",
+ "description": "Le Voyage dans la Lune, Segment 1",
+ "img": {
+ "src": ""
+ },
+ "title": "La capsule lunaire est chargée dans le canon permettant son lancement",
+ "color": "16763904",
+ "polemics": [],
+ "audio": {
+ "mimetype": "audio/mp3",
+ "src": "",
+ "href": null
+ }
+ },
+ "begin": 0,
+ "end": 30000,
+ "meta": {
+ "dc:contributor": "perso",
+ "id-ref": "decoupage-melies",
+ "dc:created": "2012-05-11T15:08:00.348480",
+ "dc:modified": "2012-05-11T15:08:00.348480",
+ "dc:creator": "perso"
+ },
+ "tags": [],
+ "color": "10485760",
+ "media": "media-melies",
+ "id": "segment-melies-001"
+ },
+ {
+ "content": {
+ "mimetype": "application/x-ldt-structured",
+ "description": "Le Voyage dans la Lune, Segment 1",
+ "img": {
+ "src": ""
+ },
+ "title": "La capsule lunaire est chargée dans le canon permettant son lancement",
+ "color": "16763904",
+ "polemics": [],
+ "audio": {
+ "mimetype": "audio/mp3",
+ "src": "",
+ "href": null
+ }
+ },
+ "begin": 50000,
+ "end": 60000,
+ "meta": {
+ "dc:contributor": "perso",
+ "id-ref": "decoupage-melies",
+ "dc:created": "2012-05-11T15:08:00.348480",
+ "dc:modified": "2012-05-11T15:08:00.348480",
+ "dc:creator": "perso"
+ },
+ "tags": [],
+ "color": "10485760",
+ "media": "media-melies",
+ "id": "segment-melies-002"
+ },
+
+ {
+ "content": {
+ "mimetype": "application/x-ldt-structured",
+ "description": "Bunny Part I",
+ "img": {
+ "src": ""
+ },
+ "title": "Le debut",
+ "color": "16763904",
+ "polemics": [],
+ "audio": {
+ "mimetype": "audio/mp3",
+ "src": "",
+ "href": null
+ }
+ },
+ "begin": 0,
+ "end": 23000,
+ "meta": {
+ "dc:contributor": "perso",
+ "id-ref": "decoupage-apollo",
+ "dc:created": "2012-05-11T15:08:00.348480",
+ "dc:modified": "2012-05-11T15:08:00.348480",
+ "dc:creator": "perso"
+ },
+ "tags": [],
+ "color": "16763904",
+ "media": "media-bunny",
+ "id": "segment-bunny-001"
+ },
+
+ {
+ "content": {
+ "mimetype": "application/x-ldt-structured",
+ "description": "Bunny Part II",
+ "img": {
+ "src": ""
+ },
+ "title": "La suite",
+ "color": "16763904",
+ "polemics": [],
+ "audio": {
+ "mimetype": "audio/mp3",
+ "src": "",
+ "href": null
+ }
+ },
+ "begin": 50000,
+ "end": 86000,
+ "meta": {
+ "dc:contributor": "perso",
+ "id-ref": "decoupage-apollo",
+ "dc:created": "2012-05-11T15:08:00.348480",
+ "dc:modified": "2012-05-11T15:08:00.348480",
+ "dc:creator": "perso"
+ },
+ "tags": [],
+ "color": "16763904",
+ "media": "media-bunny",
+ "id": "segment-bunny-002"
+ },
+
+ {
+ "content": {
+ "mimetype": "application/x-ldt-structured",
+ "description": "Small part",
+ "img": {
+ "src": ""
+ },
+ "title": "court",
+ "color": "16763904",
+ "polemics": [],
+ "audio": {
+ "mimetype": "audio/mp3",
+ "src": "",
+ "href": null
+ }
+ },
+ "begin": 10000,
+ "end": 12000,
+ "meta": {
+ "dc:contributor": "perso",
+ "id-ref": "decoupage-apollo",
+ "dc:created": "2012-05-11T15:08:00.348480",
+ "dc:modified": "2012-05-11T15:08:00.348480",
+ "dc:creator": "perso"
+ },
+ "tags": [],
+ "color": "16763904",
+ "media": "media-bunny",
+ "id": "segment-bunny-003"
+ }
+ ],
+ "annotation-types": [
+ {
+ "dc:contributor": "perso",
+ "dc:creator": "perso",
+ "dc:title": "Segments du Voyage sur la Lune",
+ "id": "decoupage-melies",
+ "dc:created": "2012-05-11T15:08:00.348480",
+ "dc:description": "",
+ "dc:modified": "2012-05-11T15:08:00.348480"
+ }, {
+ "dc:contributor": "perso",
+ "dc:creator": "perso",
+ "dc:title": "Segments du Lancement de Juno",
+ "id": "decoupage-atlas",
+ "dc:created": "2012-05-11T15:08:00.348480",
+ "dc:description": "",
+ "dc:modified": "2012-05-11T15:08:00.348480"
+ }, {
+ "dc:contributor": "perso",
+ "dc:creator": "perso",
+ "dc:title": "Segments d'Apollo 11",
+ "id": "decoupage-apollo",
+ "dc:created": "2012-05-11T15:08:00.348480",
+ "dc:description": "",
+ "dc:modified": "2012-05-11T15:08:00.348480"
+ }
+ ]
+}
\ No newline at end of file
Binary file metadataplayer edwin/melies.mp4 has changed
Binary file metadataplayer edwin/melies.webm has changed
--- a/metadataplayer edwin/metadataplayer/Annotation.js Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/Annotation.js Fri Jun 29 12:12:38 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/metadataplayer edwin/metadataplayer/AnnotationsList.js Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/AnnotationsList.js Fri Jun 29 12:12:38 2012 +0200
@@ -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,15 +99,14 @@
_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)
});
- console.log("Getting", _url);
this.currentSource = this.player.loadMetadata(IriSP._.defaults({
"url" : _url
}, this.metadata));
@@ -129,9 +128,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 +168,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(),
--- a/metadataplayer edwin/metadataplayer/Controller.js Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/Controller.js Fri Jun 29 12:12:38 2012 +0200
@@ -92,6 +92,7 @@
this.bindPopcorn("volumechange","volumeUpdater");
this.bindPopcorn("timeupdate","timeDisplayUpdater");
this.bindPopcorn("loadedmetadata","timeDisplayUpdater");
+ this.bindPopcorn("loadedmetadata","volumeUpdater");
this.bindPopcorn("IriSP.search.matchFound","searchMatch");
this.bindPopcorn("IriSP.search.noMatchFound","searchNoMatch");
this.bindPopcorn("IriSP.search.triggeredSearch","triggeredSearch");
@@ -139,8 +140,10 @@
function() {
_this.player.popcorn.trigger("IriSP.Player.MouseOut");
});
- setTimeout(this.functionWrapper("volumeUpdater"), 1000);
/* some players - including jwplayer - save the state of the mute button between sessions */
+
+ window.setTimeout(this.functionWrapper("volumeUpdater"), 1000);
+
};
/* Update the elasped time div */
@@ -196,7 +199,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/metadataplayer edwin/metadataplayer/CreateAnnotation.js Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/CreateAnnotation.js Fri Jun 29 12:12:38 2012 +0200
@@ -216,9 +216,14 @@
var _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager);
_export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}),
_annotation = new IriSP.Model.Annotation(false, _export),
- _annotationType = new IriSP.Model.AnnotationType(false, _export),
+ _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type),
+ _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)),
_url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId});
+ if (!_annotationTypes.length) {
+ _annotationType.dont_send_id = true;
+ }
+
_annotationType.title = this.annotation_type;
_annotation.setBegin(this.begin);
_annotation.setEnd(this.end);
@@ -254,6 +259,7 @@
},
error: function(_xhr, _error, _thrown) {
IriSP.log("Error when sending annotation", _thrown);
+ _export.getAnnotations().removeElement(_annotation, true);
_this.showScreen('Error');
window.setTimeout(function(){
_this.showScreen("Main")
--- a/metadataplayer edwin/metadataplayer/LdtPlayer-core.js Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/LdtPlayer-core.js Fri Jun 29 12:12:38 2012 +0200
@@ -77,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") {
@@ -147,8 +152,32 @@
IriSP.Metadataplayer.prototype.onVideoDataLoaded = function() {
if (typeof this.videoData !== "undefined" && typeof this.config.player.video === "undefined") {
- var _media = this.videoData.currentMedia;
- if (typeof _media !== "undefined") {
+
+ var _media;
+
+ if (typeof this.videoData.mainMedia !== "undefined") {
+ _media = this.videoData.getElement(this.videoData.mainMedia);
+ }
+
+ if (this.config.player.type === "mashup" || this.config.player.type === "mashup-html") {
+ if (typeof _media === "undefined" || _media.elementType !== "mashup") {
+ var _mashups = this.videoData.getMashups();
+ if (_mashups.length) {
+ _media = _mashups[0];
+ }
+ }
+ } else {
+ if (typeof _media === "undefined" || _media.elementType !== "media") {
+ var _medias = this.videoData.getMedias();
+ if (_medias.length) {
+ _media = _medias[0];
+ }
+ }
+ }
+
+ this.videoData.currentMedia = _media;
+
+ if (typeof _media !== "undefined" && typeof _media.video !== "undefined") {
this.config.player.video = _media.video;
if (typeof _media.streamer !== "undefined") {
this.config.player.streamer = _media.streamer;
@@ -197,7 +226,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,
@@ -307,6 +336,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;
};
@@ -318,7 +351,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 = "";
}
@@ -339,6 +372,9 @@
position: "relative",
clear: "both"
});
+ if (typeof _height !== "undefined") {
+ divHtml.css("height", _height);
+ }
this.$.append(divHtml);
this.$.append(spacerHtml);
@@ -384,60 +420,47 @@
/* wrapper that simulates popcorn.js because
popcorn is a bit unstable at the time */
+/* Popcorn.code replacement has been disabled. It didn't work properly and was not even used */
+
IriSP.PopcornReplacement = {
};
/** base class for our popcorn-compatible players.
*/
IriSP.PopcornReplacement.player = function(container, options) {
- /* the jwplayer calls the callbacks in the global space so we need to
- preserve them this way */
- if (typeof IriSP._ === "undefined") {
- return;
- }
+
+ this.media = {
+ "paused": true,
+ "muted": false
+ };
- this.callbacks = {
- onReady: IriSP._.bind(this.__initApi, this),
- onTime: IriSP._.bind(this.__timeHandler, this),
- onPlay: IriSP._.bind(this.__playHandler, this),
- onPause: IriSP._.bind(this.__pauseHandler, this),
- onSeek: IriSP._.bind(this.__seekHandler, this)
- };
-
- this.media = {
- "paused": true,
- "muted": false
- };
-
- this.container = container.replace(/^#/,''); //eschew the '#'
-
- this.msgPump = {}; /* dictionnary used to receive and send messages */
- this.__codes = []; /* used to schedule the execution of a piece of code in
- a segment (similar to the popcorn.code plugin). */
-
- this._options = options;
-
+ this.container = container.replace(/^#/,''); //remove '#' at beginning
+ this.msgPump = {}; /* dictionnary used to receive and send messages */
+ this._options = options;
+
};
IriSP.PopcornReplacement.player.prototype.listen = function(msg, callback) {
- if (!this.msgPump.hasOwnProperty(msg))
- this.msgPump[msg] = [];
+ if (!this.msgPump.hasOwnProperty(msg)) {
+ this.msgPump[msg] = [];
+ }
+ this.msgPump[msg].push(callback);
+};
- 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;
-
- var d = this.msgPump[msg];
-
- for(var i = 0; i < d.length; i++) {
- d[i].call(window, params);
- }
-
+ if (!this.msgPump.hasOwnProperty(msg)) {
+ return;
+ }
+ var d = this.msgPump[msg];
+ for(var i = 0; i < d.length; i++) {
+ d[i].call(window, params);
+ }
};
+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);
@@ -449,12 +472,12 @@
/** init the api after that flash player has been setup - called by the callback
defined by the embedded flash player
-*/
+
IriSP.PopcornReplacement.player.prototype.__initApi = function() {
this.trigger("loadedmetadata"); // we've done more than loading metadata of course,
// but popcorn doesn't need to know more.
this.media.muted = this.playerFns.getMute();
- /* some programmed segments are supposed to be run at the beginning */
+ /* some programmed segments are supposed to be run at the beginning
var i = 0;
for(i = 0; i < this.__codes.length; i++) {
var c = this.__codes[i];
@@ -466,7 +489,9 @@
c.onEnd();
}
}
+
};
+*/
IriSP.PopcornReplacement.player.prototype.currentTime = function(time) {
if (typeof(time) === "undefined") {
@@ -481,16 +506,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.trigger("pause");
this.playerFns.pause();
-// }
};
IriSP.PopcornReplacement.player.prototype.muted = function(val) {
@@ -530,89 +552,47 @@
return _vol;
};
-IriSP.PopcornReplacement.player.prototype.mute = IriSP.PopcornReplacement.player.prototype.muted;
-
-IriSP.PopcornReplacement.player.prototype.code = function(options) {
- this.__codes.push(options);
- return this;
-};
-
-/* called everytime the player updates itself
- (onTime event)
- */
-
-IriSP.PopcornReplacement.player.prototype.__timeHandler = function(event) {
- var pos = event.position;
-
- var i = 0;
- for(i = 0; i < this.__codes.length; i++) {
- var c = this.__codes[i];
-
- if (pos >= c.start && pos < c.end &&
- pos - 1 <= c.start) {
- c.onStart();
- }
-
- if (pos > c.start && pos > c.end &&
- pos - 1 <= c.end) {
- c.onEnd();
- }
-
- }
-
- this.trigger("timeupdate");
-};
+IriSP.PopcornReplacement.player.prototype.mute = function() {
+ this.muted(true);
+}
-IriSP.PopcornReplacement.player.prototype.__seekHandler = function(event) {
- var i = 0;
-
- for(i = 0; i < this.__codes.length; i++) {
- var c = this.__codes[i];
-
- if (event.position >= c.start && event.position < c.end) {
- c.onEnd();
- }
- }
-
- for(i = 0; i < this.__codes.length; i++) {
- var c = this.__codes[i];
+IriSP.PopcornReplacement.player.prototype.unmute = function() {
+ this.muted(false);
+}
- if (typeof(event.offset) === "undefined")
- event.offset = 0;
-
- if (event.offset >= c.start && event.offset < c.end) {
- c.onStart();
- }
-
- }
-
- /* this signal sends as an extra argument the position in the video.
- As far as I know, this argument is not provided by popcorn */
- this.trigger("seeked", event.offset);
-};
-
-IriSP.PopcornReplacement.player.prototype.__playHandler = function(event) {
- this.media.paused = false;
- this.trigger("play");
-};
-
-IriSP.PopcornReplacement.player.prototype.__pauseHandler = function(event) {
- this.media.paused = true;
- this.trigger("pause");
-};
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) {
@@ -653,7 +633,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)+'-'
@@ -882,11 +862,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),
@@ -924,14 +904,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();
}
@@ -972,8 +949,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);
@@ -1113,7 +1089,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);
@@ -1217,54 +1193,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);
@@ -1291,34 +1223,7 @@
}
IriSP.Model.Source.prototype.getElement = function(_elId) {
- return this.directory.getElement(this.getNamespaced(_elId).fullname);
-}
-
-IriSP.Model.Source.prototype.setCurrentMediaId = function(_idRef) {
- if (typeof _idRef !== "undefined") {
- this.currentMedia = this.getElement(_idRef);
- }
-}
-
-IriSP.Model.Source.prototype.setDefaultCurrentMedia = function() {
- if (typeof this.currentMedia === "undefined" && this.getMedias().length) {
- this.currentMedia = this.getMedias()[0];
- }
-}
-
-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;
+ return this.directory.getElement(_elId);
}
IriSP.Model.Source.prototype.get = function() {
@@ -1427,14 +1332,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);
@@ -1478,7 +1381,8 @@
jwplayer : "jwplayer.js",
raphael : "raphael-min.js",
tracemanager : "tracemanager.js",
- jwPlayerSWF : "player.swf"
+ jwPlayerSWF : "player.swf",
+ json : "json2.js"
},
locations : {
// use to define locations outside defautl_dir
@@ -1584,7 +1488,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"]
+ )
+ );
};
@@ -1707,13 +1619,11 @@
this.player = document.getElementById(this.container);
this.player.addEventListener("onStateChange", "onAllocineStateChange");
this.player.cueVideoByUrl(this._options.video);
- this.callbacks.onReady();
+ this.trigger("loadedmetadata");
};
IriSP.PopcornReplacement.allocine.prototype.progressHandler = function(progressInfo) {
- this.callbacks.onTime({
- position: progressInfo.mediaTime
- });
+ this.trigger("timeupdate");
}
@@ -1735,27 +1645,18 @@
}
IriSP.PopcornReplacement.allocine.prototype.stateHandler = function(state) {
- console.log("stateHandler");
switch(state) {
case 1:
- this.callbacks.onPlay();
+ this.trigger("play");
break;
case 2:
- this.callbacks.onPause();
+ this.trigger("pause");
break;
case 3:
- this.callbacks.onSeek({
- position: this.player.getCurrentTime()
- });
+ this.trigger("seeked");
break;
-
- /*
- case 5:
- this.callbacks.onReady();
- break;
- */
}
};/* To wrap a player the develop should create a new class derived from
@@ -1869,31 +1770,26 @@
this.player.addEventListener("onVideoProgress", "onDailymotionVideoProgress");
this.player.cueVideoByUrl(this._options.video);
- this.callbacks.onReady();
+ this.trigger("loadedmetadata");
};
IriSP.PopcornReplacement.dailymotion.prototype.onProgress = function(progressInfo) {
-
- this.callbacks.onTime({
- position: progressInfo.mediaTime
- });
+ this.trigger("timeupdate");
}
IriSP.PopcornReplacement.dailymotion.prototype.onStateChange = function(state) {
switch(state) {
case 1:
- this.callbacks.onPlay();
+ this.trigger("play");
break;
case 2:
- this.callbacks.onPause();
+ this.trigger("pause");
break;
case 3:
- this.callbacks.onSeek({
- position: this.player.getCurrentTime()
- });
+ this.trigger("seeked");
break;
}
@@ -1907,12 +1803,13 @@
this.media.duration = options.duration; /* optional */
- var _player = jwplayer(this.container);
+ var _player = jwplayer(this.container),
+ _this = this;
/* Définition des fonctions de l'API - */
this.playerFns = {
- play: function() { return _player.play(); },
- pause: function() { return _player.pause(); },
+ play: function() { return _player.play(true); },
+ pause: function() { return _player.pause(true); },
getPosition: function() { return _player.getPosition(); },
seek: function(pos) { return _player.seek(pos); },
getMute: function() { return _player.getMute() },
@@ -1921,12 +1818,209 @@
setVolume: function(p) { return _player.setVolume(Math.floor(100*p)); }
}
- options.events = this.callbacks;
+ options.events = {
+ onReady: function() {
+ _this.trigger("loadedmetadata");
+ },
+ onTime: function() {
+ _this.trigger("timeupdate");
+ },
+ onPlay: function() {
+ _this.trigger("play");
+ },
+ onPause: function() {
+ _this.trigger("pause");
+ },
+ onSeek: function() {
+ _this.trigger("seeked");
+ }
+ };
_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>'),
+ _videoUrl = _media.video;
+ if (typeof options.url_transform === "function") {
+ _videoUrl = options.url_transform(_videoUrl);
+ }
+
+ _videoEl
+ .attr({
+ src : _videoUrl,
+ id : _tmpId,
+ width : _w,
+ height : _h
+ })
+ .css({
+ position: "absolute",
+ top: 0,
+ left: 0
+ });
+
+ _this.$.append(_videoEl);
+ _media.videoEl = _videoEl;
+ _media.popcorn = Popcorn("#" + _tmpId);
+ _media.loadedMetadata = false;
+ _media.popcorn.on("loadedmetadata", function() {
+ _media.loadedMetadata = true;
+ var _allLoaded = true;
+ for (var _i = 0; _i < metadata.currentMedia.medias.length; _i++) {
+ _allLoaded = _allLoaded && metadata.currentMedia.medias[_i].loadedMetadata;
+ }
+ if (_allLoaded) {
+ _this.changeCurrentAnnotation();
+ _this.trigger("loadedmetadata");
+ }
+ });
+ _media.popcorn.on("timeupdate", function() {
+ if (!_this.media.paused && _media === _this.currentMedia) {
+ var _time = Math.round( 1000 * _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 / 1000);
+// _status += " before segment";
+ }
+ } else {
+ _this.timecode = _this.segmentEnd - _this.timedelta;
+ _media.popcorn.pause();
+ _this.changeCurrentAnnotation();
+// _status += " after segment";
+ }
+// _status += " (" + _this.segmentBegin + " to " + _this.segmentEnd + ")" + ", 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 / 1000;
+ },
+ seek: function(pos) {
+ _this.timecode = Math.round(pos * 1000);
+ _this.changeCurrentAnnotation();
+ },
+ getMute: function() {
+ var _res = (
+ typeof _this.currentMedia !== "undefined"
+ ? _this.currentMedia.popcorn.muted()
+ : false
+ );
+ return _res;
+ },
+ 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() {
+ var _res = (
+ typeof _this.currentMedia !== "undefined"
+ ? _this.currentMedia.popcorn.volume()
+ : .5
+ );
+ return _res;
+ },
+ setVolume: function(_vol) {
+ for (var _i = 0; _i < _this.mashup.medias.length; _i++) {
+ _this.mashup.medias[_i].popcorn.volume(_vol);
+ }
+ }
+ }
+
+};
+
+IriSP.PopcornReplacement.htmlMashup.prototype = new IriSP.PopcornReplacement.player("", {});
+
+IriSP.PopcornReplacement.htmlMashup.prototype.changeCurrentAnnotation = function() {
+ var _annotation = this.mashup.getAnnotationAtTime( this.timecode );
+ if (typeof _annotation == "undefined") {
+ if (typeof this.currentMedia !== "undefined") {
+ this.currentMedia.popcorn.pause();
+ if (!this.media.paused) {
+ this.media.paused = true;
+ this.trigger("pause");
+ }
+ }
+ return;
+ }
+ if (_annotation !== this.currentAnnotation) {
+ this.currentAnnotation = _annotation;
+ this.segmentBegin = this.currentAnnotation.annotation.begin.milliseconds;
+ this.segmentEnd = this.currentAnnotation.annotation.end.milliseconds;
+ this.timedelta = this.segmentBegin - this.currentAnnotation.begin.milliseconds;
+ 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();
+ }
+ }
+/* PRELOADING */
+ var _this = this,
+ _preloadedMedias = [],
+ _toPreload = this.mashup.getAnnotations().filter(function(_a) {
+ return (_a.begin >= _this.currentAnnotation.end && _a.getMedia().id !== _this.currentMedia.id);
+ });
+ IriSP._(_toPreload).each(function(_a) {
+ var _media = _a.getMedia();
+ if (IriSP._(_preloadedMedias).indexOf(_media.id) === -1) {
+ _preloadedMedias.push(_media.id);
+ _media.popcorn.currentTime(_a.annotation.begin.getSeconds());
+ //console.log("Preloading ", _media.id, " at t=", _a.annotation.begin.getSeconds());
+ }
+ });
+
+// console.log("Changed segment: media="+ this.currentMedia.id + ", from=" + this.segmentBegin + " to=" + this.segmentEnd +", timedelta = ", this.timedelta)
+// } else {
+// console.log("changeCurrentAnnotation called, but segment hasn't changed");
+ }
+ if (this.currentMedia.popcorn.readyState()) {
+ this.currentMedia.popcorn.currentTime( (this.timecode + this.timedelta) / 1000);
+ this.trigger("timeupdate");
+ }
+ 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 */
@@ -1934,7 +2028,7 @@
IriSP.PopcornReplacement.mashup = function(container, options) {
/* Appel du constructeur de la classe parente */
IriSP.PopcornReplacement.player.call(this, container, options);
-
+
var _this = this;
/* Définition des fonctions de commande :
@@ -2037,37 +2131,30 @@
IriSP.PopcornReplacement.mashup.prototype = new IriSP.PopcornReplacement.player("", {});
IriSP.PopcornReplacement.mashup.prototype.onReady = function() {
-
this.player = document.getElementById(this.container);
-
- this.callbacks.onReady();
+ this.trigger("loadedmetadata");
};
IriSP.PopcornReplacement.mashup.prototype.onProgress = function(progressInfo) {
-
- this.callbacks.onTime({
- position: progressInfo.mediaTime
- });
+ this.trigger("timeupdate");
}
IriSP.PopcornReplacement.mashup.prototype.onStateChange = function(state) {
-
+
switch(state) {
case 1:
- this.callbacks.onPlay();
+ this.trigger("play");
break;
case 2:
- this.callbacks.onPause();
+ this.trigger("pause");
break;
case 3:
- this.callbacks.onSeek({
- position: this.player.getCurrentTime()
- });
+ this.trigger("seeked");
break;
}
-
+
};/* LDT Platform Serializer */
if (typeof IriSP.serializers === "undefined") {
@@ -2095,11 +2182,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,
@@ -2119,7 +2210,7 @@
},
serializer : function(_data, _source) {
return {
- id : _source.unNamespace(_data.id),
+ id : _data.id,
meta : {
"dc:title" : _data.title
}
@@ -2136,7 +2227,7 @@
},
serializer : function(_data, _source) {
return {
- id : _source.unNamespace(_data.id),
+ id : _data.id,
"dc:title" : _data.title,
"dc:description" : _data.description
}
@@ -2176,7 +2267,7 @@
},
serializer : function(_data, _source) {
return {
- id : _source.unNamespace(_data.id),
+ id : _data.id,
begin : _data.begin.milliseconds,
end : _data.end.milliseconds,
content : {
@@ -2184,39 +2275,46 @@
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
}
})
}
}
},
mashup : {
- serialized_name : "mashups",
+ serialized_name : "lists",
deserializer : function(_data, _source) {
+ if (typeof _data.meta !== "object" || typeof _data.meta.listtype !== "string" || _data.meta.listtype !== "mashup") {
+ return undefined;
+ }
var _res = new IriSP.Model.Mashup(_data.id, _source);
_res.title = _data.meta["dc:title"];
_res.description = _data.meta["dc:description"];
- for (var _i = 0; _i < _data.segments.length; _i++) {
- _res.addSegmentById(_data.segments[_i]);
+ for (var _i = 0; _i < _data.items.length; _i++) {
+ _res.addSegmentById(_data.items[_i]);
}
return _res;
},
serializer : function(_data, _source) {
return {
- "dc:title": _data.title,
- "dc:description": _data.description,
- segments: _data.segments.map(function(_annotation) {
- return _source.unNamespace(_id);
- })
+ meta : {
+ "dc:title": _data.title,
+ "dc:description": _data.description,
+ listtype: "mashup"
+ },
+ items: _data.segments.map(function(_annotation) {
+ return _id;
+ }),
+ id: _data.id
}
}
}
@@ -2241,19 +2339,25 @@
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++) {
- _list.push(_type.deserializer(_listdata[_i], _source));
+ var _element = _type.deserializer(_listdata[_i], _source);
+ if (typeof _element !== "undefined" && _element) {
+ _list.push(_element);
+ }
}
} else {
- _list.push(_type.deserializer(_listdata, _source));
+ var _element = _type.deserializer(_listdata, _source);
+ if (typeof _element !== "undefined" && _element) {
+ _list.push(_element);
+ }
}
- _source.addList(_typename, _list);
}
+ _source.addList(_typename, _list);
});
if (typeof _data.meta !== "undefined") {
@@ -2261,9 +2365,8 @@
}
if (typeof _data.meta !== "undefined" && typeof _data.meta.main_media !== "undefined" && typeof _data.meta.main_media["id-ref"] !== "undefined") {
- _source.setCurrentMediaId(_data.meta.main_media["id-ref"]);
+ _source.mainMedia = _data.meta.main_media["id-ref"];
}
- _source.setDefaultCurrentMedia();
}
}
@@ -2278,17 +2381,19 @@
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
+ data: _data.description,
+ audio: _data.audio
},
tags: _data.getTagTexts(),
- media: _source.unNamespace(_data.getMedia().id),
+ media: _data.getMedia().id,
title: _data.title,
- type_title: _data.getAnnotationType().title,
- type: _source.unNamespace(_data.getAnnotationType().id)
+ type_title: _annType.title,
+ type: ( typeof _annType.dont_send_id !== "undefined" && _annType.dont_send_id ? "" : _annType.id )
}
}
}
@@ -2348,6 +2453,9 @@
_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);
}
}
--- a/metadataplayer edwin/metadataplayer/MediaList.css Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/MediaList.css Fri Jun 29 12:12:38 2012 +0200
@@ -83,4 +83,20 @@
margin: 2px 0 2px 62px;
font-size: 10px;
color: #666666;
-}
\ No newline at end of file
+}
+
+.Ldt-MediaList-Now-MediaView {
+ clear: both; width: 100%; height: 12px; margin: 5px 0 0; overflow: hidden; position: relative;
+}
+
+.Ldt-MediaList-Other-MediaView {
+ clear: both; width: 100%; height: 6px; margin: 5px 0 0; overflow: hidden; position: relative;
+}
+
+.Ldt-MediaList-MediaView-Background {
+ position: absolute; top: 0; left: 0; width: 100%; height: 100%; filter: alpha(opacity=50); opacity: 0.5; background: #999999;
+}
+
+.Ldt-MediaList-Segment {
+ position: absolute; top: 0; height: 100%; border-style: none solid; margin-left: -1px; border-color: #ffffff; border-width: 1px;
+}
--- a/metadataplayer edwin/metadataplayer/MediaList.js Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/MediaList.js Fri Jun 29 12:12:38 2012 +0200
@@ -20,7 +20,8 @@
IriSP.Widgets.MediaList.prototype.defaults = {
default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png",
- media_url_template : "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/"
+ media_url_template : "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/",
+ default_color : "#000080"
};
IriSP.Widgets.MediaList.prototype.template =
@@ -29,14 +30,19 @@
+ '<div class="Ldt-MediaList-Now-ThumbContainer"><a href="" target="_blank">'
+ '<img class="Ldt-MediaList-Now-Thumbnail" src="" /></a></div>'
+ '<h3 class="Ldt-MediaList-Now-Title"><a href="" target="_blank"></a></h3>'
- + '<p class="Ldt-MediaList-Now-Description"></p></div></div>'
+ + '<p class="Ldt-MediaList-Now-Description"></p><div class="Ldt-MediaList-Now-MediaView"></div></div></div>'
+ '<div class="Ldt-MediaList-Other"><h2></h2><hr /><ul class="Ldt-MediaList-OtherList"></ul></div>';
+IriSP.Widgets.MediaList.prototype.mediaViewTemplate =
+ '<div class="Ldt-MediaList-MediaView-Background"></div>{{#segments}}<div class="Ldt-MediaList-Segment" style="background: {{color}}; left: {{left}}px; width: {{width}}px;"></div>{{/segments}}';
+
IriSP.Widgets.MediaList.prototype.mediaTemplate =
'<li class="Ldt-MediaList-OtherList-li"><div class="Ldt-MediaList-Other-ThumbContainer"><a href="{{url}}" target="_blank">'
+ '<img class="Ldt-MediaList-Other-Thumbnail" src="{{thumbnail}}" /></a></div>'
+ '<h3 class="Ldt-MediaList-Other-Title"><a href="{{url}}" target="_blank">{{title}}</a></h3>'
- + '<p class="Ldt-MediaList-Other-Description">{{description}}</p></li>'
+ + '<p class="Ldt-MediaList-Other-Description">{{description}}</p><div class="Ldt-MediaList-Other-MediaView">'
+ + IriSP.Widgets.MediaList.prototype.mediaViewTemplate + '</div></li>';
+
IriSP.Widgets.MediaList.prototype.onSearch = function(searchString) {
this.searchString = typeof searchString !== "undefined" ? searchString : '';
@@ -57,6 +63,23 @@
this.redraw();
};
+IriSP.Widgets.MediaList.prototype.getSegments = function(_media) {
+ var _this = this,
+ _scale = this.$.width()/_media.duration.milliseconds;
+ return this.getWidgetAnnotations()
+ .filter(function(_annotation) {
+ return _annotation.getMedia().id == _media.id;
+ })
+ .map(function(_a) {
+ var _annotation = ( _a.type = "mashedAnnotation" ? _a.annotation : _a );
+ return {
+ left: _scale * _annotation.begin,
+ width: _scale * (_annotation.end - _annotation.begin),
+ color: ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.default_color )
+ }
+ })
+}
+
IriSP.Widgets.MediaList.prototype.redraw = function(_media) {
if (typeof _media !== "undefined") {
this.$.find('.Ldt-MediaList-Other h2').html(this.l10n.other_media);
@@ -66,9 +89,13 @@
this.$.find('.Ldt-MediaList-Now-Description').html(_media.description);
var _url = _media.url || Mustache.to_html(
this.media_url_template, {
- media: _media.namespacedId.name
+ media: _media.id
});
this.$.find('.Ldt-MediaList-NowContainer a').attr("href", _url);
+ var _mediaView = Mustache.to_html( this.mediaViewTemplate, {
+ segments: this.getSegments(_media)
+ });
+ this.$.find('.Ldt-MediaList-Now-MediaView').html(_mediaView);
} else {
this.$.find('.Ldt-MediaList-Other h2').html(this.l10n.all_media);
this.$.find('.Ldt-MediaList-NowPlaying').hide();
@@ -84,10 +111,11 @@
thumbnail: _media.thumbnail || _this.default_thumbnail,
url: _media.url || Mustache.to_html(
_this.media_url_template, {
- media: _media.namespacedId.name
+ media: _media.id
}),
title: _media.title,
- description: _media.description
+ description: _media.description,
+ segments: _this.getSegments(_media)
})
}).join("");
this.$.find('.Ldt-MediaList-OtherList').html(_html);
--- a/metadataplayer edwin/metadataplayer/Mediafragment.js Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/Mediafragment.js Fri Jun 29 12:12:38 2012 +0200
@@ -65,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) {
--- a/metadataplayer edwin/metadataplayer/Polemic.js Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/Polemic.js Fri Jun 29 12:12:38 2012 +0200
@@ -169,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/metadataplayer edwin/metadataplayer/Segments.js Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/Segments.js Fri Jun 29 12:12:38 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/metadataplayer edwin/metadataplayer/Tweet.css Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/Tweet.css Fri Jun 29 12:12:38 2012 +0200
@@ -4,6 +4,14 @@
margin: 0;
}
+.Ldt-Tweet-Widget a {
+ color: #0068C4;
+}
+
+.Ldt-Tweet-Widget a:hover {
+ color: #003366;
+}
+
.Ldt-Tweet-Inner {
background: url(img/pinstripe.png);
padding: 5px;
@@ -50,12 +58,10 @@
}
a.Ldt-Tweet-ScreenName {
- color: #0068c4;
text-decoration: none;
}
a.Ldt-Tweet-ScreenName:hover {
- color: #000000;
text-decoration: underline;
}
@@ -77,7 +83,6 @@
.Ldt-Tweet-Bottom a {
display: inline-block;
margin-left: 12px;
- color: #000000;
text-decoration: none;
}
--- a/metadataplayer edwin/metadataplayer/Tweet.js Tue Jun 26 15:53:42 2012 +0200
+++ b/metadataplayer edwin/metadataplayer/Tweet.js Fri Jun 29 12:12:38 2012 +0200
@@ -24,7 +24,8 @@
"keywords" : [ "??" ],
"color" : "#05aae6"
}
- ]
+ ],
+ pin_at_start: false
}
IriSP.Widgets.Tweet.prototype.messages = {
@@ -34,8 +35,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",
@@ -44,25 +46,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 Ldt-TraceMe" title="{{l10n.keep_visible}}"></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;
@@ -158,10 +163,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();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/metadataplayer edwin/oggvideo2.htm Fri Jun 29 12:12:38 2012 +0200
@@ -0,0 +1,107 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Edwin Mashup</title>
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" src="metadataplayer/LdtPlayer-core.js" type="text/javascript"></script>
+ </head>
+ <body>
+ <div class="main-container">
+ <div class="header">
+ <h1>Hash Cut #</h1>
+ </div>
+ <div class="steps">
+ <h2>Créer un Hash-cut en 3 étapes :</h2>
+ <div class="steps-frame">
+ <div class="step">
+ <div class="step-icon step-1"></div>
+ <div class="step-title">S'inscrire et<br />créer un projet</div>
+ </div>
+ <div class="step-separator"></div>
+ <div class="step">
+ <div class="step-icon step-2"></div>
+ <div class="step-title">Découper et<br />Assembler</div>
+ </div>
+ <div class="step-separator"></div>
+ <div class="step active">
+ <div class="step-icon step-3"></div>
+ <div class="step-title">Partager et<br />regarder !</div>
+ </div>
+ </div>
+ </div>
+ <div class="colgauche">
+ <h2>Mon HashCut</h2>
+ <hr />
+ <div id="LdtPlayer"></div>
+ </div>
+ <div class="coldroite">
+ <div id="mediaList"></div>
+ </div>
+ <div class="footer">
+ <hr />
+ <p style="text-align: right;">© IRI 2012</p>
+ </div>
+ </div>
+ <script type="text/javascript">
+
+ IriSP.libFiles.defaultDir = "libs/";
+ IriSP.widgetsDir = "metadataplayer";
+ IriSP.language = 'fr';
+
+ var _metadata = {
+ url: 'json/moon.json',
+ format: 'ldt'
+ };
+
+ var _canPlayMp4 = document.createElement('video').canPlayType('video/mp4');
+
+ var _config = {
+ gui: {
+ width : 630,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : 'metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ { type: "Slider" },
+ { type: "Controller" },
+ {
+ type: "Segments",
+ annotation_type: false
+ },
+ { type: "Arrow" },
+ {
+ type: "Annotation",
+ annotation_type: false
+ },
+ {
+ type: "MediaList",
+ container: "mediaList"
+ },
+ { type: "Mediafragment" }
+ ]
+ },
+ player:{
+ type: 'mashup-html',
+ url_transform: function(_url) {
+ if (_canPlayMp4 == "maybe" || _canPlayMp4 == "probably") {
+ return _url.replace(/\.webm$/i,'.mp4');
+ } else {
+ return _url.replace(/\.mp4$/i,'.webm');
+ }
+
+ },
+ height: 350,
+ width: 630,
+ autostart: true,
+ metadata: _metadata
+ }
+ };
+
+ _myPlayer = new IriSP.Metadataplayer(_config);
+
+ </script>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/metadataplayer edwin/style.css Fri Jun 29 12:12:38 2012 +0200
@@ -0,0 +1,119 @@
+@font-face {
+ font-family: DIN;
+ font-weight: normal;
+ font-style: normal;
+ src: url(fonts/DINRg.ttf);
+}
+
+@font-face {
+ font-family: DIN;
+ font-weight: bold;
+ font-style: normal;
+ src: url(fonts/DINBd.ttf);
+}
+
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, images, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+b, u, i, center,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td,
+article, aside, canvas, details, embed,
+figure, figcaption, footer, header, hgroup,
+menu, nav, output, ruby, section, summary,
+time, mark, audio, video {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+}
+
+images a {
+ border: none;
+}
+
+body {
+ background: url(images/background.png) repeat-x top #f8f6f7;
+ font-family: DIN;
+}
+
+.main-container {
+ width: 960px; margin: 0 auto;
+}
+
+h1 {
+ width: 141px; height: 83px; text-indent: -999px; background: url(images/title.png);
+}
+
+h2 {
+ color: #30036d; margin: 5px 0 2px; font-size: 18px; font-weight: bold;
+}
+
+hr {
+ width: 100%; border: none; margin: 2px 0; background: #666666; height: 1px;
+}
+
+.steps-frame {
+ width: 960px; height: 70px; border-style: solid none; border-width: 1px; border-color: #666666; clear: both; background: url(images/barbg.png) #ffffff;
+}
+
+.step {
+ width: 256px; height: 70px; float: left; cursor: pointer;
+}
+
+.step-separator {
+ width: 96px; height: 70px; float: left; background: url(images/mashupbar.png);
+}
+
+.step-icon {
+ margin: 0 5px; height: 70px; float: left; background: url(images/mashupbar.png);
+}
+
+.step-1 {
+ background-position: -100px -70px; width: 58px;
+}
+
+.active .step-1, .step:hover .step-1 {
+ background-position: -100px 0; width: 58px;
+}
+
+.step-2 {
+ background-position: -159px -70px; width: 96px;
+}
+
+.active .step-2, .step:hover .step-2 {
+ background-position: -159px 0; width: 96px;
+}
+
+.step-3 {
+ background-position: -255px -70px; width: 115px;
+}
+
+.active .step-3, .step:hover .step-3 {
+ background-position: -255px 0; width: 115px;
+}
+
+.step-title {
+ margin: 5px 0; font-size: 18px; font-weight: bold; color: #808080;
+}
+
+.active .step-title, .step:hover .step-title {
+ color: #30036d;
+}
+
+.colgauche {
+ float: left; width: 630px; margin: 5px 10px 5px 0; min-height: 650px;
+}
+
+.coldroite {
+ float: left; width: 310px; margin: 5px 0 5px 10px;
+}
+
+.footer {
+ width: 100%; clear: both;
+}