src/js/widgets/segmentsWidget.js
branchpopcorn-port
changeset 304 a938013fc6ea
parent 303 cb091d204ba9
child 313 7df805ebb75e
equal deleted inserted replaced
303:cb091d204ba9 304:a938013fc6ea
   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 = Math.round((+ annotation.begin) / 1000);
       
   121   var end = Math.round((+ annotation.end) / 1000);
   121   this._Popcorn.currentTime(begin);
   122   this._Popcorn.currentTime(begin);
       
   123 
       
   124   var duration = +this._serializer.currentMedia().meta["dc:duration"] / 1000;
       
   125   var middle_time = (begin + end) / 2;
       
   126   var percents = Math.round((middle_time / duration) * 100);
       
   127 
       
   128   this._Popcorn.trigger("IriSP.SegmentsWidget.segmentClick", percents);
   122 };
   129 };
   123 
   130 
   124 IriSP.SegmentsWidget.prototype.searchHandler = function(searchString) {
   131 IriSP.SegmentsWidget.prototype.searchHandler = function(searchString) {
   125 
   132 
   126   if (searchString == "")
   133   if (searchString == "")