Added Vimeo Support new-model
authorveltr
Thu, 30 Aug 2012 12:51:04 +0200
branchnew-model
changeset 941 1e64e46a954f
parent 940 9698ad710824
child 942 30f650574bca
Added Vimeo Support
src/js/init.js
src/widgets/Renkan.js
test/ext-trace.htm
test/index.htm
test/json/ldt-vimeo.json
test/vimeo.htm
--- a/src/js/init.js	Wed Aug 29 18:55:55 2012 +0200
+++ b/src/js/init.js	Thu Aug 30 12:51:04 2012 +0200
@@ -183,6 +183,7 @@
         _types = {
             "html5" : /\.(ogg|ogv|webm)$/,
             "youtube" : /^(https?:\/\/)?(www\.)?youtube\.com/,
+            "vimeo" : /^(https?:\/\/)?(www\.)?vimeo\.com/,
             "dailymotion" : /^(https?:\/\/)?(www\.)?dailymotion\.com/
         };
     
@@ -276,6 +277,15 @@
             _pop = Popcorn.youtube("#" + containerDiv, _url);
             break;
 
+        case "vimeo":
+            // Popcorn.vimeo wants us to specify the size of the player in the style attribute of its container div.
+            IriSP.jQuery("#" + containerDiv).css({
+                width : this.config.player.width + "px",
+                height : this.config.player.height + "px"
+            });
+            _pop = Popcorn.vimeo("#" + containerDiv, this.config.player.video);
+            break;
+            
         case "dailymotion":
             _pop = new IriSP.PopcornReplacement.dailymotion("#" + containerDiv, this.config.player);
             break;
--- a/src/widgets/Renkan.js	Wed Aug 29 18:55:55 2012 +0200
+++ b/src/widgets/Renkan.js	Thu Aug 30 12:51:04 2012 +0200
@@ -38,6 +38,15 @@
                 return _ann.getMedia().id == _annmatch[1] && _ann.id == _annmatch[2];
             });
             _annotations.forEach(function(_ann) {
+                var _duration = _ann.getDuration(),
+                    _preroll = + ( _duration < _this.min_duration ) * ( _this.min_duration / 2);
+                var _nt = {
+                    selected: false,
+                    node: _node,
+                    begin: _ann.begin - _preroll,
+                    end: _ann.end + _preroll
+                }
+                _this.node_times.push(_nt);
                 _ann.on("select", function(_stop) {
                     if (!_stop) {
                         _node.trigger("select",true);
@@ -54,6 +63,7 @@
                     }
                 });
                 _node.on("unselect", function(_stop) {
+                    _nt.selected = false;
                     if (!_stop) {
                         _ann.trigger("unselect",true);
                     }
@@ -62,14 +72,6 @@
                     _this.player.popcorn.currentTime(_ann.begin.getSeconds());
                     _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToAnnotation", _ann.id);
                 });
-                var _duration = _ann.getDuration(),
-                    _preroll = + ( _duration < _this.min_duration ) * ( _this.min_duration / 2);
-                _this.node_times.push({
-                    selected: false,
-                    node: _node,
-                    begin: _ann.begin - _preroll,
-                    end: _ann.end + _preroll
-                });
             });
         }
         var _tagmatch = _uri.match(_this.tag_regexp);
@@ -98,7 +100,6 @@
             }
         } else {
             if (_nt.selected) {
-                _nt.selected = false;
                 _nt.node.trigger("unselect", true);
             }
         }
--- a/test/ext-trace.htm	Wed Aug 29 18:55:55 2012 +0200
+++ b/test/ext-trace.htm	Thu Aug 30 12:51:04 2012 +0200
@@ -53,7 +53,7 @@
                 { type: "Annotation" },
                 {
                     type: "CreateAnnotation",
-                    api_endpoint_template: "http://ubuntu/pf/ldtplatform/api/ldt/annotations/{{id}}.json",
+                    api_endpoint_template: "http://capsicum/pf/ldtplatform/api/ldt/annotations/{{id}}.json",
                     creator_name: "Metadataplayer",
                     creator_avatar: "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png",
                     tag_titles: ["#amateur", "#digital-humanities"]
--- a/test/index.htm	Wed Aug 29 18:55:55 2012 +0200
+++ b/test/index.htm	Thu Aug 30 12:51:04 2012 +0200
@@ -15,6 +15,7 @@
             <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="vimeo.htm">with Vimeo (uses Popcorn.js and the Popcorn Vimeo plugin/player)</a></h2></li>
             <li><h2><a href="dailymotion.htm">with Dailymotion (uses custom player functions)</a></h2></li>
         </ul>
     </body>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/json/ldt-vimeo.json	Thu Aug 30 12:51:04 2012 +0200
@@ -0,0 +1,183 @@
+{
+    "views": [
+        {
+            "id": "v_0A5EA02B-90DA-EB8E-FCFE-7709E74314BB",
+            "contents": ["fcc5301c-f289-11e1-a3d6-08002791f1b7"],
+            "annotation_types": ["c_0e9fb3c0-f28a-11e1-955e-08002791f1b7", "c_0ea02ada-f28a-11e1-955e-08002791f1b7"]
+        }, {
+            "meta": {
+                "stat": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
+            },
+            "id": "stat",
+            "contents": ["fcc5301c-f289-11e1-a3d6-08002791f1b7"]
+        }
+    ],
+    "tags": null,
+    "lists": [
+        {
+            "items": [
+                {
+                    "id-ref": "c_0e9fb3c0-f28a-11e1-955e-08002791f1b7"
+                }, {
+                    "id-ref": "c_0ea02ada-f28a-11e1-955e-08002791f1b7"
+                }
+            ],
+            "meta": {
+                "dc:contributor": "undefined",
+                "dc:created": "2012-08-30T10:22:50.136571",
+                "dc:creator": "undefined",
+                "id-ref": "fcc5301c-f289-11e1-a3d6-08002791f1b7",
+                "dc:title": "Découpages personnels",
+                "editable": "false",
+                "dc:modified": "2012-08-30T10:22:50.136571",
+                "dc:description": ""
+            },
+            "id": "g_0e9f2cac-f28a-11e1-955e-08002791f1b7"
+        }
+    ],
+    "medias": [
+        {
+            "origin": "0",
+            "url": "http://vimeo.com/40855651",
+            "http://advene.liris.cnrs.fr/ns/frame_of_reference/ms": "o=0",
+            "meta": {
+                "dc:contributor": "IRI",
+                "item": {
+                    "name": "streamer",
+                    "value": ""
+                },
+                "dc:created": "2012-08-30T10:04:16.143040",
+                "dc:duration": 1042000,
+                "dc:creator": "IRI",
+                "dc:created.contents": "2012-08-30",
+                "dc:title": "Ars Industrialis - Travail et Emploi",
+                "dc:creator.contents": "IRI",
+                "dc:modified": "2012-08-30T10:04:16.422413",
+                "dc:description": "Montage Simon Lincelles"
+            },
+            "id": "fcc5301c-f289-11e1-a3d6-08002791f1b7",
+            "unit": "ms"
+        }
+    ],
+    "meta": {
+        "dc:contributor": "admin",
+        "dc:created": "2012-08-30T10:04:16.159226",
+        "dc:creator": "admin",
+        "main_media": {
+            "id-ref": "fcc5301c-f289-11e1-a3d6-08002791f1b7"
+        },
+        "dc:description": "",
+        "dc:title": "front project : Ars Industrialis - Travail et Emploi",
+        "id": "0e907b30-f28a-11e1-955e-08002791f1b7",
+        "dc:modified": "2012-08-30T10:19:37.473399"
+    },
+    "annotations": [
+        {
+            "content": {
+                "mimetype": "application/x-ldt-structured",
+                "description": "Première partie",
+                "img": {
+                    "src": ""
+                },
+                "title": "A 1",
+                "color": "16763904",
+                "polemics": [],
+                "audio": {
+                    "mimetype": "audio/mp3",
+                    "src": "",
+                    "href": null
+                }
+            },
+            "begin": 0,
+            "meta": {
+                "dc:contributor": "perso",
+                "id-ref": "c_0e9fb3c0-f28a-11e1-955e-08002791f1b7",
+                "dc:created": "2012-08-30T10:22:50.136634",
+                "dc:modified": "2012-08-30T10:22:50.136634",
+                "dc:creator": "perso"
+            },
+            "end": 351792,
+            "tags": null,
+            "color": "16763904",
+            "media": "fcc5301c-f289-11e1-a3d6-08002791f1b7",
+            "id": "s_520832CB-C992-A189-0086-770A103763EC"
+        }, {
+            "content": {
+                "mimetype": "application/x-ldt-structured",
+                "description": "Deuxième partie",
+                "img": {
+                    "src": ""
+                },
+                "title": "B 2",
+                "color": "16763904",
+                "polemics": [],
+                "audio": {
+                    "mimetype": "audio/mp3",
+                    "src": "",
+                    "href": null
+                }
+            },
+            "begin": 353130,
+            "meta": {
+                "dc:contributor": "perso",
+                "id-ref": "c_0e9fb3c0-f28a-11e1-955e-08002791f1b7",
+                "dc:created": "2012-08-30T10:22:50.136634",
+                "dc:modified": "2012-08-30T10:22:50.136634",
+                "dc:creator": "perso"
+            },
+            "end": 687533,
+            "tags": null,
+            "color": "16763904",
+            "media": "fcc5301c-f289-11e1-a3d6-08002791f1b7",
+            "id": "s_30F09F49-23C6-37CC-D21F-770A1FEE49D9"
+        }, {
+            "content": {
+                "mimetype": "application/x-ldt-structured",
+                "description": "Troisième partie",
+                "img": {
+                    "src": ""
+                },
+                "title": "C 3",
+                "color": "16763904",
+                "polemics": [],
+                "audio": {
+                    "mimetype": "audio/mp3",
+                    "src": "",
+                    "href": null
+                }
+            },
+            "begin": 688870,
+            "meta": {
+                "dc:contributor": "perso",
+                "id-ref": "c_0e9fb3c0-f28a-11e1-955e-08002791f1b7",
+                "dc:created": "2012-08-30T10:22:50.136634",
+                "dc:modified": "2012-08-30T10:22:50.136634",
+                "dc:creator": "perso"
+            },
+            "end": 1042000,
+            "tags": null,
+            "color": "16763904",
+            "media": "fcc5301c-f289-11e1-a3d6-08002791f1b7",
+            "id": "s_7D9EBBC1-7E97-E3D0-7BA9-770A308283B7"
+        }
+    ],
+    "annotation-types": [
+        {
+            "dc:contributor": "perso",
+            "dc:creator": "perso",
+            "dc:title": "chapitrage",
+            "id": "c_0e9fb3c0-f28a-11e1-955e-08002791f1b7",
+            "dc:created": "2012-08-30T10:22:50.136634",
+            "dc:description": "",
+            "dc:modified": "2012-08-30T10:22:50.136634"
+        }, {
+            "dc:contributor": "perso",
+            "dc:creator": "perso",
+            "dc:title": "contributions",
+            "id": "c_0ea02ada-f28a-11e1-955e-08002791f1b7",
+            "dc:created": "2012-08-30T10:22:50.138056",
+            "dc:description": "",
+            "dc:modified": "2012-08-30T10:22:50.138056"
+        }
+    ]
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/vimeo.htm	Thu Aug 30 12:51:04 2012 +0200
@@ -0,0 +1,21 @@
+<!doctype html>
+<html>
+
+    <head>
+        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+        <title>Metadataplayer test with Dailymotion</title>
+        <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
+        <link href='test.css' rel='stylesheet' type='text/css'>
+        <script type="text/javascript" src="metadataplayer/LdtPlayer-core.js" type="text/javascript"></script>
+        <script type="text/javascript" src="test-config.js" type="text/javascript"></script>
+    </head>
+
+    <body>
+        <h1>Metadataplayer test with Dailymotion</h1>
+        <div id="LdtPlayer"></div>
+        <div id="AnnotationsListContainer"></div>
+        <script type="text/javascript">
+            testConfig('json/ldt-vimeo.json', true);
+        </script>
+    </body>
+</html>