function setupVideo(v) { var vidInterval = 0; var vidSrc = v.video.urls['320']; $('#videoPlayer').attr("src", vidSrc).attr("poster", v.getPoster()).get(0).load(); $('#videoTitle').text(v.video.title); $('#videoPlayer').bind("play", function() { var $this = $(this); clearInterval(vidInterval); vidInterval = setInterval(function() { var tc = $this.get(0).currentTime; var tcMs = parseInt(tc * 1000); var currentLayers = v.getLayersAtTimecode(tcMs); var annotHtml = getAnnotHtml(currentLayers); if (annotHtml == $('#videoAnnotations').html()) { $.noop(); } else { $('#videoAnnotations').html(annotHtml); } // console.log(tc); }, 400); }); $('#videoPlayer').bind("pause", function() { clearInterval(vidInterval); }); } function getAnnotHtml(padmaLayers) { var html = ''; var types = ['location', 'keyword', 'description', 'transcript']; for (var i=0; i"; var theseLayers = filterLayersByTracks(padmaLayers, [t]); for (var j=0; j