From 9219da65ae312dca1d15abac345b447d649f8506 Mon Sep 17 00:00:00 2001 From: Sanj Date: Mon, 14 Mar 2011 04:40:24 +0530 Subject: [PATCH] do client side seeking --- padmaTexts/static/js/views/sidebar.js | 11 ++++++++++- padmaTexts/templates/text_embed.html | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/padmaTexts/static/js/views/sidebar.js b/padmaTexts/static/js/views/sidebar.js index d7e55f2..7d372e9 100644 --- a/padmaTexts/static/js/views/sidebar.js +++ b/padmaTexts/static/js/views/sidebar.js @@ -108,12 +108,21 @@ function setupPadmaLink(videoObj, data) { var annotHeight = $(window).height() - 320; $('.annotationText').css({'height': annotHeight + "px"}); var videoElem = $('video'); + videoElem.bind("loadedmetadata", function() { + $(this).get(0).currentTime = parseInt(npt2ms(linkData.tcIn) / 1000); + $(this).get(0).play(); + }); videoElem.bind("play", function() { var that = this var displayLayers = padmaConfig.default_layers; videoObj.interval = setInterval(function() { var currentTime = parseInt(that.currentTime * 1000); - var time_ms = currentTime + npt2ms(linkData.tcIn); + if (currentTime > npt2ms(linkData.tcOut)) { + videoElem.get(0).pause(); + videoElem.trigger("ended"); + return; + } + var time_ms = currentTime; // + npt2ms(linkData.tcIn); var allLayers = videoObj.getLayersAtTimecode(time_ms); if (videoObj.currentLayers == allLayers) { return; diff --git a/padmaTexts/templates/text_embed.html b/padmaTexts/templates/text_embed.html index 8d89361..9532fb2 100644 --- a/padmaTexts/templates/text_embed.html +++ b/padmaTexts/templates/text_embed.html @@ -92,7 +92,7 @@ $(function() { - +