src/js/widgets/segmentsWidget.js
branchpopcorn-port
changeset 313 7df805ebb75e
parent 304 a938013fc6ea
child 321 21d840371c6b
equal deleted inserted replaced
312:228b27fd2a7c 313:7df805ebb75e
   115 			IriSP.jQuery("#"+id).animate({opacity:0.3}, 100);
   115 			IriSP.jQuery("#"+id).animate({opacity:0.3}, 100);
   116   }
   116   }
   117 };
   117 };
   118 
   118 
   119 IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) {
   119 IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) {
   120   var begin = Math.round((+ annotation.begin) / 1000);
   120   var begin = (+ annotation.begin) / 1000;
   121   var end = Math.round((+ annotation.end) / 1000);
   121   var end = (+ annotation.end) / 1000;
   122   this._Popcorn.currentTime(begin);
   122   this._Popcorn.currentTime(Math.floor(begin));
   123 
   123 
   124   var duration = +this._serializer.currentMedia().meta["dc:duration"] / 1000;
   124   var duration = +this._serializer.currentMedia().meta["dc:duration"] / 1000;
   125   var middle_time = (begin + end) / 2;
   125   var middle_time = (begin + end) / 2;
   126   var percents = Math.round((middle_time / duration) * 100);
   126   var percents = Math.floor((middle_time / duration) * 100);
   127 
   127 
       
   128   console.log(begin, end, duration, middle_time, percents);
   128   this._Popcorn.trigger("IriSP.SegmentsWidget.segmentClick", percents);
   129   this._Popcorn.trigger("IriSP.SegmentsWidget.segmentClick", percents);
   129 };
   130 };
   130 
   131 
   131 IriSP.SegmentsWidget.prototype.searchHandler = function(searchString) {
   132 IriSP.SegmentsWidget.prototype.searchHandler = function(searchString) {
   132 
   133