Adaptation for streamer bug on Ldt Platform new-model
authorveltr
Wed, 11 Jul 2012 18:22:57 +0200
branchnew-model
changeset 926 e47ed8eb75cd
parent 925 28efc97b5d78
child 927 977a39c4ee80
Adaptation for streamer bug on Ldt Platform
src/js/defaults.js
src/js/init.js
src/widgets/Segments.js
src/widgets/Trace.js
test/index.htm
test/jwplayer.htm
--- a/src/js/defaults.js	Fri Jul 06 18:13:32 2012 +0200
+++ b/src/js/defaults.js	Wed Jul 11 18:22:57 2012 +0200
@@ -44,7 +44,10 @@
     Trace : {
         noCss: true,
         requires: "tracemanager"
-    }
+    },
+    SlideShare: {
+        requires: "swfObject"
+    } 
 }
 
 IriSP.guiDefaults = {
--- a/src/js/init.js	Fri Jul 06 18:13:32 2012 +0200
+++ b/src/js/init.js	Wed Jul 11 18:22:57 2012 +0200
@@ -236,7 +236,10 @@
             var opts = IriSP.jQuery.extend({}, this.config.player);
             delete opts.container;
             delete opts.type;
-            if (typeof opts.streamer !== "undefined") {
+            if (typeof opts.streamer === "function") {
+                opts.streamer = opts.streamer(opts.video);
+            }
+            if (typeof opts.streamer === "string") {
                 opts.video = opts.video.replace(opts.streamer,"");
             }
             opts.file = opts.video;
--- a/src/widgets/Segments.js	Fri Jul 06 18:13:32 2012 +0200
+++ b/src/widgets/Segments.js	Wed Jul 11 18:22:57 2012 +0200
@@ -41,7 +41,7 @@
                 _center = _left + _width / 2,
                 _fulltext = _annotation.title + ( _annotation.description ? ( '<br/>' + _annotation.description ) : '' );
             return {
-                text : _fulltext.replace(/(^.{120,140})[\s].+$/,'$1&hellip;'),
+                text : _fulltext.replace(/(^.{120,140})[\s].+$/m,'$1&hellip;'),
                 color : ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.colors[_k % _this.colors.length] ),
                 beginseconds : _annotation.begin.getSeconds() ,
                 left : Math.floor( _left ),
--- a/src/widgets/Trace.js	Fri Jul 06 18:13:32 2012 +0200
+++ b/src/widgets/Trace.js	Wed Jul 11 18:22:57 2012 +0200
@@ -10,7 +10,8 @@
     url: "http://traces.advene.org:5000/",
     requestmode: 'GET',
     syncmode: "sync",
-    default_subject: "IRI"
+    default_subject: "IRI",
+    tracer: null
 }
 
 IriSP.Widgets.Trace.prototype.draw = function() {
@@ -47,13 +48,18 @@
         _this.player.popcorn.listen(_listener, _f);
     });
     
-    this.tracer = window.tracemanager.init_trace("test", {
-        url: this.url,
-        requestmode: this.requestmode,
-        syncmode: this.syncmode,
-        default_subject: this.default_subject
-    });
-    this.tracer.trace("StartTracing", {});
+    if (!this.tracer) {
+    
+        this.tracer = window.tracemanager.init_trace("test", {
+            url: this.url,
+            requestmode: this.requestmode,
+            syncmode: this.syncmode,
+            default_subject: this.default_subject
+        });
+    
+    }
+    
+    this.tracer.trace("TraceWidgetInit", {});
     
     this.mouseLocation = '';
     IriSP.jQuery(".Ldt-Widget").bind("click mouseover mouseout", function(_e) {
--- a/test/index.htm	Fri Jul 06 18:13:32 2012 +0200
+++ b/test/index.htm	Wed Jul 11 18:22:57 2012 +0200
@@ -12,7 +12,8 @@
         <h1>Metadataplayer test configurations</h1>
         <ul class="pageindex">
             <li><h2><a href="jwplayer.htm">with JwPlayer (default on Ldt Platform, uses custom player functions)</a></h2></li>
-            <li><h2><a href="oggvideo.htm">with HTML5/OGG (uses Popcorn.js)</a></h2></li>
+            <li><h2><a href="oggvideo.htm">with HTML5/OGG (uses Popcorn.js, compatible with Firefox and Chrome)</a></h2></li>
+            <li><h2><a href="mp4video.htm">with HTML5/MP4 (uses Popcorn.js, compatible with IE, Safari and Chrome)</a></h2></li>
             <li><h2><a href="youtube.htm">with Youtube (uses Popcorn.js and the Popcorn Youtube plugin/player)</a></h2></li>
             <li><h2><a href="dailymotion.htm">with Dailymotion (uses custom player functions)</a></h2></li>
         </ul>
--- a/test/jwplayer.htm	Fri Jul 06 18:13:32 2012 +0200
+++ b/test/jwplayer.htm	Wed Jul 11 18:22:57 2012 +0200
@@ -20,7 +20,8 @@
     IriSP.language = 'fr';
     IriSP.widgetsDir = "metadataplayer";
     var _metadata = {
-        url: 'json/ldt-jwplayer.json',
+//        url: 'json/ldt-jwplayer.json',
+        url: 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/cljson/id/5a893570-ca73-11e1-9443-00145ea4a2be?callback=?',
         format: 'ldt'
     };
     var _config = {            
@@ -67,6 +68,14 @@
             height: 350, 
             width: 550, 
             provider: "rtmp",
+            streamer: function(_url) {
+                var _matches = _url.match(/^[^\/]+\/\/[^\/]+\/[^\/]+\//);
+                if (_matches) {
+                    return _matches[0];
+                } else {
+                    return _url;
+                }
+            },
             autostart: true,
             metadata: _metadata
         }