# HG changeset patch # User veltr # Date 1326905095 -3600 # Node ID 499d9693d066f539269404b21641edacb9a1abf9 # Parent 82a5ebbedc830af9eb023693ed8807ac7609ee11# Parent 835f5f454595a1097dc0cef85b987541c3b707ac Merge with 835f5f454595a1097dc0cef85b987541c3b707ac diff -r 82a5ebbedc83 -r 499d9693d066 doc/implementer-un-player.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/implementer-un-player.txt Wed Jan 18 17:44:55 2012 +0100 @@ -0,0 +1,14 @@ +API qu'un player doit implémenter pour espérer être supporté facilement par le +metadataplayer : + +En gros, il faut une api similaire à celle du jwplayer +(cf : http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12540/javascript-api-reference). +Cependant on n'a besoin que des fonctions suivantes : +- play, pause, seek, getMute, setMute, getPosition, seek + +On a également besoin des évenements suivants : +- onReady quand le lecteur a fini d'être initialisé +- onTime declenché à chaque fois que le player change d'image +- onPlay declenché quand la lecture de la vidéo commence +- onPause declenché quand la vidéo est mise sur pause +- onSeek declenché quand l'utilisateur seek \ No newline at end of file diff -r 82a5ebbedc83 -r 499d9693d066 src/js/serializers/JSONSerializer.js --- a/src/js/serializers/JSONSerializer.js Wed Jan 18 17:40:14 2012 +0100 +++ b/src/js/serializers/JSONSerializer.js Wed Jan 18 17:44:55 2012 +0100 @@ -92,22 +92,23 @@ /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either null or undefined. */ - var view; - - if (typeof(this._data.views) !== "undefined" && this._data.views !== null) - view = this._data.views[0]; + + var searchViewType = this.getTweets(); + if (typeof(searchViewType) === "undefined") { + var view; + + if (typeof(this._data.views) !== "undefined" && this._data.views !== null) + view = this._data.views[0]; - var searchViewType = ""; - - if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { - searchViewType = view.annotation_types[0]; + if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { + searchViewType = view.annotation_types[0]; + } } - var filterfn = function(annotation) { if( searchViewType != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined" && - annotation.meta["id-ref"] !== searchViewType) { + annotation.meta["id-ref"] === searchViewType) { return false; // pass } else { return true; diff -r 82a5ebbedc83 -r 499d9693d066 src/js/site.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/js/site.js Wed Jan 18 17:44:55 2012 +0100 @@ -0,0 +1,78 @@ +/* site.js - all our site-dependent config : player chrome, cdn locations, etc...*/ + +IriSP.libdir = "/mdp/src/js/libs/"; +IriSP.jwplayer_swf_path = "/mdp/test/libs/player.swf"; +IriSP.platform_url = "http://localhost/pf"; + +IriSP.lib = { + jQuery : "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js", + jQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js", + jQueryToolTip : "http://cdn.jquerytools.org/1.2.4/all/jquery.tools.min.js", + swfObject : "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js", + cssjQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css", + popcorn : IriSP.libdir + "popcorn.js", + jwplayer : IriSP.libdir + "jwplayer.js", + popcornReplacement: IriSP.libdir + "pop.js", + raphael: IriSP.libdir + "raphael.js", + jquery_sparkline: IriSP.libdir + "jquery.sparkline.js", + "popcorn.mediafragment" : IriSP.libdir + "popcorn.mediafragment.js", + "popcorn.code" : IriSP.libdir + "popcorn.code.js", + "popcorn.jwplayer": IriSP.libdir + "popcorn.jwplayer.js", + "popcorn.youtube": IriSP.libdir + "popcorn.youtube.js" +}; + +//Configuration for the player and utility functions. +IriSP.config = {}; + +IriSP.config.shortener = { + // function to call to shorten an url. + //shortening_function : IriSP.platform_shorten_url +}; + +IriSP.widgetsDefaults = { + "LayoutManager" : {spacer_div_height : "0px" }, + "PlayerWidget" : {}, + "AnnotationsWidget": { + "share_text" : "I'm watching ", + "fb_link" : "http://www.facebook.com/share.php?u=", + "tw_link" : "http://twitter.com/home?status=", + "gplus_link" : "" + }, + "TweetsWidget" : { + default_profile_picture : "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png", + tweet_display_period: 10000, // how long do we show a tweet ? + + }, + "SliderWidget" : { + minimize_period: 850 // how long does the slider stays maximized after the user leaves the zone ? + }, + "createAnnotationWidget" : { + keywords: ["#faux-raccord", "#mot-clef"], + cinecast_version: true /* put to false to enable the platform version, true for the festival cinecast one. */ + }, + "SparklineWidget" : { + column_width: 10 // the width of a column in pixels. + }, + "Main" : { + autoplay: true + } + "AnnotationsListWidget" : { + ajax_mode: true, /* use ajax to get information about the annotations. + if set to false, only search in the annotations for the + current project. */ + ajax_url: IriSP.platform_url + "ldtplatform/api/ldt/segments/" /* partial + url of + where to + get the + ajax */ + }, +}; + +IriSP.paths = { +// "imgs": "/tweetlive/res/metadataplayer/src/css/imgs" + "imgs": "/mdp/src/css/imgs" +}; +IriSP.default_templates_vars = { + "img_dir" : IriSP.paths.imgs +}; + diff -r 82a5ebbedc83 -r 499d9693d066 src/js/site.js.templ --- a/src/js/site.js.templ Wed Jan 18 17:40:14 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* EDIT THIS FILE AND RENAME IT TO site.js TO BUILD THE METADATAPLAYER - site.js - all our site-dependent config : player chrome, cdn locations, etc...*/ - -IriSP.libdir = "/mdp/src/js/libs/"; -IriSP.jwplayer_swf_path = "http://localhost/mdp/test/libs/player.swf"; - -IriSP.lib = { - jQuery : "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js", - jQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js", - jQueryToolTip : "http://cdn.jquerytools.org/1.2.4/all/jquery.tools.min.js", - swfObject : "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js", - cssjQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css", - popcorn : IriSP.libdir + "popcorn.js", - jwplayer : IriSP.libdir + "jwplayer.js", - popcornReplacement: IriSP.libdir + "pop.js", - raphael: IriSP.libdir + "raphael.js", - jquery_sparkline: IriSP.libdir + "jquery.sparkline.js", - "popcorn.mediafragment" : IriSP.libdir + "popcorn.mediafragment.js", - "popcorn.code" : IriSP.libdir + "popcorn.code.js", - "popcorn.jwplayer": IriSP.libdir + "popcorn.jwplayer.js", - "popcorn.youtube": IriSP.libdir + "popcorn.youtube.js" -}; - -//Player Configuration -IriSP.config = undefined; - -IriSP.widgetsDefaults = { - "LayoutManager" : {spacer_div_height : "0px" }, - "PlayerWidget" : {}, - "AnnotationsWidget": { - "share_text" : "I'm watching ", - "fb_link" : "http://www.facebook.com/share.php?u=", - "tw_link" : "http://twitter.com/home?status=", - "gplus_link" : "" - }, - "TweetsWidget" : { - default_profile_picture : "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png", - tweet_display_period: 10000 // how long do we show a tweet ? - }, - "SliderWidget" : { - minimize_period: 850 // how long does the slider stays maximized after the user leaves the zone ? - }, - "createAnnotationWidget" : { - keywords: ["#faux-raccord", "#mot-clef"], - cinecast_version: true /* put to false to enable the platform version, true for the festival cinecast one. */ - }, - "SparkLineWidget" : { - column_width: 10 // the width of a column in pixels. - }, - "Main" : { - autoplay: true - } - -}; - -/* ! Must not end with a trailing slash */ -IriSP.platform_url = "http://localhost/pf/"; - -IriSP.paths = { - "imgs": "/mdp/src/css/imgs" -}; -IriSP.default_templates_vars = { - "img_dir" : IriSP.paths.imgs -}; - diff -r 82a5ebbedc83 -r 499d9693d066 src/js/widgets/annotationsListWidget.js --- a/src/js/widgets/annotationsListWidget.js Wed Jan 18 17:40:14 2012 +0100 +++ b/src/js/widgets/annotationsListWidget.js Wed Jan 18 17:44:55 2012 +0100 @@ -2,6 +2,8 @@ IriSP.Widget.call(this, Popcorn, config, Serializer); this.__counter = 0; this.__oldList = []; + + this.ajax_mode = IriSP.widgetsDefaults["AnnotationsListWidget"].ajax_mode; }; @@ -22,7 +24,7 @@ /** draw the annotation list */ IriSP.AnnotationsListWidget.prototype.drawList = function(force_redraw) { var _this = this; - + var view_type = this._serializer.getContributions(); var annotations = this._serializer._data.annotations; var currentTime = this._Popcorn.currentTime(); @@ -88,10 +90,20 @@ }; +IriSP.AnnotationsListWidget.prototype.ajaxRedraw = function(timecode) { + var pre_url = IriSP.widgetsDefaults["AnnotationsListWidget"].ajax_url; + var templ = "{{pre_url}}/{{content_id}}/{{begin_timecode}}/{{end_timecode}}/"; +}; + IriSP.AnnotationsListWidget.prototype.draw = function() { this.drawList(); - this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", IriSP.wrap(this, function() { this.drawList(true); })); + + if (!this._ajax_mode) { + this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", IriSP.wrap(this, function() { this.drawList(true); })); + } else { + this._Popcorn.listen("IriSP.StackGraphWidget.mouseOver", IriSP.wrap(this, this.ajaxRedraw)); + } this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.redraw)); }; diff -r 82a5ebbedc83 -r 499d9693d066 src/js/widgets/arrowWidget.js --- a/src/js/widgets/arrowWidget.js Wed Jan 18 17:40:14 2012 +0100 +++ b/src/js/widgets/arrowWidget.js Wed Jan 18 17:44:55 2012 +0100 @@ -29,7 +29,9 @@ return; var currentTime = this._Popcorn.currentTime(); - var currentAnnotation = this._serializer.currentAnnotations(currentTime)[0]; // FIXME : use the others ? + var currentAnnotation = this._serializer.currentChapitre(currentTime); + if (IriSP.null_or_undefined(currentAnnotation)) + var currentAnnotation = this._serializer.currentAnnotation(currentTime)[0]; // FIXME : use the others ? /* move the arrow only if the current annotation changes */ if (currentAnnotation != this._oldAnnotation) { @@ -43,7 +45,7 @@ // we need to apply a fix because the arrow has a certain length // it's half the length of the arrow (27 / 2). We need to convert // it in percents though. - var totalWidth = this.selector.width(); + var totalWidth = this.selector.width(); var pixels = percents * totalWidth; var correction = (27 / 2); var corrected_pixels = pixels - correction; diff -r 82a5ebbedc83 -r 499d9693d066 src/js/widgets/stackGraphWidget.js --- a/src/js/widgets/stackGraphWidget.js Wed Jan 18 17:40:14 2012 +0100 +++ b/src/js/widgets/stackGraphWidget.js Wed Jan 18 17:44:55 2012 +0100 @@ -161,6 +161,13 @@ }) .mousemove(function(_e) { _this.updateTooltip(_e); + + // Also tell the world where the mouse is hovering. + var relX = event.pageX - this.selector.offset().left; + var duration = this._serializer.currentMedia().meta["dc:duration"]; + var Time = ((relX / _this.width) * duration).toFixed(2); + _this._Popcorn.trigger("IriSP.StackGraphWidget.mouseOver", Time); + }) .mouseout(function() { _this.TooltipWidget.hide(); diff -r 82a5ebbedc83 -r 499d9693d066 test/integration/polemic-platform.htm --- a/test/integration/polemic-platform.htm Wed Jan 18 17:40:14 2012 +0100 +++ b/test/integration/polemic-platform.htm Wed Jan 18 17:44:55 2012 +0100 @@ -23,13 +23,13 @@