handle annot previews, gracefully

This commit is contained in:
Sanj 2011-03-14 06:34:27 +05:30
parent a4a76f48bc
commit 5b75ceffc0

View File

@ -108,8 +108,10 @@ function setupPadmaLink(videoObj, data) {
var annotHeight = $(window).height() - 340;
$('.annotationText').css({'height': annotHeight + "px"});
var videoElem = $('video');
var in_ms = npt2ms(linkData.tcIn);
$('.annotationText').html(getLayersHtml(in_ms, padmaConfig.default_layers));
videoElem.bind("loadedmetadata", function() {
$(this).get(0).currentTime = parseInt(npt2ms(linkData.tcIn) / 1000);
$(this).get(0).currentTime = parseInt(in_ms / 1000);
$(this).get(0).play();
});
videoElem.bind("play", function() {
@ -117,6 +119,9 @@ function setupPadmaLink(videoObj, data) {
var displayLayers = padmaConfig.default_layers;
videoObj.interval = setInterval(function() {
var currentTime = parseInt(that.currentTime * 1000);
if (currentTime == 0) { return; } //Browser seems to return 0 as current time somewhere in between loadedmetadata, setting currentTime, and the play callback - this is a slightly silly hack - #FIXME.
// console.log(currentTime);
if (currentTime > npt2ms(linkData.tcOut)) {
videoElem.get(0).pause();
videoElem.trigger("ended");