src/js/widgets/segmentsWidget.js
branchpopcorn-port
changeset 217 ec3e6d34462c
parent 214 50c4609e50f4
child 218 079b745d0438
equal deleted inserted replaced
216:d1e891627286 217:ec3e6d34462c
    15 IriSP.SegmentsWidget.prototype.draw = function() {
    15 IriSP.SegmentsWidget.prototype.draw = function() {
    16 
    16 
    17   var self = this;
    17   var self = this;
    18   var annotations = this._serializer._data.annotations;
    18   var annotations = this._serializer._data.annotations;
    19 
    19 
    20   this.positionMarker = this.selector.append("<div style='position: absolute; z-index: 100; width: 1px; height: 20px; background-color: black;'></div>");
    20   this.selector.append("<div style='position: absolute; z-index: 100; width: 1px; height: 20px; background-color: black;'></div>");
       
    21   this.positionMarker = this.selector.children(":first");
       
    22   
    21   this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.positionUpdater));
    23   this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.positionUpdater));
    22   
    24   
    23   this.selector.after("<div class='cleaner'></div>"); // we need to do this because the segments are floated                                                      
    25   this.selector.after("<div class='cleaner'></div>"); // we need to do this because the segments are floated                                                      
    24   
    26   
    25   var i = 0;
    27   var i = 0;
    81   }
    83   }
    82 };
    84 };
    83 
    85 
    84 IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) {
    86 IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) {
    85   var begin = Math.round((+ annotation.begin) / 1000);
    87   var begin = Math.round((+ annotation.begin) / 1000);
    86   this._Popcorn.currentTime(begin)
    88   this._Popcorn.currentTime(begin);
    87 };
    89 };
    88 
    90 
    89 IriSP.SegmentsWidget.prototype.searchHandler = function(searchString) {
    91 IriSP.SegmentsWidget.prototype.searchHandler = function(searchString) {
    90 
    92 
    91   if (searchString == "")
    93   if (searchString == "")
   126 };
   128 };
   127 
   129 
   128 IriSP.SegmentsWidget.prototype.positionUpdater = function() {  
   130 IriSP.SegmentsWidget.prototype.positionUpdater = function() {  
   129   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
   131   var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
   130   var time = this._Popcorn.currentTime();
   132   var time = this._Popcorn.currentTime();
   131   var position 	= IriSP.timeToPourcent(begin, duration);
   133   var position 	= ((time / duration) * 100).toFixed(2);
   132   
   134 
   133   this.positionMarker.css("left", position);
   135   this.positionMarker.css("left", position + "%");  
   134 };
   136 };