]> git.parisson.com Git - teleforma.git/commitdiff
add video link seeking based on media fragment URI
authoryomguy <yomguy@parisson.com>
Mon, 7 Jan 2013 22:26:55 +0000 (23:26 +0100)
committeryomguy <yomguy@parisson.com>
Mon, 7 Jan 2013 22:26:55 +0000 (23:26 +0100)
teleforma/templates/teleforma/seminar_media_audio.html
teleforma/templates/teleforma/seminar_media_video.html
teleforma/templatetags/teleforma_tags.py

index d54a97b03389d89c60763bf13303d7de6c63f805..a4ebdf42fac004fbfee94fb6e55712ecdba9f423 100644 (file)
 <div class="module">
   <h3><img src="{{STATIC_URL}}telemeta/images/module_playlist.png" alt="status" style="vertical-align:middle" /> {% trans "My steps" %}</h3>
  <div id="index">
-  {% include "teleforma/inc/steps.html" %}
+
+  <ul>
+  {% for marker in media_package.video.all.0.item.markers.all %}
+  {% if not forloop.first %}
+  <li>{{ marker.title }}</li>
+  {% endif %}
+  {% endfor %}
+  </ul>
+
  </div>
 </div>
 {% endblock index %}
index 4a74fa5c9ef9590cc0a4ebc0b4941762b399263a..0f6aa408dfc3adaa2df4989f2cd7132533c3cfcd 100644 (file)
@@ -88,7 +88,7 @@ $(window).ready(function(){
 <div class="video">
 <video id="my_video_1" class="video-js vjs-default-skin" width="640" height="360" controls preload="auto" data-setup='{}'>
 {% for media in media_package.video.all|free_first %}
-    <source src="{{ MEDIA_URL }}{{ media.item.file }}" type="{{ media.mime_type }}" />
+    <source src="{{ MEDIA_URL }}{{ media.item.file }}#t=0" type="{{ media.mime_type }}" />
 {% endfor %}
 </video>
 </div>
@@ -132,9 +132,32 @@ $(window).ready(function(){
 
 {% block index %}
 <div class="module">
-  <h3><img src="{{STATIC_URL}}telemeta/images/module_playlist.png" alt="status" style="vertical-align:middle" /> {% trans "My steps" %}</h3>
+  <h3><img src="{{STATIC_URL}}telemeta/images/module_playlist.png" alt="status" style="vertical-align:middle" /> {% trans "Shortcuts" %}</h3>
  <div id="index">
-  {% include "teleforma/inc/steps.html" %}
+  <ul>
+  {% for marker in media_package.video.all.0.item.markers.all %}
+  {% if not forloop.first %}
+  <li><a href="#" onclick="jumpToTimeoffset({{ marker.time|point }});">{{ marker.title }}</a></li>
+  {% endif %}
+  {% endfor %}
+  </ul>
  </div>
 </div>
+
+<script type="text/javascript">
+
+var video = $('#my_video_1');
+var Player = _V_("my_video_1");
+
+// jump to time offset action
+function jumpToTimeoffset(time) {
+    // Player.currentTime(time);
+    var url = video.attr("src")
+    var abs_url = url.split("#")[0];
+    video.attr("src", abs_url + '#t=' + String(time));
+    Player.play();    
+}
+
+</script>
+
 {% endblock index %}
index fb9d7eb3b3c1984cbc705bff5570f83c52c29894..7f0e266682fad5121cf98899b717e43010431b3d 100644 (file)
@@ -277,3 +277,7 @@ def admin_username():
 def hours(time):
     return str(int(str(time).split(':')[0]))
 
+@register.filter
+def point(time):
+    return str(time)
+