The embed player can now play a youtube video.
authorcavaliet
Fri, 13 Jan 2012 16:13:03 +0100
changeset 377 a1f9f7583925
parent 376 de5a44f597e9
child 381 af6e95605934
The embed player can now play a youtube video.
src/ldt/ldt/ldt_utils/projectserializer.py
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html
src/ldt/ldt/ldt_utils/views/front.py
src/ldt/ldt/static/ldt/css/front_home.css
--- a/src/ldt/ldt/ldt_utils/projectserializer.py	Fri Jan 13 12:42:07 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/projectserializer.py	Fri Jan 13 16:13:03 2012 +0100
@@ -352,6 +352,8 @@
         elif content.videopath:
             href = content.videopath.rstrip('/') + "/" + content.src
             meta_item_value = content.videopath.rstrip('/') + "/"
+        else:
+            href = content.src
 
         new_media = {
              "http://advene.liris.cnrs.fr/ns/frame_of_reference/ms" : "o=0",
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Fri Jan 13 12:42:07 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Fri Jan 13 16:13:03 2012 +0100
@@ -104,13 +104,22 @@
             }      
             ]
         },
+      {% if youtube_url %}
       player:{
-      type:'jwplayer', // player type
-              live: true, 
-              height: 300, 
-              width: {{ player_width }}, 
-              provider: "rtmp" 
+    	  type:'youtube', // player type
+          height: 300, 
+          width: {{ player_width }}, 
+          video: '{{ youtube_url }}'
       },
+      {% else %}
+      player:{
+          type:'jwplayer', // player type
+          live: true, 
+          height: 300, 
+          width: {{ player_width }}, 
+          provider: "rtmp" 
+      },
+      {% endif %}
       modules: [
                { type: "MediaFragment",
                   metadata:{
--- a/src/ldt/ldt/ldt_utils/views/front.py	Fri Jan 13 12:42:07 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/front.py	Fri Jan 13 16:13:03 2012 +0100
@@ -64,6 +64,10 @@
 def annot_content(request, content_iri_id):
     # Get the wanted content
     content = Content.objects.get(iri_id=content_iri_id)
+    # Get the content src to see if it is a youtube video
+    youtube_url = None
+    if content.src is not None and "youtube.com" in content.src:
+        youtube_url = content.src
     # The main project for the content
     proj = Project.objects.filter(contents__in=[content])[0]
     # Vars for player
@@ -81,7 +85,7 @@
 
     return render_to_response("front/front_player.html",
                               {'content': content, 'project':proj, 'player_id': player_id, 
-                              'json_url': json_url, 'player_width':player_width, 'player_height':player_height, 'stream_mode':stream_mode,
+                              'json_url': json_url, 'player_width':player_width, 'player_height':player_height, 'stream_mode':stream_mode, 'youtube_url':youtube_url,
                                'is_gecko': is_gecko},
                               context_instance=RequestContext(request))
 
--- a/src/ldt/ldt/static/ldt/css/front_home.css	Fri Jan 13 12:42:07 2012 +0100
+++ b/src/ldt/ldt/static/ldt/css/front_home.css	Fri Jan 13 16:13:03 2012 +0100
@@ -22,7 +22,7 @@
     list-style: none;
 }
 .graph_annotation {
-    background: url(./imgs/whitealpha.png); margin:148px -297px; position:absolute;
+    background: url(./imgs/whitealpha.png); margin:148px -296px; position:absolute;
 }
 
 /* Plus annotés */