--- a/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Wed Jan 25 19:20:55 2012 +0100
+++ b/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Thu Jan 26 17:23:18 2012 +0100
@@ -1,7 +1,7 @@
/*
*
- * Copyright 2010 Institut de recherche et d'innovation
- * contributor(s) : Samuel Huron
+ * Copyright 2010-2012 Institut de recherche et d'innovation
+ * contributor(s) : Karim Hamidou, Samuel Huron
*
* contact@iri.centrepompidou.fr
* http://www.iri.centrepompidou.fr
@@ -1085,9 +1085,9 @@
IriSP.annotation_template = "{{! template for an annotation displayed in a segmentWidget }}<div title='{{divTitle}}' id='{{id}}' class='Ldt-iri-chapter' style='left: {{startPixel}}px; width: {{pxWidth}}px; background-color:#{{hexa_color}};' ></div>";
IriSP.annotationWidget_template = "{{! template for the annotation widget }}<div class='Ldt-AnnotationsWidget'> <!-- ugly div because we want to have a double border --> <div class='Ldt-Annotation-DoubleBorder'> <div class='Ldt-AnnotationContent'> <div class='Ldt-AnnotationShareIcons'> <a target='_blank' class='Ldt-fbShare' href=''><img src='{{img_dir}}/facebook.png' alt='share on facebook'></img></a> <a target='_blank' class='Ldt-TwShare' href=''><img src='{{img_dir}}/twitter.png' alt='share on twitter'></img></a> <a target='_blank' class='Ldt-GplusShare' href=''><img src='{{img_dir}}/google.png' alt='share on google+'></img></a> </div> <div class='Ldt-SaTitle'></div> <div class='Ldt-SaDescription'></div> </div> </div></div>";
IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}<div id='Ldt-load-container'><div id='Ldt-loader'> </div> Chargement... </div>";
-IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}<div class='Ldt-AnnotationsListWidget'> <!-- ugly div because we want to have a double border --> <div class='Ldt-Annotation-DoubleBorder'> <ul> {{#annotations}} <li> {{^url}} <a href='#id={{id}}'> {{/url}} {{url}} <a href='{{url}}#id={{id}}'> <div style='overflow: auto; margin-top: 5px; margin-bottom: 5px;'> <div class='Ldt-AnnotationsList-Caption'> <img src='http://i.imgur.com/aoUlC.jpg'></img> </div> <div class='Ldt-AnnotationsList-Duration'>{{begin}} - {{end}}</div> <div class='Ldt-AnnotationsList-Title'>{{title}}</div> <div class='Ldt-AnnotationsList-Description'>{{desc}}</div> </div> </a> </li> {{/annotations}} </ul> </div></div>";
+IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}<div class='Ldt-AnnotationsListWidget'> <!-- ugly div because we want to have a double border --> <div class='Ldt-Annotation-DoubleBorder'> <ul> {{#annotations}} <li> {{! if the url is not present, it means that the annotation exists in the current project }} {{^url}} <a href='#id={{id}}'> {{/url}} {{! otherwise link to url }} {{#url}} <a href='{{url}}#id={{id}}'> {{/url}} <div style='overflow: auto; margin-top: 5px; margin-bottom: 5px;'> <div class='Ldt-AnnotationsList-Caption'> <img src='http://i.imgur.com/aoUlC.jpg'></img> </div> <div class='Ldt-AnnotationsList-Duration'>{{begin}} - {{end}}</div> <div class='Ldt-AnnotationsList-Title'>{{title}}</div> <div class='Ldt-AnnotationsList-Description'>{{desc}}</div> </div> </a> </li> {{/annotations}} </ul> </div></div>";
IriSP.arrowWidget_template = "<div class='Ldt-arrowWidget'></div>";
-IriSP.createAnnotationWidget_template = "{{! template for the annotation creation widget }}<div class='Ldt-createAnnotationWidget'> <!-- ugly div because we want to have a double border --> <div class='Ldt-createAnnotation-DoubleBorder'> <div class='Ldt-createAnnotation-startScreen'> <div style='margin-bottom: 7px; overflow: auto;'> <div class='Ldt-createAnnotation-Title'></div> <div class='Ldt-createAnnotation-TimeFrame'></div> </div> <div class='Ldt-createAnnotation-Container'> <textarea class='Ldt-createAnnotation-Description'></textarea> <div class='Ldt-createAnnotation-profileArrow'> <img src='{{img_dir}}/annotate_arrow.png'></img> </div> <div class='Ldt-createAnnotation-userAvatar'> <img src='https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png'></img> </div> </div> <div class='Ldt-createAnnotation-keywords'> Add keywords : </div> <div class='Ldt-createAnnotation-submitButton'> <div style='position: absolute; bottom: 10pt; right: 11pt;'>Submit</div> </div> </div> <div class='Ldt-createAnnotation-waitScreen' style='display: none; text-align: center'> <img src='{{img_dir}}/spinner.gif'></img> Please wait while your request is being processed... </div> <div class='Ldt-createAnnotation-endScreen' style='display: none'> Thank you, your annotation has been saved.<br> Would you like to share it on social networks ? <div style='margin-top: 12px; text-align: center;'> <a target='_blank' class='Ldt-createAnnotation-endScreen-TweetLink'><img src='{{img_dir}}/tweet_button.png' style='margin-right: 20px;'></img></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-FbLink'><img src='{{img_dir}}/facebook_button.png' style='margin-right: 20px;'></img></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-GplusLink'><img src='{{img_dir}}/gplus_button.png' style='margin-right: 20px;'></img></a> </div> </div> </div></div>";
+IriSP.createAnnotationWidget_template = "{{! template for the annotation creation widget }}<div class='Ldt-createAnnotationWidget'> <!-- ugly div because we want to have a double border --> <div class='Ldt-createAnnotation-DoubleBorder'> <div class='Ldt-createAnnotation-startScreen'> <div style='margin-bottom: 7px; overflow: auto;'> <div class='Ldt-createAnnotation-Title'></div> <div class='Ldt-createAnnotation-TimeFrame'></div> {{^cinecast_version}} <img src='{{img_dir}}/minimize.png' class='Ldt-createAnnotation-Minimize' alt='Cancel'></img> {{/cinecast_version}} </div> <div class='Ldt-createAnnotation-Container'> <textarea class='Ldt-createAnnotation-Description'></textarea> <div class='Ldt-createAnnotation-profileArrow'> <img src='{{img_dir}}/annotate_arrow.png'></img> </div> <div class='Ldt-createAnnotation-userAvatar'> <img src='https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png'></img> </div> </div> <div class='Ldt-createAnnotation-keywords'> Add keywords : </div> {{#polemic_mode}} <div class='Ldt-createAnnotation-polemics'> Add polemic keywords </div> {{/polemic_mode}} <div class='Ldt-createAnnotation-submitButton'> <div style='position: absolute; bottom: 10pt; right: 11pt;'>Submit</div> </div> </div> <div class='Ldt-createAnnotation-waitScreen' style='display: none; text-align: center'> <img src='{{img_dir}}/spinner.gif'></img> Please wait while your request is being processed... </div> <div class='Ldt-createAnnotation-endScreen' style='display: none'> Thank you, your annotation has been saved.<br> Would you like to share it on social networks ? <div style='margin-top: 12px; text-align: center;'> <a target='_blank' class='Ldt-createAnnotation-endScreen-TweetLink'><img src='{{img_dir}}/tweet_button.png' style='margin-right: 20px;'></img></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-FbLink'><img src='{{img_dir}}/facebook_button.png' style='margin-right: 20px;'></img></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-GplusLink'><img src='{{img_dir}}/gplus_button.png' style='margin-right: 20px;'></img></a> </div> </div> </div></div>";
IriSP.createAnnotationWidget_festivalCinecast_template = "{{! template for the annotation creation widget specific for the cinecast festival}}<div class='Ldt-createAnnotationWidget'> <!-- ugly div because we want to have a double border --> <div class='Ldt-createAnnotation-DoubleBorder'> <div style='margin-bottom: 7px; overflow: auto;'> <div class='Ldt-createAnnotation-Title'></div> <div class='Ldt-createAnnotation-TimeFrame'></div> </div> <div class='Ldt-createAnnotation-Container'> <textarea class='Ldt-createAnnotation-Description'></textarea> <div class='Ldt-createAnnotation-profileArrow'> <img src='{{img_dir}}/annotate_arrow.png'></img> </div> <div class='Ldt-createAnnotation-userAvatar'> <img src='https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png'></img> </div> </div> <div class='Ldt-createAnnotation-keywords'> Add keywords : </div> <div class='Ldt-createAnnotation-submitButton'> <div style='position: absolute; bottom: 10pt; right: 11pt;'>Submit</div> </div> <div class='Ldt-createAnnotation-endScreen' style='display: none'> Thank you, your annotation has been saved.<br> Would you like to share it on social networks ? <div style='margin-top: 12px; text-align: center;'> <a target='_blank' class='Ldt-createAnnotation-endScreen-TweetLink'><img src='{{img_dir}}/tweet_button.png' style='margin-right: 20px;'></img></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-FbLink'><img src='{{img_dir}}/facebook_button.png' style='margin-right: 20px;'></img></a> <a target='_blank' class='Ldt-createAnnotation-endScreen-GplusLink'><img src='{{img_dir}}/gplus_button.png' style='margin-right: 20px;'></img></a> </div> </div> </div></div>";
IriSP.createAnnotation_errorMessage_template = "<p class='Ldt-createAnnotation-errorMessage'> You must enter text to submit an annotation</p>";
IriSP.overlay_marker_template = "{{! the template for the small bars which is z-indexed over our segment widget }}<div class='Ldt-SegmentPositionMarker' style='background-color: #F7268E;'></div>";
@@ -1098,208 +1098,7 @@
IriSP.sliderWidget_template = "{{! template for the slider widget - it's composed of two divs we one overlayed on top of the other }}<div class='Ldt-sliderBackground'></div><div class='Ldt-sliderForeground'></div><div class='Ldt-sliderPositionMarker'></div>";
IriSP.tooltip_template = "{{! template used by the jquery ui tooltip }}<div class='Ldt-tooltip'> <div class='title'>{{title}}</div> <div class='time'>{{begin}} : {{end}} </div> <div class='description'>{{description}}</div></div>";
IriSP.tooltipWidget_template = "{{! template for the tooltip widget }}<div class='tip'> <div class='tipcolor' style='height:10px;width:10px'></div> <div class='tiptext'></div>";
-IriSP.tweetWidget_template = "{{! template for the tweet widget }}<div class='Ldt-tweetWidget'> <div class='Ldt-tweet-DoubleBorder'> <img src='{{img_dir}}/minimize.png' class='Ldt-tweetWidgetKeepOpen' alt='dont minimize automatically'></img> <img src='{{img_dir}}/minimize.png' class='Ldt-tweetWidgetMinimize' alt='minimize window'></img> <div class='Ldt-tweetAvatar'></div> <img src='{{img_dir}}/profile_arrow.png' class='Ldt-tweetAvatar-profileArrow'></img> <div class='Ldt-tweetContents'></div> <a href='' target='_blank' class='Ldt-Retweet'><div class='Ldt-RetweetIcon'></div> - Retweet </a> <a href='' target='_blank' class='Ldt-TweetReply'><div class='Ldt-TweetReplyIcon'></div> - Reply</a> </div></div>";/* wrapper that simulates popcorn.js because
- popcorn is a bit unstable at the time */
-
-IriSP.PopcornReplacement = {
- msgPump : {} /* used by jquery to receive and send messages */,
- __delay_seek_signal : false
-};
-
-IriSP.PopcornReplacement.media = {
- "paused": true,
- "muted": false
-};
-
-IriSP.PopcornReplacement.listen = function(msg, callback) {
-// IriSP.jQuery(IriSP.PopcornReplacement.msgPump).bind(msg, function(event, rest) { callback(rest); });
- if (!IriSP.PopcornReplacement.msgPump.hasOwnProperty(msg))
- IriSP.PopcornReplacement.msgPump[msg] = [];
-
- IriSP.PopcornReplacement.msgPump[msg].push(callback);
-};
-
-IriSP.PopcornReplacement.trigger = function(msg, params) {
-// IriSP.jQuery(IriSP.PopcornReplacement.msgPump).trigger(msg, params);
-
- if (!IriSP.PopcornReplacement.msgPump.hasOwnProperty(msg))
- return;
-
- var d = IriSP.PopcornReplacement.msgPump[msg];
-
- for(var i = 0; i < d.length; i++) {
- d[i].call(window, params);
- }
-
-};
-
-IriSP.PopcornReplacement.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);
- return v.toString(16);
- });
-
- return prefix + str;
-};
-
-IriSP.PopcornReplacement.__initApi = function() {
- IriSP.PopcornReplacement.trigger("loadedmetadata"); // we've done more than loading metadata of course,
- // but popcorn doesn't need to know more.
- IriSP.PopcornReplacement.media.muted = jwplayer(IriSP.PopcornReplacement._container).getMute();
-
- /* some programmed segments are supposed to be run at the beginning */
- var i = 0;
- for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
- var c = IriSP.PopcornReplacement.__codes[i];
- if (0 == c.start) {
- c.onStart();
- }
-
- if (0 == c.end) {
- c.onEnd();
- }
- }
-};
-
-IriSP.PopcornReplacement.jwplayer = function(container, options) {
- IriSP.PopcornReplacement._container = container.slice(1); //eschew the '#'
- options.events = {
- onReady: IriSP.PopcornReplacement.__initApi,
- onTime: IriSP.PopcornReplacement.__timeHandler,
- onPlay: IriSP.PopcornReplacement.__playHandler,
- onPause: IriSP.PopcornReplacement.__pauseHandler,
- onSeek: IriSP.PopcornReplacement.__seekHandler
- }
-
- jwplayer(IriSP.PopcornReplacement._container).setup(options);
- IriSP.PopcornReplacement.media.duration = options.duration;
- return IriSP.PopcornReplacement;
-};
-
-IriSP.PopcornReplacement.currentTime = function(time) {
- if (typeof(time) === "undefined") {
- return jwplayer(IriSP.PopcornReplacement._container).getPosition();
- } else {
- var currentTime = +time;
- jwplayer( IriSP.PopcornReplacement._container ).seek( currentTime );
- IriSP.PopcornReplacement.__delay_seek_signal = true;
- IriSP.PopcornReplacement.trigger("seeked");
- return currentTime;
- }
-};
-
-IriSP.PopcornReplacement.play = function() {
- IriSP.PopcornReplacement.media.paused = false;
- IriSP.PopcornReplacement.trigger("play");
-// IriSP.PopcornReplacement.trigger("playing");
- jwplayer( IriSP.PopcornReplacement._container ).play();
-};
-
-IriSP.PopcornReplacement.pause = function() {
- if ( !IriSP.PopcornReplacement.media.paused ) {
- IriSP.PopcornReplacement.media.paused = true;
- IriSP.PopcornReplacement.trigger( "pause" );
- jwplayer( IriSP.PopcornReplacement._container ).pause();
- }
-};
-
-IriSP.PopcornReplacement.muted = function(val) {
- if (typeof(val) !== "undefined") {
-
- if (jwplayer(IriSP.PopcornReplacement._container).getMute() !== val) {
- if (val) {
- jwplayer(IriSP.PopcornReplacement._container).setMute(true);
- IriSP.PopcornReplacement.media.muted = true;
- } else {
- jwplayer( IriSP.PopcornReplacement._container ).setMute(false);
- IriSP.PopcornReplacement.media.muted = false;
- }
-
- IriSP.PopcornReplacement.trigger( "volumechange" );
- }
-
- return jwplayer( IriSP.PopcornReplacement._container ).getMute();
- } else {
- return jwplayer( IriSP.PopcornReplacement._container ).getMute();
- }
-};
-
-IriSP.PopcornReplacement.mute = IriSP.PopcornReplacement.muted;
-
-IriSP.PopcornReplacement.__codes = [];
-IriSP.PopcornReplacement.code = function(options) {
- IriSP.PopcornReplacement.__codes.push(options);
- return IriSP.PopcornReplacement;
-};
-
-/* called everytime the player updates itself
- (onTime event)
- */
-
-IriSP.PopcornReplacement.__timeHandler = function(event) {
- var pos = event.position;
-
- var i = 0;
- for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
- var c = IriSP.PopcornReplacement.__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();
- }
-
- }
-
- IriSP.PopcornReplacement.trigger("timeupdate");
-};
-
-IriSP.PopcornReplacement.__seekHandler = function(event) {
- var i = 0;
-
- for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
- var c = IriSP.PopcornReplacement.__codes[i];
-
- if (event.position >= c.start && event.position < c.end) {
- c.onEnd();
- }
- }
-
- for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
- var c = IriSP.PopcornReplacement.__codes[i];
-
- if (typeof(event.offset) === "undefined")
- event.offset = 0;
-
- if (event.offset >= c.start && event.offset < c.end) {
- c.onStart();
- }
-
- }
-
- IriSP.PopcornReplacement.trigger("timeupdate");
-};
-
-
-IriSP.PopcornReplacement.__playHandler = function(event) {
- IriSP.PopcornReplacement.media.paused = false;
- IriSP.PopcornReplacement.trigger("play");
-};
-
-IriSP.PopcornReplacement.__pauseHandler = function(event) {
- IriSP.PopcornReplacement.media.paused = true;
- IriSP.PopcornReplacement.trigger("pause");
-};
-
-IriSP.PopcornReplacement.roundTime = function() {
- var currentTime = IriSP.PopcornReplacement.currentTime();
- return Math.round(currentTime);
-};
-/* utils.js - various utils that don't belong anywhere else */
+IriSP.tweetWidget_template = "{{! template for the tweet widget }}<div class='Ldt-tweetWidget'> <div class='Ldt-tweet-DoubleBorder'> <img src='{{img_dir}}/minimize.png' class='Ldt-tweetWidgetKeepOpen' alt='dont minimize automatically'></img> <img src='{{img_dir}}/minimize.png' class='Ldt-tweetWidgetMinimize' alt='minimize window'></img> <div class='Ldt-tweetAvatar'></div> <img src='{{img_dir}}/profile_arrow.png' class='Ldt-tweetAvatar-profileArrow'></img> <div class='Ldt-tweetContents'></div> <a href='' target='_blank' class='Ldt-Retweet'><div class='Ldt-RetweetIcon'></div> - Retweet </a> <a href='' target='_blank' class='Ldt-TweetReply'><div class='Ldt-TweetReplyIcon'></div> - Reply</a> </div></div>";/* utils.js - various utils that don't belong anywhere else */
/* trace function, for debugging */
@@ -1450,7 +1249,7 @@
/** returns an url to share on google + */
IriSP.mkGplusUrl = function(url, text) {
- return "";
+ return "https://plusone.google.com/_/+1/confirm?hl=en&url=" + IriSP.shorten_url(url);
};
/** test if a value is null or undefined */
@@ -1482,7 +1281,224 @@
}
}
*/
-/* data.js - this file deals with how the players gets and sends data */
+/* wrapper that simulates popcorn.js because
+ popcorn is a bit unstable at the time */
+
+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 using IriSP.wrap */
+ this.callbacks = {
+ onReady: IriSP.wrap(this, this.__initApi),
+ onTime: IriSP.wrap(this, this.__timeHandler),
+ onPlay: IriSP.wrap(this, this.__playHandler),
+ onPause: IriSP.wrap(this, this.__pauseHandler),
+ onSeek: IriSP.wrap(this, this.__seekHandler)
+ };
+
+ this.media = {
+ "paused": true,
+ "muted": false
+ };
+
+ this.container = container.slice(1); //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). */
+
+};
+
+IriSP.PopcornReplacement.player.prototype.listen = function(msg, callback) {
+ if (!this.msgPump.hasOwnProperty(msg))
+ this.msgPump[msg] = [];
+
+ this.msgPump[msg].push(callback);
+};
+
+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);
+ }
+
+};
+
+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);
+ return v.toString(16);
+ });
+
+ return prefix + str;
+};
+
+/** 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 */
+ var i = 0;
+ for(i = 0; i < this.__codes.length; i++) {
+ var c = this.__codes[i];
+ if (0 == c.start) {
+ c.onStart();
+ }
+
+ if (0 == c.end) {
+ c.onEnd();
+ }
+ }
+};
+
+/*
+IriSP.PopcornReplacement.jwplayer = function(container, options) {
+ IriSP.PopcornReplacement._container = container.slice(1); //eschew the '#'
+ options.events = {
+ onReady: IriSP.PopcornReplacement.__initApi,
+ onTime: IriSP.PopcornReplacement.__timeHandler,
+ onPlay: IriSP.PopcornReplacement.__playHandler,
+ onPause: IriSP.PopcornReplacement.__pauseHandler,
+ onSeek: IriSP.PopcornReplacement.__seekHandler
+ }
+
+ jwplayer(IriSP.PopcornReplacement._container).setup(options);
+ IriSP.PopcornReplacement.media.duration = options.duration;
+ return IriSP.PopcornReplacement;
+};
+*/
+
+IriSP.PopcornReplacement.player.prototype.currentTime = function(time) {
+ if (typeof(time) === "undefined") {
+ return this.playerFns.getPosition();
+ } else {
+ var currentTime = +time;
+ this.playerFns.seek( currentTime );
+ return currentTime;
+ }
+};
+
+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) {
+ if (typeof(val) !== "undefined") {
+
+ if (this.playerFns.getMute() !== val) {
+ if (val) {
+ this.playerFns.setMute(true);
+ this.media.muted = true;
+ } else {
+ this.playerFns.setMute(false);
+ this.media.muted = false;
+ }
+
+ this.trigger( "volumechange" );
+ }
+
+ return this.playerFns.getMute();
+ } else {
+ return this.playerFns.getMute();
+ }
+};
+
+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.__seekHandler = function(event) {
+ var i = 0;
+
+ console.log("pos: %d, off: %d", event.position, event.offset);
+ 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];
+
+ if (typeof(event.offset) === "undefined")
+ event.offset = 0;
+
+ if (event.offset >= c.start && event.offset < c.end) {
+ c.onStart();
+ }
+
+ }
+
+ this.trigger("seeked");
+};
+
+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);
+};/* data.js - this file deals with how the players gets and sends data */
IriSP.DataLoader = function() {
this._cache = {};
@@ -1637,7 +1653,13 @@
minimize_period: 850 // how long does the slider stays maximized after the user leaves the zone ?
},
"createAnnotationWidget" : {
- keywords: ["#faux-raccord", "#mot-clef"],
+ keywords: ["#faux-raccord", "#mot-clef"],
+ polemic_mode: true, /* enable polemics ? */
+ /* polemics - the corresponding class names defined in the css should be for instance :
+ Ldt-createAnnotation-polemic-positive for positive
+ Ldt-createAnnotation-polemic-reference for reference, etc.
+ */
+ polemics: {"++" : "positive", "--" : "negative", "==" : "reference", "??" : "question"},
cinecast_version: true /* put to false to enable the platform version, true for the festival cinecast one. */
},
"SparklineWidget" : {
@@ -1655,8 +1677,11 @@
where to
get the
ajax */
- ajax_granularity: 10000 /* how much ms should we look before and after the
+ ajax_granularity: 10000, /* how much ms should we look before and after the
current timecode */
+ project_url: IriSP.platform_url + "/ldtplatform/ldt/front/player/" /* the beginning
+ of a link to the
+ new front */
},
};
@@ -2001,14 +2026,15 @@
delete opts.container;
delete opts.type;
- if (options.provider === "rtmp") {
+
+ /* Try to guess options.file and options.streamer only if file and streamer
+ are not already defined in the configuration */
+ if (options.provider === "rtmp" && !opts.hasOwnProperty("file") && !opts.hasOwnProperty("streamer")) {
/* exit if we can't access the metadata */
if (typeof(IriSP.__jsonMetadata) === "undefined") {
break;
};
-
-
// the json format is totally illogical
//opts.streamer = IriSP.__jsonMetadata["medias"][0]["meta"]["item"]["value"];
//var source = IriSP.__jsonMetadata["medias"][0]["href"];
@@ -2035,8 +2061,7 @@
if (i < pathSplit.length - 1)
opts.file += "/";
}
- }
-
+ }
} else {
/* other providers type, video for instance -
pass everything as is */
@@ -2050,7 +2075,7 @@
opts["controlbar.position"] = "none";
}
- pop = IriSP.PopcornReplacement.jwplayer("#" + containerDiv, opts);
+ pop = new IriSP.PopcornReplacement.jwplayer("#" + containerDiv, opts);
break;
case "youtube":
@@ -2066,6 +2091,11 @@
pop = Popcorn.youtube("#" + containerDiv, opts.video, opts);
break;
+ case "allocine":
+ /* pass the options as-is to the allocine player and let it handle everything */
+ pop = new IriSP.PopcornReplacement.allocine("#" + containerDiv, options);
+ break;
+
default:
pop = undefined;
};
@@ -2156,6 +2186,33 @@
serializer.sync(IriSP.wrap(widget, function() { this.draw(); }));
return widget;
};
+/* 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.jwplayer = function(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 */
+
+ /* 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); }
+ }
+
+ options.events = this.callbacks;
+
+ jwplayer(this.container).setup(options);
+};
+
+IriSP.PopcornReplacement.jwplayer.prototype = new IriSP.PopcornReplacement.player("", {});
/* mediafragment module */
IriSP.MediaFragment = function(Popcorn, config, Serializer) {
@@ -2257,6 +2314,7 @@
this.__oldList = [];
this.ajax_mode = IriSP.widgetsDefaults["AnnotationsListWidget"].ajax_mode;
+ this.project_url = IriSP.widgetsDefaults["AnnotationsListWidget"].project_url;
};
@@ -2374,10 +2432,11 @@
var view_types = serializer.getIds("Contributions");
var l = [];
+ var media = this._serializer.currentMedia()["id"];
+
for (i = 0; i < annotations.length; i++) {
var annotation = annotations[i];
- console.log(annotation);
- console.log(view_types, annotation.meta["id-ref"]);
+
/* filter the annotations whose type is not the one we want */
/* We want _all_ the annotations.
if (typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
@@ -2393,14 +2452,37 @@
obj["desc"] = a.content.description;
obj["begin"] = IriSP.msToTime(annotation.begin);
obj["end"] = IriSP.msToTime(annotation.end);
- obj["url"] = document.location.href.split("#")[0] + "/" + annotation.meta["project"];
+
+ /* only if the annotation isn't present in the document create an
+ external link */
+ if (!this.annotations_ids.hasOwnProperty(obj["id"])) {
+ // braindead url; jacques didn't want to create a new one in the platform,
+ // so we append the cutting id to the url.
+ obj["url"] = this.project_url + "/" + media + "/" +
+ annotation.meta["project"] + "/" +
+ annotation.meta["id-ref"] + "/";
+
+ // obj["url"] = document.location.href.split("#")[0] + "/" + annotation.meta["project"];
+ }
+
l.push(obj);
}
- console.log(l);
+
this.do_redraw(l);
};
IriSP.AnnotationsListWidget.prototype.draw = function() {
-
+
+ /* build a table of the annotations present in the document for faster
+ lookup
+ */
+ this.annotations_ids = {};
+
+ var annotations = this._serializer._data.annotations;
+ var i = 0;
+ for(i = 0; i < annotations.length; i++) {
+ this.annotations_ids[annotations[i]["id"]] = 1;
+ }
+
this.drawList();
if (!this.ajax_mode) {
@@ -2605,6 +2687,10 @@
IriSP.Widget.call(this, Popcorn, config, Serializer);
this._hidden = true;
this.keywords = IriSP.widgetsDefaults["createAnnotationWidget"].keywords;
+
+ this.polemic_mode = IriSP.widgetsDefaults["createAnnotationWidget"].polemic_mode;
+ this.polemics = IriSP.widgetsDefaults["createAnnotationWidget"].polemics;
+
this.cinecast_version = IriSP.widgetsDefaults["createAnnotationWidget"].cinecast_version;
this.ids = {}; /* a dictionnary linking buttons ids to keywords */
@@ -2627,7 +2713,9 @@
IriSP.createAnnotationWidget.prototype.draw = function() {
var _this = this;
- var annotationMarkup = IriSP.templToHTML(IriSP.createAnnotationWidget_template);
+ var annotationMarkup = IriSP.templToHTML(IriSP.createAnnotationWidget_template,
+ {cinecast_version: this.cinecast_version,
+ polemic_mode: this.polemic_mode});
this.selector.append(annotationMarkup);
@@ -2661,10 +2749,43 @@
// change in a textfield.
_this.selector.find(".Ldt-createAnnotation-Description").trigger("js_mod");
// also call our update function.
- _this.handleTextChanges();
+ //_this.handleTextChanges();
}
}(keyword));
}
+
+ // add the polemic buttons.
+ if(this.polemic_mode)
+ for (var polemic in this.polemics) {
+
+ var classname = IriSP.templToHTML("Ldt-createAnnotation-polemic-{{classname}}", {classname : this.polemics[polemic]});
+
+ var templ = IriSP.templToHTML("<button class='{{classname}} Ldt-createAnnotation-polemic-button'>{{polemic}}</button>",
+ {classname: classname, polemic: polemic});
+
+ this.selector.find(".Ldt-createAnnotation-polemics").append(templ);
+ this.selector.find("." + classname).click(function(polemic) { return function() {
+ var contents = _this.selector.find(".Ldt-createAnnotation-Description").val();
+ if (contents.indexOf(polemic) != -1) {
+ var newVal = contents.replace(" " + polemic, "");
+ if (newVal == contents)
+ newVal = contents.replace(polemic, "");
+ } else {
+ if (contents === "")
+ var newVal = polemic;
+ else
+ var newVal = contents + " " + polemic;
+ }
+
+ _this.selector.find(".Ldt-createAnnotation-Description").val(newVal);
+ // we use a custom event because there's no simple way to test for a js
+ // change in a textfield.
+ _this.selector.find(".Ldt-createAnnotation-Description").trigger("js_mod");
+ // also call our update function.
+ _this.handleTextChanges();
+ }
+ }(polemic));
+ }
this.selector.find(".Ldt-createAnnotation-Description")
.bind("propertychange keyup input paste", IriSP.wrap(this, this.handleTextChanges));
@@ -2699,6 +2820,7 @@
code = {start: annotation.begin / 1000, end: annotation.end / 1000,
onStart: function(annotation) { return function() {
+ console.log("runned ?", annotation);
if (typeof(annotation.content) !== "undefined")
_this.selector.find(".Ldt-createAnnotation-Title").html(annotation.content.title);
@@ -2716,9 +2838,20 @@
this.selector.find(".Ldt-createAnnotation-submitButton").click(IriSP.wrap(this, this.handleButtonClick));
- if (!this.cinecast_version)
+ if (!this.cinecast_version) {
this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked",
- IriSP.wrap(this, this.handleAnnotateSignal));
+ IriSP.wrap(this, this.handleAnnotateSignal));
+
+ // handle clicks on the cancel button too.
+ this.selector.find(".Ldt-createAnnotation-Minimize").click(IriSP.wrap(this,
+ function() {
+ // we've got to simulate the pressing of the button because there's no
+ // other way to minimize the widget and show the widgets that were hidden
+ // same time
+ this._Popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked");
+ }
+ ));
+ }
};
/** handles clicks on the annotate button. Works only for the non-cinecast version */
@@ -2757,6 +2890,14 @@
this._Popcorn.trigger("IriSP.SliceWidget.position", [left, width]);
this._Popcorn.listen("IriSP.SliceWidget.zoneChange", IriSP.wrap(this, this.handleSliderChanges));
this._Popcorn.trigger("IriSP.SliceWidget.show");
+
+ this.selector.find(".Ldt-createAnnotation-Title").html(currentChapter.content.title);
+
+ this._currentcurrentChapter = currentChapter;
+ var beginTime = IriSP.msToTime(currentChapter.begin);
+ var endTime = IriSP.msToTime(currentChapter.end);
+ var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime });
+ this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate);
}
};
@@ -2782,6 +2923,20 @@
}
}
}
+
+ if (this.polemic_mode) {
+ /* Also go through the polemics to highlight the buttons */
+ for (var polemic in this.polemics) {
+ /* Add the active class to the button */
+ var classname = "Ldt-createAnnotation-polemic-" + this.polemics[polemic];
+ if (contents.indexOf(polemic) != -1) {
+ this.selector.find("." + classname).addClass("Ldt-createAnnotation-polemic-active");
+ } else {
+ if (this.selector.find("." + classname).addClass("Ldt-createAnnotation-polemic-active"))
+ this.selector.find("." + classname).removeClass("Ldt-createAnnotation-polemic-active")
+ }
+ }
+ }
};
IriSP.createAnnotationWidget.prototype.showStartScreen = function() {
@@ -2802,7 +2957,7 @@
this.selector.find(".Ldt-createAnnotation-Title").parent().show();
}
- var url = document.location.href + "id=" + annotation.id;
+ var url = document.location.href + "#id=" + annotation.id;
var twStatus = IriSP.mkTweetUrl(url);
var gpStatus = IriSP.mkGplusUrl(url);
var fbStatus = IriSP.mkFbUrl(url);