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