# HG changeset patch # User hamidouk # Date 1328785777 -3600 # Node ID 7f0a19cf1d3d7b953483c4483f6710f8d3fdfd15 # Parent 0e27f37afd2fd2a73dbae3453f7f741892985735# Parent 96ca8ff7d7cc959300fcb43d7ae54778f001ad77 Merge with upstream diff -r 96ca8ff7d7cc -r 7f0a19cf1d3d src/ldt/ldt/static/ldt/css/imgs/user_default_icon.png Binary file src/ldt/ldt/static/ldt/css/imgs/user_default_icon.png has changed diff -r 96ca8ff7d7cc -r 7f0a19cf1d3d src/ldt/ldt/static/ldt/css/imgs/video_sequence.png Binary file src/ldt/ldt/static/ldt/css/imgs/video_sequence.png has changed diff -r 96ca8ff7d7cc -r 7f0a19cf1d3d src/ldt/ldt/static/ldt/js/LdtPlayer-release.js --- a/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Thu Feb 09 11:48:48 2012 +0100 +++ b/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Thu Feb 09 12:09:37 2012 +0100 @@ -1090,7 +1090,7 @@ IriSP.annotation_template = "{{! template for an annotation displayed in a segmentWidget }}
"; IriSP.annotationWidget_template = "{{! template for the annotation widget }}
"; IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}
 
Chargement...
"; -IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}
"; +IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}
"; IriSP.arrowWidget_template = "
"; IriSP.createAnnotationWidget_template = "{{! template for the annotation creation widget }}
{{^cinecast_version}}
{{/cinecast_version}}
{{^user_avatar}} {{/user_avatar}} {{#user_avatar}} {{/user_avatar}}
Submit
Add keywords :
{{#polemic_mode}}
Add polemic keywords
{{/polemic_mode}}
"; IriSP.createAnnotationWidget_festivalCinecast_template = "{{! template for the annotation creation widget specific for the cinecast festival}}
Add keywords :
Submit
"; @@ -1731,17 +1731,22 @@ "imgs": "/mdp/src/css/imgs" }; -IriSP.user = { - "name" : "loic", - "avatar" : "http://a1.twimg.com/profile_images/39270812/loicempuria_normal.jpg" -}; - IriSP.defaults.default_templates_vars = function() { return { "img_dir" : IriSP.paths.imgs }; } +/* +Override this if you want to change the info the player receives about the user. +It's typically overrided in server-side templates with user-specific data. +*/ +IriSP.defaults.user = function() { + return { + "name" : "Anonymous user", + "avatar" : IriSP.paths.imgs + "/user_default_icon.png" + } +}; /* the widget classes and definitions */ /** @@ -2056,7 +2061,9 @@ /** configure modules. @see configureWidgets */ IriSP.configureModules = function (popcornInstance, modulesList) { - + if (IriSP.null_or_undefined(modulesList)) + return; + var serialFactory = new IriSP.SerializerFactory(IriSP.__dataloader); var ret_modules = []; var index; @@ -2145,6 +2152,11 @@ IriSP.paths = IriSP.underscore.defaults(IriSP.paths, IriSP.defaults.paths); IriSP.default_templates_vars = IriSP.underscore.defaults(IriSP.default_templates_vars, IriSP.defaults.default_templates_vars()); + + if (IriSP.null_or_undefined(IriSP.user)) + IriSP.user = {}; + + IriSP.user = IriSP.underscore.defaults(IriSP.user, IriSP.defaults.user()); }; /** single point of entry for the metadataplayer */ @@ -2165,31 +2177,62 @@ /** jwplayer player wrapper */ IriSP.PopcornReplacement.dailymotion = function(container, options) { + console.log("Calling"); /* appel du parent pour initialiser les structures communes à tous les players */ - IriSP.PopcornReplacement.player.call(this, container, options); - + IriSP.PopcornReplacement.player.call(this, container, options); + var _this = this; /* Définition des fonctions de l'API - */ this.playerFns = { play : function() { - return _this.player.playVideo(); + if (_this.player) { + return _this.player.playVideo(); + } else { + console.log("Play on undefined player"); + return false; + } }, pause : function() { - return _this.player.pauseVideo(); + if (_this.player) { + return _this.player.pauseVideo(); + } else { + console.log("Pause on undefined player"); + return false; + } }, getPosition : function() { - return _this.player.getCurrentTime(); + if (_this.player) { + return _this.player.getCurrentTime(); + } else { + console.log("getPosition on undefined player"); + return 0; + } }, seek : function(pos) { - return _this.player.seekTo(pos); + if (_this.player) { + return _this.player.seekTo(pos); + } else { + console.log("seek on undefined player"); + return false; + } }, getMute : function() { - return _this.player.isMuted(); + if (_this.player) { + return _this.player.isMuted(); + } else { + console.log("getMute on undefined player"); + return false; + } }, setMute : function(p) { - return p ? _this.player.mute() : _this.player.unMute(); + if (_this.player) { + return p ? _this.player.mute() : _this.player.unMute(); + } else { + console.log("setMute on undefined player"); + return false; + } } } @@ -2198,7 +2241,8 @@ window.onDailymotionVideoProgress = IriSP.wrap(this, this.progressHandler); var params = { - allowScriptAccess : "always" + "allowScriptAccess" : "always", + "wmode": "opaque" }; var atts = { id : this.container @@ -2215,7 +2259,9 @@ this.player.addEventListener("onStateChange", "onDailymotionStateChange"); this.player.addEventListener("onVideoProgress", "onDailymotionVideoProgress"); - this.player.loadVideoByUrl(this._options.video); + this.player.cueVideoByUrl(this._options.video); + + this.callbacks.onReady(); }; IriSP.PopcornReplacement.dailymotion.prototype.progressHandler = function(progressInfo) { @@ -2237,16 +2283,19 @@ break; case 3: - this.callbacks.onSeek(); + this.callbacks.onSeek({ + position: this.player.getCurrentTime() + }); break; + /* case 5: this.callbacks.onReady(); break; + */ } -}; -/* To wrap a player the develop should create a new class derived from +};/* To wrap a player the develop should create a new class derived from the IriSP.PopcornReplacement.player and defining the correct functions */ /** jwplayer player wrapper */ @@ -4668,9 +4717,16 @@ var duration = +this._serializer.currentMedia().meta["dc:duration"]; var time_step = Math.round(duration / num_columns); /* the time interval between two columns */ var begin = +annotation.begin; - - var index = Math.floor(begin / time_step); - this._results[index]++; + var end = +annotation.end; + + /* increment all the values between the beginning and the end of the annotation */ + var index_begin = Math.floor(begin / time_step); + var index_end = Math.floor(end / time_step); + + for (var i = index_begin; i < Math.min(index_end, this._results.length); i++) { + this._results[i]++; + } + this.selector.find(".Ldt-sparkLine").sparkline(this._results, {lineColor: "#7492b4", fillColor: "#aeaeb8", spotColor: "#b70056", width: this.width, height: this.height});